Lines Matching +full:nr +full:- +full:outputs
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * lm85.c - Part of lm_sensors, Linux kernel modules for hardware
7 * Copyright (c) 2003 Margit Schubert-While <margitsw@t-online.de>
9 * Copyright (C) 2007--2014 Jean Delvare <jdelvare@suse.de>
21 #include <linux/hwmon-vid.h>
22 #include <linux/hwmon-sysfs.h>
38 #define LM85_REG_IN(nr) (0x20 + (nr)) argument
39 #define LM85_REG_IN_MIN(nr) (0x44 + (nr) * 2) argument
40 #define LM85_REG_IN_MAX(nr) (0x45 + (nr) * 2) argument
42 #define LM85_REG_TEMP(nr) (0x25 + (nr)) argument
43 #define LM85_REG_TEMP_MIN(nr) (0x4e + (nr) * 2) argument
44 #define LM85_REG_TEMP_MAX(nr) (0x4f + (nr) * 2) argument
47 #define LM85_REG_FAN(nr) (0x28 + (nr) * 2) argument
48 #define LM85_REG_FAN_MIN(nr) (0x54 + (nr) * 2) argument
50 #define LM85_REG_PWM(nr) (0x30 + (nr)) argument
59 ((data)->type == adt7468 && !((data)->cfg5 & ADT7468_OFF64))
61 ((data)->type == adt7468 && !((data)->cfg5 & ADT7468_HFPWM))
91 #define LM85_REG_AFAN_CONFIG(nr) (0x5c + (nr)) argument
92 #define LM85_REG_AFAN_RANGE(nr) (0x5f + (nr)) argument
94 #define LM85_REG_AFAN_MINPWM(nr) (0x64 + (nr)) argument
95 #define LM85_REG_AFAN_LIMIT(nr) (0x67 + (nr)) argument
96 #define LM85_REG_AFAN_CRITICAL(nr) (0x6a + (nr)) argument
105 #define EMC6D100_REG_IN(nr) (0x70 + ((nr) - 5)) argument
106 #define EMC6D100_REG_IN_MIN(nr) (0x73 + ((nr) - 5) * 2) argument
107 #define EMC6D100_REG_IN_MAX(nr) (0x74 + ((nr) - 5) * 2) argument
119 /* IN are scaled according to built-in resistors */
142 #define FAN_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \
147 DIV_ROUND_CLOSEST(clamp_val((val), -127000, 127000), 1000)
158 * Hysteresis (below limit), 1. degC (0-15)
159 * Range of speed control, .1 degC (2-80)
214 * 1 -- PWM responds to Zone 1
215 * 2 -- PWM responds to Zone 2
216 * 3 -- PWM responds to Zone 3
217 * 23 -- PWM responds to the higher temp of Zone 2 or 3
218 * 123 -- PWM responds to highest of Zone 1, 2, or 3
219 * 0 -- PWM is always at 0% (ie, off)
220 * -1 -- PWM is always at 100%
221 * -2 -- PWM responds to manual control
224 static const int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 };
266 u8 hyst; /* Low limit hysteresis. (0-15) */
371 struct i2c_client *client = data->client; in lm85_update_device()
374 mutex_lock(&data->update_lock); in lm85_update_device()
376 if (!data->valid || in lm85_update_device()
377 time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL)) { in lm85_update_device()
379 dev_dbg(&client->dev, "Reading sensor values\n"); in lm85_update_device()
387 if (data->type == adm1027 || data->type == adt7463 || in lm85_update_device()
388 data->type == adt7468) { in lm85_update_device()
396 data->in_ext[i] = in lm85_update_device()
400 data->temp_ext[i] = in lm85_update_device()
404 data->vid = lm85_read_value(client, LM85_REG_VID); in lm85_update_device()
407 data->in[i] = in lm85_update_device()
409 data->fan[i] = in lm85_update_device()
413 if (!data->has_vid5) in lm85_update_device()
414 data->in[4] = lm85_read_value(client, LM85_REG_IN(4)); in lm85_update_device()
416 if (data->type == adt7468) in lm85_update_device()
417 data->cfg5 = lm85_read_value(client, ADT7468_REG_CFG5); in lm85_update_device()
420 data->temp[i] = in lm85_update_device()
422 data->pwm[i] = in lm85_update_device()
426 data->temp[i] -= 64; in lm85_update_device()
429 data->alarms = lm85_read_value(client, LM85_REG_ALARM1); in lm85_update_device()
431 if (data->type == emc6d100) { in lm85_update_device()
434 data->in[i] = lm85_read_value(client, in lm85_update_device()
438 data->alarms |= lm85_read_value(client, in lm85_update_device()
440 } else if (data->type == emc6d102 || data->type == emc6d103 || in lm85_update_device()
441 data->type == emc6d103s) { in lm85_update_device()
455 data->in_ext[0] = ext3 & 0x0f; in lm85_update_device()
456 data->in_ext[1] = ext4 & 0x0f; in lm85_update_device()
457 data->in_ext[2] = ext4 >> 4; in lm85_update_device()
458 data->in_ext[3] = ext3 >> 4; in lm85_update_device()
459 data->in_ext[4] = ext2 >> 4; in lm85_update_device()
461 data->temp_ext[0] = ext1 & 0x0f; in lm85_update_device()
462 data->temp_ext[1] = ext2 & 0x0f; in lm85_update_device()
463 data->temp_ext[2] = ext1 >> 4; in lm85_update_device()
466 data->last_reading = jiffies; in lm85_update_device()
469 if (!data->valid || in lm85_update_device()
470 time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL)) { in lm85_update_device()
472 dev_dbg(&client->dev, "Reading config values\n"); in lm85_update_device()
475 data->in_min[i] = in lm85_update_device()
477 data->in_max[i] = in lm85_update_device()
479 data->fan_min[i] = in lm85_update_device()
483 if (!data->has_vid5) { in lm85_update_device()
484 data->in_min[4] = lm85_read_value(client, in lm85_update_device()
486 data->in_max[4] = lm85_read_value(client, in lm85_update_device()
490 if (data->type == emc6d100) { in lm85_update_device()
492 data->in_min[i] = lm85_read_value(client, in lm85_update_device()
494 data->in_max[i] = lm85_read_value(client, in lm85_update_device()
502 data->temp_min[i] = in lm85_update_device()
504 data->temp_max[i] = in lm85_update_device()
507 data->autofan[i].config = in lm85_update_device()
510 data->pwm_freq[i] = val % data->freq_map_size; in lm85_update_device()
511 data->zone[i].range = val >> 4; in lm85_update_device()
512 data->autofan[i].min_pwm = in lm85_update_device()
514 data->zone[i].limit = in lm85_update_device()
516 data->zone[i].critical = in lm85_update_device()
520 data->temp_min[i] -= 64; in lm85_update_device()
521 data->temp_max[i] -= 64; in lm85_update_device()
522 data->zone[i].limit -= 64; in lm85_update_device()
523 data->zone[i].critical -= 64; in lm85_update_device()
527 if (data->type != emc6d103s) { in lm85_update_device()
529 data->autofan[0].min_off = (i & 0x20) != 0; in lm85_update_device()
530 data->autofan[1].min_off = (i & 0x40) != 0; in lm85_update_device()
531 data->autofan[2].min_off = (i & 0x80) != 0; in lm85_update_device()
534 data->zone[0].hyst = i >> 4; in lm85_update_device()
535 data->zone[1].hyst = i & 0x0f; in lm85_update_device()
538 data->zone[2].hyst = i >> 4; in lm85_update_device()
541 data->last_config = jiffies; in lm85_update_device()
544 data->valid = true; in lm85_update_device()
546 mutex_unlock(&data->update_lock); in lm85_update_device()
555 int nr = to_sensor_dev_attr(attr)->index; in fan_show() local
557 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr])); in fan_show()
563 int nr = to_sensor_dev_attr(attr)->index; in fan_min_show() local
565 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr])); in fan_min_show()
572 int nr = to_sensor_dev_attr(attr)->index; in fan_min_store() local
574 struct i2c_client *client = data->client; in fan_min_store()
582 mutex_lock(&data->update_lock); in fan_min_store()
583 data->fan_min[nr] = FAN_TO_REG(val); in fan_min_store()
584 lm85_write_value(client, LM85_REG_FAN_MIN(nr), data->fan_min[nr]); in fan_min_store()
585 mutex_unlock(&data->update_lock); in fan_min_store()
606 if (data->has_vid5) { in cpu0_vid_show()
607 /* 6-pin VID (VRM 10) */ in cpu0_vid_show()
608 vid = vid_from_reg(data->vid & 0x3f, data->vrm); in cpu0_vid_show()
610 /* 5-pin VID (VRM 9) */ in cpu0_vid_show()
611 vid = vid_from_reg(data->vid & 0x1f, data->vrm); in cpu0_vid_show()
623 return sprintf(buf, "%ld\n", (long) data->vrm); in vrm_show()
638 return -EINVAL; in vrm_store()
640 data->vrm = val; in vrm_store()
650 return sprintf(buf, "%u\n", data->alarms); in alarms_show()
658 int nr = to_sensor_dev_attr(attr)->index; in alarm_show() local
660 return sprintf(buf, "%u\n", (data->alarms >> nr) & 1); in alarm_show()
686 int nr = to_sensor_dev_attr(attr)->index; in pwm_show() local
688 return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm[nr])); in pwm_show()
694 int nr = to_sensor_dev_attr(attr)->index; in pwm_store() local
696 struct i2c_client *client = data->client; in pwm_store()
704 mutex_lock(&data->update_lock); in pwm_store()
705 data->pwm[nr] = PWM_TO_REG(val); in pwm_store()
706 lm85_write_value(client, LM85_REG_PWM(nr), data->pwm[nr]); in pwm_store()
707 mutex_unlock(&data->update_lock); in pwm_store()
714 int nr = to_sensor_dev_attr(attr)->index; in pwm_enable_show() local
718 pwm_zone = ZONE_FROM_REG(data->autofan[nr].config); in pwm_enable_show()
720 case -1: /* PWM is always at 100% */ in pwm_enable_show()
724 case -2: /* PWM responds to manual control */ in pwm_enable_show()
737 int nr = to_sensor_dev_attr(attr)->index; in pwm_enable_store() local
739 struct i2c_client *client = data->client; in pwm_enable_store()
763 return -EINVAL; in pwm_enable_store()
766 mutex_lock(&data->update_lock); in pwm_enable_store()
767 data->autofan[nr].config = lm85_read_value(client, in pwm_enable_store()
768 LM85_REG_AFAN_CONFIG(nr)); in pwm_enable_store()
769 data->autofan[nr].config = (data->autofan[nr].config & ~0xe0) in pwm_enable_store()
771 lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr), in pwm_enable_store()
772 data->autofan[nr].config); in pwm_enable_store()
773 mutex_unlock(&data->update_lock); in pwm_enable_store()
780 int nr = to_sensor_dev_attr(attr)->index; in pwm_freq_show() local
787 freq = FREQ_FROM_REG(data->freq_map, data->freq_map_size, in pwm_freq_show()
788 data->pwm_freq[nr]); in pwm_freq_show()
797 int nr = to_sensor_dev_attr(attr)->index; in pwm_freq_store() local
799 struct i2c_client *client = data->client; in pwm_freq_store()
807 mutex_lock(&data->update_lock); in pwm_freq_store()
809 * The ADT7468 has a special high-frequency PWM output mode, in pwm_freq_store()
810 * where all PWM outputs are driven by a 22.5 kHz clock. in pwm_freq_store()
813 if (data->type == adt7468 && val >= 11300) { /* High freq. mode */ in pwm_freq_store()
814 data->cfg5 &= ~ADT7468_HFPWM; in pwm_freq_store()
815 lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5); in pwm_freq_store()
817 data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, in pwm_freq_store()
818 data->freq_map_size, val); in pwm_freq_store()
819 lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), in pwm_freq_store()
820 (data->zone[nr].range << 4) in pwm_freq_store()
821 | data->pwm_freq[nr]); in pwm_freq_store()
822 if (data->type == adt7468) { in pwm_freq_store()
823 data->cfg5 |= ADT7468_HFPWM; in pwm_freq_store()
824 lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5); in pwm_freq_store()
827 mutex_unlock(&data->update_lock); in pwm_freq_store()
846 int nr = to_sensor_dev_attr(attr)->index; in in_show() local
848 return sprintf(buf, "%d\n", INSEXT_FROM_REG(nr, data->in[nr], in in_show()
849 data->in_ext[nr])); in in_show()
855 int nr = to_sensor_dev_attr(attr)->index; in in_min_show() local
857 return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_min[nr])); in in_min_show()
863 int nr = to_sensor_dev_attr(attr)->index; in in_min_store() local
865 struct i2c_client *client = data->client; in in_min_store()
873 mutex_lock(&data->update_lock); in in_min_store()
874 data->in_min[nr] = INS_TO_REG(nr, val); in in_min_store()
875 lm85_write_value(client, LM85_REG_IN_MIN(nr), data->in_min[nr]); in in_min_store()
876 mutex_unlock(&data->update_lock); in in_min_store()
883 int nr = to_sensor_dev_attr(attr)->index; in in_max_show() local
885 return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_max[nr])); in in_max_show()
891 int nr = to_sensor_dev_attr(attr)->index; in in_max_store() local
893 struct i2c_client *client = data->client; in in_max_store()
901 mutex_lock(&data->update_lock); in in_max_store()
902 data->in_max[nr] = INS_TO_REG(nr, val); in in_max_store()
903 lm85_write_value(client, LM85_REG_IN_MAX(nr), data->in_max[nr]); in in_max_store()
904 mutex_unlock(&data->update_lock); in in_max_store()
938 int nr = to_sensor_dev_attr(attr)->index; in temp_show() local
940 return sprintf(buf, "%d\n", TEMPEXT_FROM_REG(data->temp[nr], in temp_show()
941 data->temp_ext[nr])); in temp_show()
947 int nr = to_sensor_dev_attr(attr)->index; in temp_min_show() local
949 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr])); in temp_min_show()
956 int nr = to_sensor_dev_attr(attr)->index; in temp_min_store() local
958 struct i2c_client *client = data->client; in temp_min_store()
969 mutex_lock(&data->update_lock); in temp_min_store()
970 data->temp_min[nr] = TEMP_TO_REG(val); in temp_min_store()
971 lm85_write_value(client, LM85_REG_TEMP_MIN(nr), data->temp_min[nr]); in temp_min_store()
972 mutex_unlock(&data->update_lock); in temp_min_store()
979 int nr = to_sensor_dev_attr(attr)->index; in temp_max_show() local
981 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr])); in temp_max_show()
988 int nr = to_sensor_dev_attr(attr)->index; in temp_max_store() local
990 struct i2c_client *client = data->client; in temp_max_store()
1001 mutex_lock(&data->update_lock); in temp_max_store()
1002 data->temp_max[nr] = TEMP_TO_REG(val); in temp_max_store()
1003 lm85_write_value(client, LM85_REG_TEMP_MAX(nr), data->temp_max[nr]); in temp_max_store()
1004 mutex_unlock(&data->update_lock); in temp_max_store()
1024 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_channels_show() local
1026 return sprintf(buf, "%d\n", ZONE_FROM_REG(data->autofan[nr].config)); in pwm_auto_channels_show()
1033 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_channels_store() local
1035 struct i2c_client *client = data->client; in pwm_auto_channels_store()
1043 mutex_lock(&data->update_lock); in pwm_auto_channels_store()
1044 data->autofan[nr].config = (data->autofan[nr].config & (~0xe0)) in pwm_auto_channels_store()
1046 lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr), in pwm_auto_channels_store()
1047 data->autofan[nr].config); in pwm_auto_channels_store()
1048 mutex_unlock(&data->update_lock); in pwm_auto_channels_store()
1055 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_pwm_min_show() local
1057 return sprintf(buf, "%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm)); in pwm_auto_pwm_min_show()
1064 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_pwm_min_store() local
1066 struct i2c_client *client = data->client; in pwm_auto_pwm_min_store()
1074 mutex_lock(&data->update_lock); in pwm_auto_pwm_min_store()
1075 data->autofan[nr].min_pwm = PWM_TO_REG(val); in pwm_auto_pwm_min_store()
1076 lm85_write_value(client, LM85_REG_AFAN_MINPWM(nr), in pwm_auto_pwm_min_store()
1077 data->autofan[nr].min_pwm); in pwm_auto_pwm_min_store()
1078 mutex_unlock(&data->update_lock); in pwm_auto_pwm_min_store()
1086 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_pwm_minctl_show() local
1088 return sprintf(buf, "%d\n", data->autofan[nr].min_off); in pwm_auto_pwm_minctl_show()
1095 int nr = to_sensor_dev_attr(attr)->index; in pwm_auto_pwm_minctl_store() local
1097 struct i2c_client *client = data->client; in pwm_auto_pwm_minctl_store()
1106 mutex_lock(&data->update_lock); in pwm_auto_pwm_minctl_store()
1107 data->autofan[nr].min_off = val; in pwm_auto_pwm_minctl_store()
1109 tmp &= ~(0x20 << nr); in pwm_auto_pwm_minctl_store()
1110 if (data->autofan[nr].min_off) in pwm_auto_pwm_minctl_store()
1111 tmp |= 0x20 << nr; in pwm_auto_pwm_minctl_store()
1113 mutex_unlock(&data->update_lock); in pwm_auto_pwm_minctl_store()
1133 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_off_show() local
1135 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) - in temp_auto_temp_off_show()
1136 HYST_FROM_REG(data->zone[nr].hyst)); in temp_auto_temp_off_show()
1143 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_off_store() local
1145 struct i2c_client *client = data->client; in temp_auto_temp_off_store()
1154 mutex_lock(&data->update_lock); in temp_auto_temp_off_store()
1155 min = TEMP_FROM_REG(data->zone[nr].limit); in temp_auto_temp_off_store()
1156 data->zone[nr].hyst = HYST_TO_REG(min - val); in temp_auto_temp_off_store()
1157 if (nr == 0 || nr == 1) { in temp_auto_temp_off_store()
1159 (data->zone[0].hyst << 4) in temp_auto_temp_off_store()
1160 | data->zone[1].hyst); in temp_auto_temp_off_store()
1163 (data->zone[2].hyst << 4)); in temp_auto_temp_off_store()
1165 mutex_unlock(&data->update_lock); in temp_auto_temp_off_store()
1173 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_min_show() local
1175 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit)); in temp_auto_temp_min_show()
1182 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_min_store() local
1184 struct i2c_client *client = data->client; in temp_auto_temp_min_store()
1192 mutex_lock(&data->update_lock); in temp_auto_temp_min_store()
1193 data->zone[nr].limit = TEMP_TO_REG(val); in temp_auto_temp_min_store()
1194 lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr), in temp_auto_temp_min_store()
1195 data->zone[nr].limit); in temp_auto_temp_min_store()
1198 data->zone[nr].range = RANGE_TO_REG( in temp_auto_temp_min_store()
1199 TEMP_FROM_REG(data->zone[nr].max_desired) - in temp_auto_temp_min_store()
1200 TEMP_FROM_REG(data->zone[nr].limit)); in temp_auto_temp_min_store()
1201 lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), in temp_auto_temp_min_store()
1202 ((data->zone[nr].range & 0x0f) << 4) in temp_auto_temp_min_store()
1203 | data->pwm_freq[nr]); in temp_auto_temp_min_store()
1205 mutex_unlock(&data->update_lock); in temp_auto_temp_min_store()
1213 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_max_show() local
1215 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) + in temp_auto_temp_max_show()
1216 RANGE_FROM_REG(data->zone[nr].range)); in temp_auto_temp_max_show()
1223 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_max_store() local
1225 struct i2c_client *client = data->client; in temp_auto_temp_max_store()
1234 mutex_lock(&data->update_lock); in temp_auto_temp_max_store()
1235 min = TEMP_FROM_REG(data->zone[nr].limit); in temp_auto_temp_max_store()
1236 data->zone[nr].max_desired = TEMP_TO_REG(val); in temp_auto_temp_max_store()
1237 data->zone[nr].range = RANGE_TO_REG( in temp_auto_temp_max_store()
1238 val - min); in temp_auto_temp_max_store()
1239 lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), in temp_auto_temp_max_store()
1240 ((data->zone[nr].range & 0x0f) << 4) in temp_auto_temp_max_store()
1241 | data->pwm_freq[nr]); in temp_auto_temp_max_store()
1242 mutex_unlock(&data->update_lock); in temp_auto_temp_max_store()
1250 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_crit_show() local
1252 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].critical)); in temp_auto_temp_crit_show()
1259 int nr = to_sensor_dev_attr(attr)->index; in temp_auto_temp_crit_store() local
1261 struct i2c_client *client = data->client; in temp_auto_temp_crit_store()
1269 mutex_lock(&data->update_lock); in temp_auto_temp_crit_store()
1270 data->zone[nr].critical = TEMP_TO_REG(val); in temp_auto_temp_crit_store()
1271 lm85_write_value(client, LM85_REG_AFAN_CRITICAL(nr), in temp_auto_temp_crit_store()
1272 data->zone[nr].critical); in temp_auto_temp_crit_store()
1273 mutex_unlock(&data->update_lock); in temp_auto_temp_crit_store()
1434 dev_info(&client->dev, "Starting monitoring\n"); in lm85_init_client()
1440 dev_warn(&client->dev, "Device configuration is locked\n"); in lm85_init_client()
1442 dev_warn(&client->dev, "Device is not ready\n"); in lm85_init_client()
1465 /* Return 0 if detection is successful, -ENODEV otherwise */
1468 struct i2c_adapter *adapter = client->adapter; in lm85_detect()
1469 int address = client->addr; in lm85_detect()
1475 return -ENODEV; in lm85_detect()
1482 dev_dbg(&adapter->dev, in lm85_detect()
1498 dev_dbg(&adapter->dev, in lm85_detect()
1500 return -ENODEV; in lm85_detect()
1540 return -ENODEV; in lm85_detect()
1542 strscpy(info->type, type_name, I2C_NAME_SIZE); in lm85_detect()
1549 struct device *dev = &client->dev; in lm85_probe()
1556 return -ENOMEM; in lm85_probe()
1558 data->client = client; in lm85_probe()
1559 data->type = (uintptr_t)i2c_get_match_data(client); in lm85_probe()
1560 mutex_init(&data->update_lock); in lm85_probe()
1563 switch (data->type) { in lm85_probe()
1571 data->freq_map = adm1027_freq_map; in lm85_probe()
1572 data->freq_map_size = ARRAY_SIZE(adm1027_freq_map); in lm85_probe()
1575 data->freq_map = lm96000_freq_map; in lm85_probe()
1576 data->freq_map_size = ARRAY_SIZE(lm96000_freq_map); in lm85_probe()
1579 data->freq_map = lm85_freq_map; in lm85_probe()
1580 data->freq_map_size = ARRAY_SIZE(lm85_freq_map); in lm85_probe()
1584 data->vrm = vid_which_vrm(); in lm85_probe()
1590 data->groups[idx++] = &lm85_group; in lm85_probe()
1593 if (data->type != emc6d103s) { in lm85_probe()
1594 data->groups[idx++] = &lm85_group_minctl; in lm85_probe()
1595 data->groups[idx++] = &lm85_group_temp_off; in lm85_probe()
1602 if (data->type == adt7463 || data->type == adt7468) { in lm85_probe()
1605 data->has_vid5 = true; in lm85_probe()
1608 if (!data->has_vid5) in lm85_probe()
1609 data->groups[idx++] = &lm85_group_in4; in lm85_probe()
1612 if (data->type == emc6d100) in lm85_probe()
1613 data->groups[idx++] = &lm85_group_in567; in lm85_probe()
1615 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, in lm85_probe()
1616 data, data->groups); in lm85_probe()
1706 "Margit Schubert-While <margitsw@t-online.de>, "
1708 MODULE_DESCRIPTION("LM85-B, LM85-C driver");