41 #include <linux/module.h>
43 #include <linux/slab.h>
44 #include <linux/i2c.h>
55 #define LM93_REG_MFR_ID 0x3e
56 #define LM93_REG_VER 0x3f
57 #define LM93_REG_STATUS_CONTROL 0xe2
58 #define LM93_REG_CONFIG 0xe3
59 #define LM93_REG_SLEEP_CONTROL 0xe4
62 #define LM93_REG_HOST_ERROR_1 0x48
65 #define LM93_REG_IN(nr) (0x56 + (nr))
66 #define LM93_REG_IN_MIN(nr) (0x90 + (nr) * 2)
67 #define LM93_REG_IN_MAX(nr) (0x91 + (nr) * 2)
70 #define LM93_REG_TEMP(nr) (0x50 + (nr))
71 #define LM93_REG_TEMP_MIN(nr) (0x78 + (nr) * 2)
72 #define LM93_REG_TEMP_MAX(nr) (0x79 + (nr) * 2)
75 #define LM93_REG_BOOST(nr) (0x80 + (nr))
78 #define LM93_REG_PROCHOT_CUR(nr) (0x67 + (nr) * 2)
79 #define LM93_REG_PROCHOT_AVG(nr) (0x68 + (nr) * 2)
80 #define LM93_REG_PROCHOT_MAX(nr) (0xb0 + (nr))
83 #define LM93_REG_FAN(nr) (0x6e + (nr) * 2)
84 #define LM93_REG_FAN_MIN(nr) (0xb4 + (nr) * 2)
87 #define LM93_REG_PWM_CTL(nr, reg) (0xc8 + (reg) + (nr) * 4)
88 #define LM93_PWM_CTL1 0x0
89 #define LM93_PWM_CTL2 0x1
90 #define LM93_PWM_CTL3 0x2
91 #define LM93_PWM_CTL4 0x3
94 #define LM93_REG_GPI 0x6b
97 #define LM93_REG_VID(nr) (0x6c + (nr))
100 #define LM93_REG_VCCP_LIMIT_OFF(nr) (0xb2 + (nr))
103 #define LM93_REG_BOOST_HYST_12 0xc0
104 #define LM93_REG_BOOST_HYST_34 0xc1
105 #define LM93_REG_BOOST_HYST(nr) (0xc0 + (nr)/2)
108 #define LM93_REG_PWM_MIN_HYST_12 0xc3
109 #define LM93_REG_PWM_MIN_HYST_34 0xc4
110 #define LM93_REG_PWM_MIN_HYST(nr) (0xc3 + (nr)/2)
113 #define LM93_REG_PROCHOT_OVERRIDE 0xc6
114 #define LM93_REG_PROCHOT_INTERVAL 0xc7
117 #define LM93_REG_TEMP_BASE(nr) (0xd0 + (nr))
120 #define LM93_REG_TEMP_OFFSET(step) (0xd4 + (step))
123 #define LM93_REG_PWM_RAMP_CTL 0xbf
126 #define LM93_REG_SFC1 0xbc
127 #define LM93_REG_SFC2 0xbd
128 #define LM93_REG_GPI_VID_CTL 0xbe
129 #define LM93_REG_SF_TACH_TO_PWM 0xe0
132 #define LM93_REG_GPI_ERR_MASK 0xec
133 #define LM93_REG_MISC_ERR_MASK 0xed
136 #define LM93_MFR_ID 0x73
137 #define LM93_MFR_ID_PROTOTYPE 0x72
140 #define LM94_MFR_ID_2 0x7a
141 #define LM94_MFR_ID 0x79
142 #define LM94_MFR_ID_PROTOTYPE 0x78
145 #define LM93_SMBUS_FUNC_FULL (I2C_FUNC_SMBUS_BYTE_DATA | \
146 I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA)
147 #define LM93_SMBUS_FUNC_MIN (I2C_FUNC_SMBUS_BYTE_DATA | \
148 I2C_FUNC_SMBUS_WORD_DATA)
151 static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e,
I2C_CLIENT_END };
155 static bool disable_block;
158 "Set to non-zero to disable SMBus block data transactions.");
164 static int vccp_limit_type[2] = {0, 0};
176 static const struct {
u8 cmd;
u8 len; } lm93_block_read_cmds[12] = {
315 static int LM93_VID_FROM_REG(
u8 reg)
321 static const u8 lm93_vin_reg_min[16] = {
322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae,
325 static const u8 lm93_vin_reg_max[16] = {
326 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
327 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd1,
338 static const unsigned long lm93_vin_val_min[16] = {
339 0, 0, 0, 0, 0, 0, 0, 0,
340 0, 0, 0, 0, 0, 0, 0, 3000,
343 static const unsigned long lm93_vin_val_max[16] = {
344 1236, 1236, 1236, 1600, 2000, 2000, 1600, 1600,
345 4400, 6500, 3333, 2625, 1312, 1312, 1236, 3600,
355 static unsigned LM93_IN_FROM_REG(
int nr,
u8 reg)
357 const long uV_max = lm93_vin_val_max[
nr] * 1000;
358 const long uV_min = lm93_vin_val_min[
nr] * 1000;
360 const long slope = (uV_max - uV_min) /
361 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]);
362 const long intercept = uV_min - slope * lm93_vin_reg_min[
nr];
364 return (slope * reg + intercept + 500) / 1000;
371 static u8 LM93_IN_TO_REG(
int nr,
unsigned val)
374 const long mV = SENSORS_LIMIT(val,
375 lm93_vin_val_min[nr], lm93_vin_val_max[nr]);
378 const long uV = mV * 1000;
379 const long uV_max = lm93_vin_val_max[
nr] * 1000;
380 const long uV_min = lm93_vin_val_min[
nr] * 1000;
383 const long slope = (uV_max - uV_min) /
384 (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]);
385 const long intercept = uV_min - slope * lm93_vin_reg_min[
nr];
387 u8 result = ((uV - intercept + (slope/2)) / slope);
388 result = SENSORS_LIMIT(result,
389 lm93_vin_reg_min[nr], lm93_vin_reg_max[nr]);
394 static unsigned LM93_IN_REL_FROM_REG(
u8 reg,
int upper,
int vid)
396 const long uV_offset = upper ? (((reg >> 4 & 0x0f) + 1) * 12500) :
397 (((reg >> 0 & 0x0f) + 1) * -25000);
398 const long uV_vid =
vid * 1000;
399 return (uV_vid + uV_offset + 5000) / 10000;
402 #define LM93_IN_MIN_FROM_REG(reg, vid) LM93_IN_REL_FROM_REG((reg), 0, (vid))
403 #define LM93_IN_MAX_FROM_REG(reg, vid) LM93_IN_REL_FROM_REG((reg), 1, (vid))
410 static u8 LM93_IN_REL_TO_REG(
unsigned val,
int upper,
int vid)
412 long uV_offset = vid * 1000 - val * 10000;
414 uV_offset = SENSORS_LIMIT(uV_offset, 12500, 200000);
415 return (
u8)((uV_offset / 12500 - 1) << 4);
417 uV_offset = SENSORS_LIMIT(uV_offset, -400000, -25000);
418 return (
u8)((uV_offset / -25000 - 1) << 0);
426 static int LM93_TEMP_FROM_REG(
u8 reg)
428 return (
s8)reg * 1000;
431 #define LM93_TEMP_MIN (-128000)
432 #define LM93_TEMP_MAX (127000)
438 static u8 LM93_TEMP_TO_REG(
long temp)
441 ntemp += (ntemp < 0 ? -500 : 500);
442 return (
u8)(ntemp / 1000);
446 static int LM93_TEMP_OFFSET_MODE_FROM_REG(
u8 sfc2,
int nr)
449 return sfc2 & (nr < 2 ? 0x10 : 0x20);
457 static int LM93_TEMP_OFFSET_FROM_REG(
u8 reg,
int mode)
459 return (reg & 0x0f) * (mode ? 5 : 10);
462 #define LM93_TEMP_OFFSET_MIN (0)
463 #define LM93_TEMP_OFFSET_MAX0 (150)
464 #define LM93_TEMP_OFFSET_MAX1 (75)
471 static u8 LM93_TEMP_OFFSET_TO_REG(
int off,
int mode)
473 int factor = mode ? 5 : 10;
477 return (
u8)((off + factor/2) / factor);
481 static int LM93_TEMP_AUTO_OFFSET_FROM_REG(
u8 reg,
int nr,
int mode)
485 return LM93_TEMP_OFFSET_FROM_REG(reg & 0x0f, mode);
489 return LM93_TEMP_OFFSET_FROM_REG(reg >> 4 & 0x0f, mode);
497 static u8 LM93_TEMP_AUTO_OFFSET_TO_REG(
u8 old,
int off,
int nr,
int mode)
499 u8 new = LM93_TEMP_OFFSET_TO_REG(off, mode);
503 return (old & 0xf0) | (
new & 0x0f);
507 return (
new << 4 & 0xf0) | (old & 0x0f);
510 static int LM93_AUTO_BOOST_HYST_FROM_REGS(
struct lm93_data *
data,
int nr,
531 return LM93_TEMP_FROM_REG(data->
boost[nr]) -
532 LM93_TEMP_OFFSET_FROM_REG(reg, mode);
535 static u8 LM93_AUTO_BOOST_HYST_TO_REG(
struct lm93_data *data,
long hyst,
538 u8 reg = LM93_TEMP_OFFSET_TO_REG(
539 (LM93_TEMP_FROM_REG(data->
boost[nr]) - hyst), mode);
543 reg = (data->
boost_hyst[0] & 0xf0) | (reg & 0x0f);
546 reg = (reg << 4 & 0xf0) | (data->
boost_hyst[0] & 0x0f);
549 reg = (data->
boost_hyst[1] & 0xf0) | (reg & 0x0f);
553 reg = (reg << 4 & 0xf0) | (data->
boost_hyst[1] & 0x0f);
566 static int lm93_pwm_map[2][16] = {
591 return lm93_pwm_map[
freq][reg & 0x0f];
598 for (i = 0; i < 13; i++)
599 if (pwm <= lm93_pwm_map[freq][i])
606 static int LM93_FAN_FROM_REG(
u16 regs)
609 return count == 0 ? -1 : count == 0x3fff ? 0 : 1350000 /
count;
616 static u16 LM93_FAN_TO_REG(
long rpm)
623 rpm = SENSORS_LIMIT(rpm, 1, 1000000);
624 count = SENSORS_LIMIT((1350000 + rpm) / rpm, 1, 0x3ffe);
635 static int lm93_pwm_freq_map[8] = {
636 22500, 96, 84, 72, 60, 48, 36, 12
639 static int LM93_PWM_FREQ_FROM_REG(
u8 reg)
641 return lm93_pwm_freq_map[reg & 0x07];
645 static u8 LM93_PWM_FREQ_TO_REG(
int freq)
648 for (i = 7; i > 0; i--)
649 if (freq <= lm93_pwm_freq_map[i])
660 static int lm93_spinup_time_map[8] = {
661 0, 10, 25, 40, 70, 100, 200, 400,
664 static int LM93_SPINUP_TIME_FROM_REG(
u8 reg)
666 return lm93_spinup_time_map[reg >> 5 & 0x07];
670 static u8 LM93_SPINUP_TIME_TO_REG(
int time)
673 for (i = 0; i < 7; i++)
674 if (time <= lm93_spinup_time_map[i])
681 #define LM93_RAMP_MIN 0
682 #define LM93_RAMP_MAX 75
684 static int LM93_RAMP_FROM_REG(
u8 reg)
686 return (reg & 0x0f) * 5;
693 static u8 LM93_RAMP_TO_REG(
int ramp)
696 return (
u8)((ramp + 2) / 5);
703 static u8 LM93_PROCHOT_TO_REG(
long prochot)
705 prochot = SENSORS_LIMIT(prochot, 0, 255);
713 static int lm93_interval_map[10] = {
714 73, 146, 290, 580, 1170, 2330, 4660, 9320, 18600, 37200,
717 static int LM93_INTERVAL_FROM_REG(
u8 reg)
719 return lm93_interval_map[reg & 0x0f];
726 for (i = 0; i < 9; i++)
727 if (interval <= lm93_interval_map[i])
738 static unsigned LM93_GPI_FROM_REG(
u8 reg)
753 #define LM93_ALARM_IN1 0x00000001
754 #define LM93_ALARM_IN2 0x00000002
755 #define LM93_ALARM_IN3 0x00000004
756 #define LM93_ALARM_IN4 0x00000008
757 #define LM93_ALARM_IN5 0x00000010
758 #define LM93_ALARM_IN6 0x00000020
759 #define LM93_ALARM_IN7 0x00000040
760 #define LM93_ALARM_IN8 0x00000080
761 #define LM93_ALARM_IN9 0x00000100
762 #define LM93_ALARM_IN10 0x00000200
763 #define LM93_ALARM_IN11 0x00000400
764 #define LM93_ALARM_IN12 0x00000800
765 #define LM93_ALARM_IN13 0x00001000
766 #define LM93_ALARM_IN14 0x00002000
767 #define LM93_ALARM_IN15 0x00004000
768 #define LM93_ALARM_IN16 0x00008000
769 #define LM93_ALARM_FAN1 0x00010000
770 #define LM93_ALARM_FAN2 0x00020000
771 #define LM93_ALARM_FAN3 0x00040000
772 #define LM93_ALARM_FAN4 0x00080000
773 #define LM93_ALARM_PH1_ERR 0x00100000
774 #define LM93_ALARM_PH2_ERR 0x00200000
775 #define LM93_ALARM_SCSI1_ERR 0x00400000
776 #define LM93_ALARM_SCSI2_ERR 0x00800000
777 #define LM93_ALARM_DVDDP1_ERR 0x01000000
778 #define LM93_ALARM_DVDDP2_ERR 0x02000000
779 #define LM93_ALARM_D1_ERR 0x04000000
780 #define LM93_ALARM_D2_ERR 0x08000000
781 #define LM93_ALARM_TEMP1 0x10000000
782 #define LM93_ALARM_TEMP2 0x20000000
783 #define LM93_ALARM_TEMP3 0x40000000
785 static unsigned LM93_ALARMS_FROM_REG(
struct block1_t b1)
790 if (vccp_limit_type[0])
795 if (vccp_limit_type[1])
809 #define MAX_RETRIES 5
821 dev_warn(&client->
dev,
"lm93: read byte data failed, "
822 "address 0x%02x.\n", reg);
829 dev_err(&client->
dev,
"lm93: All read byte retries failed!!\n");
841 dev_warn(&client->
dev,
"lm93: write byte data failed, "
842 "0x%02x at address 0x%02x.\n", value, reg);
857 dev_warn(&client->
dev,
"lm93: read word data failed, "
858 "address 0x%02x.\n", reg);
865 dev_err(&client->
dev,
"lm93: All read word retries failed!!\n");
869 static int lm93_write_word(
struct i2c_client *client,
u8 reg,
u16 value)
877 dev_warn(&client->
dev,
"lm93: write word data failed, "
878 "0x%04x at address 0x%02x.\n", value, reg);
896 lm93_block_read_cmds[fbn].
cmd, lm93_block_buffer);
898 if (result == lm93_block_read_cmds[fbn].len) {
901 dev_warn(&client->
dev,
"lm93: block read data failed, "
903 lm93_block_read_cmds[fbn].cmd);
908 if (result == lm93_block_read_cmds[fbn].len) {
909 memcpy(values, lm93_block_buffer,
910 lm93_block_read_cmds[fbn].len);
919 struct lm93_data *data = i2c_get_clientdata(client);
920 const unsigned long interval =
HZ + (
HZ / 2);
927 data->
update(data, client);
937 static void lm93_update_client_common(
struct lm93_data *data,
944 for (i = 0; i < 4; i++) {
955 for (i = 0; i < 2; i++)
959 for (i = 0; i < 2; i++)
964 for (i = 0; i < 2; i++)
980 for (i = 0; i < 4; i++)
1003 for (i = 0, ptr = (
u8 *)(&data->
block1); i < 8; i++)
1008 static void lm93_update_client_full(
struct lm93_data *data,
1011 dev_dbg(&client->
dev,
"starting device update (block data enabled)\n");
1014 lm93_read_block(client, 3, (
u8 *)(data->
block3));
1015 lm93_read_block(client, 7, (
u8 *)(data->
block7));
1018 lm93_read_block(client, 2, (
u8 *)(data->
block2));
1021 lm93_read_block(client, 4, (
u8 *)(data->
block4));
1024 lm93_read_block(client, 5, (
u8 *)(data->
block5));
1025 lm93_read_block(client, 8, (
u8 *)(data->
block8));
1028 lm93_read_block(client, 9, (
u8 *)(data->
block9));
1031 lm93_read_block(client, 1, (
u8 *)(&data->
block1));
1034 lm93_read_block(client, 10, (
u8 *)(&data->
block10));
1036 lm93_update_client_common(data, client);
1040 static void lm93_update_client_min(
struct lm93_data *data,
1046 dev_dbg(&client->
dev,
"starting device update (block data disabled)\n");
1049 for (i = 0; i < 16; i++) {
1059 for (i = 0; i < 4; i++) {
1065 for (i = 0; i < 2; i++) {
1073 for (i = 0; i < 4; i++) {
1081 for (i = 0; i < 2; i++) {
1082 for (j = 0; j < 4; j++) {
1089 for (i = 0, ptr = (
u8 *)(&data->
block1); i < 8; i++) {
1095 for (i = 0; i < 4; i++) {
1101 for (i = 0; i < 12; i++) {
1106 lm93_update_client_common(data, client);
1115 struct lm93_data *data = lm93_update_device(dev);
1116 return sprintf(buf,
"%d\n", LM93_IN_FROM_REG(nr, data->
block3[nr]));
1140 struct lm93_data *data = lm93_update_device(dev);
1144 if ((nr == 6 || nr == 7) && vccp_limit_type[vccp]) {
1145 vid = LM93_VID_FROM_REG(data->
vid[vccp]);
1148 rc = LM93_IN_FROM_REG(nr, data->
block7[nr].min);
1150 return sprintf(buf,
"%ld\n", rc);
1154 const char *buf,
size_t count)
1158 struct lm93_data *data = i2c_get_clientdata(client);
1164 err = kstrtoul(buf, 10, &val);
1169 if ((nr == 6 || nr == 7) && vccp_limit_type[vccp]) {
1170 vid = LM93_VID_FROM_REG(data->
vid[vccp]);
1172 LM93_IN_REL_TO_REG(val, 0, vid);
1176 data->
block7[
nr].min = LM93_IN_TO_REG(nr, val);
1185 show_in_min, store_in_min, 0);
1187 show_in_min, store_in_min, 1);
1189 show_in_min, store_in_min, 2);
1191 show_in_min, store_in_min, 3);
1193 show_in_min, store_in_min, 4);
1195 show_in_min, store_in_min, 5);
1197 show_in_min, store_in_min, 6);
1199 show_in_min, store_in_min, 7);
1201 show_in_min, store_in_min, 8);
1203 show_in_min, store_in_min, 9);
1205 show_in_min, store_in_min, 10);
1207 show_in_min, store_in_min, 11);
1209 show_in_min, store_in_min, 12);
1211 show_in_min, store_in_min, 13);
1213 show_in_min, store_in_min, 14);
1215 show_in_min, store_in_min, 15);
1221 struct lm93_data *data = lm93_update_device(dev);
1225 if ((nr == 6 || nr == 7) && vccp_limit_type[vccp]) {
1226 vid = LM93_VID_FROM_REG(data->
vid[vccp]);
1229 rc = LM93_IN_FROM_REG(nr, data->
block7[nr].max);
1231 return sprintf(buf,
"%ld\n", rc);
1235 const char *buf,
size_t count)
1239 struct lm93_data *data = i2c_get_clientdata(client);
1245 err = kstrtoul(buf, 10, &val);
1250 if ((nr == 6 || nr == 7) && vccp_limit_type[vccp]) {
1251 vid = LM93_VID_FROM_REG(data->
vid[vccp]);
1253 LM93_IN_REL_TO_REG(val, 1, vid);
1257 data->
block7[
nr].max = LM93_IN_TO_REG(nr, val);
1266 show_in_max, store_in_max, 0);
1268 show_in_max, store_in_max, 1);
1270 show_in_max, store_in_max, 2);
1272 show_in_max, store_in_max, 3);
1274 show_in_max, store_in_max, 4);
1276 show_in_max, store_in_max, 5);
1278 show_in_max, store_in_max, 6);
1280 show_in_max, store_in_max, 7);
1282 show_in_max, store_in_max, 8);
1284 show_in_max, store_in_max, 9);
1286 show_in_max, store_in_max, 10);
1288 show_in_max, store_in_max, 11);
1290 show_in_max, store_in_max, 12);
1292 show_in_max, store_in_max, 13);
1294 show_in_max, store_in_max, 14);
1296 show_in_max, store_in_max, 15);
1302 struct lm93_data *data = lm93_update_device(dev);
1303 return sprintf(buf,
"%d\n", LM93_TEMP_FROM_REG(data->
block2[nr]));
1314 struct lm93_data *data = lm93_update_device(dev);
1315 return sprintf(buf,
"%d\n", LM93_TEMP_FROM_REG(data->
temp_lim[nr].min));
1319 const char *buf,
size_t count)
1323 struct lm93_data *data = i2c_get_clientdata(client);
1327 err = kstrtol(buf, 10, &val);
1332 data->
temp_lim[
nr].min = LM93_TEMP_TO_REG(val);
1339 show_temp_min, store_temp_min, 0);
1341 show_temp_min, store_temp_min, 1);
1343 show_temp_min, store_temp_min, 2);
1349 struct lm93_data *data = lm93_update_device(dev);
1350 return sprintf(buf,
"%d\n", LM93_TEMP_FROM_REG(data->
temp_lim[nr].max));
1354 const char *buf,
size_t count)
1358 struct lm93_data *data = i2c_get_clientdata(client);
1362 err = kstrtol(buf, 10, &val);
1367 data->
temp_lim[
nr].max = LM93_TEMP_TO_REG(val);
1374 show_temp_max, store_temp_max, 0);
1376 show_temp_max, store_temp_max, 1);
1378 show_temp_max, store_temp_max, 2);
1384 struct lm93_data *data = lm93_update_device(dev);
1385 return sprintf(buf,
"%d\n", LM93_TEMP_FROM_REG(data->
block10.base[nr]));
1390 const char *buf,
size_t count)
1394 struct lm93_data *data = i2c_get_clientdata(client);
1398 err = kstrtol(buf, 10, &val);
1403 data->
block10.base[
nr] = LM93_TEMP_TO_REG(val);
1410 show_temp_auto_base, store_temp_auto_base, 0);
1412 show_temp_auto_base, store_temp_auto_base, 1);
1414 show_temp_auto_base, store_temp_auto_base, 2);
1420 struct lm93_data *data = lm93_update_device(dev);
1421 return sprintf(buf,
"%d\n", LM93_TEMP_FROM_REG(data->
boost[nr]));
1426 const char *buf,
size_t count)
1430 struct lm93_data *data = i2c_get_clientdata(client);
1434 err = kstrtol(buf, 10, &val);
1439 data->
boost[
nr] = LM93_TEMP_TO_REG(val);
1446 show_temp_auto_boost, store_temp_auto_boost, 0);
1448 show_temp_auto_boost, store_temp_auto_boost, 1);
1450 show_temp_auto_boost, store_temp_auto_boost, 2);
1452 static ssize_t show_temp_auto_boost_hyst(
struct device *dev,
1457 struct lm93_data *data = lm93_update_device(dev);
1458 int mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->
sfc2, nr);
1460 LM93_AUTO_BOOST_HYST_FROM_REGS(data, nr, mode));
1463 static ssize_t store_temp_auto_boost_hyst(
struct device *dev,
1465 const char *buf,
size_t count)
1469 struct lm93_data *data = i2c_get_clientdata(client);
1473 err = kstrtoul(buf, 10, &val);
1480 data->
sfc2 |= ((nr < 2) ? 0x10 : 0x20);
1482 data->
boost_hyst[nr/2] = LM93_AUTO_BOOST_HYST_TO_REG(data, val, nr, 1);
1490 show_temp_auto_boost_hyst,
1491 store_temp_auto_boost_hyst, 0);
1493 show_temp_auto_boost_hyst,
1494 store_temp_auto_boost_hyst, 1);
1496 show_temp_auto_boost_hyst,
1497 store_temp_auto_boost_hyst, 2);
1503 int nr = s_attr->
index;
1504 int ofs = s_attr->
nr;
1505 struct lm93_data *data = lm93_update_device(dev);
1506 int mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->
sfc2, nr);
1508 LM93_TEMP_AUTO_OFFSET_FROM_REG(data->
block10.offset[ofs],
1514 const char *buf,
size_t count)
1517 int nr = s_attr->
index;
1518 int ofs = s_attr->
nr;
1520 struct lm93_data *data = i2c_get_clientdata(client);
1524 err = kstrtoul(buf, 10, &val);
1531 data->
sfc2 |= ((nr < 2) ? 0x10 : 0x20);
1533 data->
block10.offset[ofs] = LM93_TEMP_AUTO_OFFSET_TO_REG(
1534 data->
block10.offset[ofs], val, nr, 1);
1542 show_temp_auto_offset, store_temp_auto_offset, 0, 0);
1544 show_temp_auto_offset, store_temp_auto_offset, 1, 0);
1546 show_temp_auto_offset, store_temp_auto_offset, 2, 0);
1548 show_temp_auto_offset, store_temp_auto_offset, 3, 0);
1550 show_temp_auto_offset, store_temp_auto_offset, 4, 0);
1552 show_temp_auto_offset, store_temp_auto_offset, 5, 0);
1554 show_temp_auto_offset, store_temp_auto_offset, 6, 0);
1556 show_temp_auto_offset, store_temp_auto_offset, 7, 0);
1558 show_temp_auto_offset, store_temp_auto_offset, 8, 0);
1560 show_temp_auto_offset, store_temp_auto_offset, 9, 0);
1562 show_temp_auto_offset, store_temp_auto_offset, 10, 0);
1564 show_temp_auto_offset, store_temp_auto_offset, 11, 0);
1566 show_temp_auto_offset, store_temp_auto_offset, 0, 1);
1568 show_temp_auto_offset, store_temp_auto_offset, 1, 1);
1570 show_temp_auto_offset, store_temp_auto_offset, 2, 1);
1572 show_temp_auto_offset, store_temp_auto_offset, 3, 1);
1574 show_temp_auto_offset, store_temp_auto_offset, 4, 1);
1576 show_temp_auto_offset, store_temp_auto_offset, 5, 1);
1578 show_temp_auto_offset, store_temp_auto_offset, 6, 1);
1580 show_temp_auto_offset, store_temp_auto_offset, 7, 1);
1582 show_temp_auto_offset, store_temp_auto_offset, 8, 1);
1584 show_temp_auto_offset, store_temp_auto_offset, 9, 1);
1586 show_temp_auto_offset, store_temp_auto_offset, 10, 1);
1588 show_temp_auto_offset, store_temp_auto_offset, 11, 1);
1590 show_temp_auto_offset, store_temp_auto_offset, 0, 2);
1592 show_temp_auto_offset, store_temp_auto_offset, 1, 2);
1594 show_temp_auto_offset, store_temp_auto_offset, 2, 2);
1596 show_temp_auto_offset, store_temp_auto_offset, 3, 2);
1598 show_temp_auto_offset, store_temp_auto_offset, 4, 2);
1600 show_temp_auto_offset, store_temp_auto_offset, 5, 2);
1602 show_temp_auto_offset, store_temp_auto_offset, 6, 2);
1604 show_temp_auto_offset, store_temp_auto_offset, 7, 2);
1606 show_temp_auto_offset, store_temp_auto_offset, 8, 2);
1608 show_temp_auto_offset, store_temp_auto_offset, 9, 2);
1610 show_temp_auto_offset, store_temp_auto_offset, 10, 2);
1612 show_temp_auto_offset, store_temp_auto_offset, 11, 2);
1619 struct lm93_data *data = lm93_update_device(dev);
1622 return sprintf(buf,
"%d\n", LM93_PWM_FROM_REG(reg, (ctl4 & 0x07) ?
1628 const char *buf,
size_t count)
1632 struct lm93_data *data = i2c_get_clientdata(client);
1637 err = kstrtoul(buf, 10, &val);
1644 reg = (reg & 0x0f) |
1645 LM93_PWM_TO_REG(val, (ctl4 & 0x07) ?
1655 show_temp_auto_pwm_min,
1656 store_temp_auto_pwm_min, 0);
1658 show_temp_auto_pwm_min,
1659 store_temp_auto_pwm_min, 1);
1661 show_temp_auto_pwm_min,
1662 store_temp_auto_pwm_min, 2);
1664 static ssize_t show_temp_auto_offset_hyst(
struct device *dev,
1668 struct lm93_data *data = lm93_update_device(dev);
1669 int mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->
sfc2, nr);
1670 return sprintf(buf,
"%d\n", LM93_TEMP_OFFSET_FROM_REG(
1674 static ssize_t store_temp_auto_offset_hyst(
struct device *dev,
1676 const char *buf,
size_t count)
1680 struct lm93_data *data = i2c_get_clientdata(client);
1685 err = kstrtoul(buf, 10, &val);
1692 data->
sfc2 |= ((nr < 2) ? 0x10 : 0x20);
1695 reg = (reg & 0xf0) | (LM93_TEMP_OFFSET_TO_REG(val, 1) & 0x0f);
1703 show_temp_auto_offset_hyst,
1704 store_temp_auto_offset_hyst, 0);
1706 show_temp_auto_offset_hyst,
1707 store_temp_auto_offset_hyst, 1);
1709 show_temp_auto_offset_hyst,
1710 store_temp_auto_offset_hyst, 2);
1716 int nr = s_attr->
index;
1717 struct lm93_data *data = lm93_update_device(dev);
1719 return sprintf(buf,
"%d\n", LM93_FAN_FROM_REG(data->
block5[nr]));
1731 struct lm93_data *data = lm93_update_device(dev);
1733 return sprintf(buf,
"%d\n", LM93_FAN_FROM_REG(data->
block8[nr]));
1737 const char *buf,
size_t count)
1741 struct lm93_data *data = i2c_get_clientdata(client);
1745 err = kstrtoul(buf, 10, &val);
1750 data->
block8[
nr] = LM93_FAN_TO_REG(val);
1757 show_fan_min, store_fan_min, 0);
1759 show_fan_min, store_fan_min, 1);
1761 show_fan_min, store_fan_min, 2);
1763 show_fan_min, store_fan_min, 3);
1783 struct lm93_data *data = lm93_update_device(dev);
1791 if (mapping && ((data->
sfc2 >> nr) & 0x01))
1793 return sprintf(buf,
"%ld\n", rc);
1800 static void lm93_write_fan_smart_tach(
struct i2c_client *client,
1820 const char *buf,
size_t count)
1824 struct lm93_data *data = i2c_get_clientdata(client);
1828 err = kstrtoul(buf, 10, &val);
1837 u8 ctl4 = lm93_read_byte(client,
1839 if ((ctl4 & 0x07) == 0)
1842 lm93_write_fan_smart_tach(client, data, nr, val);
1849 show_fan_smart_tach, store_fan_smart_tach, 0);
1851 show_fan_smart_tach, store_fan_smart_tach, 1);
1853 show_fan_smart_tach, store_fan_smart_tach, 2);
1855 show_fan_smart_tach, store_fan_smart_tach, 3);
1861 struct lm93_data *data = lm93_update_device(dev);
1870 rc = LM93_PWM_FROM_REG(ctl2 >> 4, (ctl4 & 0x07) ?
1872 return sprintf(buf,
"%ld\n", rc);
1876 const char *buf,
size_t count)
1880 struct lm93_data *data = i2c_get_clientdata(client);
1885 err = kstrtoul(buf, 10, &val);
1892 ctl2 = (ctl2 & 0x0f) | LM93_PWM_TO_REG(val, (ctl4 & 0x07) ?
1910 struct lm93_data *data = lm93_update_device(dev);
1916 rc = ((ctl2 & 0xF0) == 0xF0) ? 0 : 1;
1919 return sprintf(buf,
"%ld\n", rc);
1924 const char *buf,
size_t count)
1928 struct lm93_data *data = i2c_get_clientdata(client);
1933 err = kstrtoul(buf, 10, &val);
1961 show_pwm_enable, store_pwm_enable, 0);
1963 show_pwm_enable, store_pwm_enable, 1);
1969 struct lm93_data *data = lm93_update_device(dev);
1973 return sprintf(buf,
"%d\n", LM93_PWM_FREQ_FROM_REG(ctl4));
1981 static void lm93_disable_fan_smart_tach(
struct i2c_client *client,
1988 mapping = (mapping >>
pwm) & 0x55;
1989 mask = mapping & 0x01;
1990 mask |= (mapping & 0x04) >> 1;
1991 mask |= (mapping & 0x10) >> 2;
1992 mask |= (mapping & 0x40) >> 3;
1996 data->
sfc2 &= ~mask;
2002 const char *buf,
size_t count)
2006 struct lm93_data *data = i2c_get_clientdata(client);
2011 err = kstrtoul(buf, 10, &val);
2017 ctl4 = (ctl4 & 0xf8) | LM93_PWM_FREQ_TO_REG(val);
2021 lm93_disable_fan_smart_tach(client, data, nr);
2028 show_pwm_freq, store_pwm_freq, 0);
2030 show_pwm_freq, store_pwm_freq, 1);
2036 struct lm93_data *data = lm93_update_device(dev);
2042 const char *buf,
size_t count)
2046 struct lm93_data *data = i2c_get_clientdata(client);
2050 err = kstrtoul(buf, 10, &val);
2063 show_pwm_auto_channels, store_pwm_auto_channels, 0);
2065 show_pwm_auto_channels, store_pwm_auto_channels, 1);
2071 struct lm93_data *data = lm93_update_device(dev);
2077 LM93_PWM_FROM_REG(ctl3 & 0x0f, (ctl4 & 0x07) ?
2081 static ssize_t store_pwm_auto_spinup_min(
struct device *dev,
2083 const char *buf,
size_t count)
2087 struct lm93_data *data = i2c_get_clientdata(client);
2092 err = kstrtoul(buf, 10, &val);
2099 ctl3 = (ctl3 & 0xf0) | LM93_PWM_TO_REG(val, (ctl4 & 0x07) ?
2109 show_pwm_auto_spinup_min,
2110 store_pwm_auto_spinup_min, 0);
2112 show_pwm_auto_spinup_min,
2113 store_pwm_auto_spinup_min, 1);
2115 static ssize_t show_pwm_auto_spinup_time(
struct device *dev,
2119 struct lm93_data *data = lm93_update_device(dev);
2120 return sprintf(buf,
"%d\n", LM93_SPINUP_TIME_FROM_REG(
2124 static ssize_t store_pwm_auto_spinup_time(
struct device *dev,
2126 const char *buf,
size_t count)
2130 struct lm93_data *data = i2c_get_clientdata(client);
2135 err = kstrtoul(buf, 10, &val);
2141 ctl3 = (ctl3 & 0x1f) | (LM93_SPINUP_TIME_TO_REG(val) << 5 & 0xe0);
2149 show_pwm_auto_spinup_time,
2150 store_pwm_auto_spinup_time, 0);
2152 show_pwm_auto_spinup_time,
2153 store_pwm_auto_spinup_time, 1);
2155 static ssize_t show_pwm_auto_prochot_ramp(
struct device *dev,
2158 struct lm93_data *data = lm93_update_device(dev);
2163 static ssize_t store_pwm_auto_prochot_ramp(
struct device *dev,
2165 const char *buf,
size_t count)
2168 struct lm93_data *data = i2c_get_clientdata(client);
2173 err = kstrtoul(buf, 10, &val);
2179 ramp = (ramp & 0x0f) | (LM93_RAMP_TO_REG(val) << 4 & 0xf0);
2186 show_pwm_auto_prochot_ramp,
2187 store_pwm_auto_prochot_ramp);
2189 static ssize_t show_pwm_auto_vrdhot_ramp(
struct device *dev,
2192 struct lm93_data *data = lm93_update_device(dev);
2197 static ssize_t store_pwm_auto_vrdhot_ramp(
struct device *dev,
2199 const char *buf,
size_t count)
2202 struct lm93_data *data = i2c_get_clientdata(client);
2207 err = kstrtoul(buf, 10, &val);
2213 ramp = (ramp & 0xf0) | (LM93_RAMP_TO_REG(val) & 0x0f);
2220 show_pwm_auto_vrdhot_ramp,
2221 store_pwm_auto_vrdhot_ramp);
2227 struct lm93_data *data = lm93_update_device(dev);
2228 return sprintf(buf,
"%d\n", LM93_VID_FROM_REG(data->
vid[nr]));
2238 struct lm93_data *data = lm93_update_device(dev);
2249 struct lm93_data *data = lm93_update_device(dev);
2260 struct lm93_data *data = lm93_update_device(dev);
2266 const char *buf,
size_t count)
2270 struct lm93_data *data = i2c_get_clientdata(client);
2274 err = kstrtoul(buf, 10, &val);
2287 show_prochot_max, store_prochot_max, 0);
2289 show_prochot_max, store_prochot_max, 1);
2291 static const u8 prochot_override_mask[] = { 0x80, 0x40 };
2297 struct lm93_data *data = lm93_update_device(dev);
2304 const char *buf,
size_t count)
2308 struct lm93_data *data = i2c_get_clientdata(client);
2312 err = kstrtoul(buf, 10, &val);
2328 show_prochot_override, store_prochot_override, 0);
2330 show_prochot_override, store_prochot_override, 1);
2336 struct lm93_data *data = lm93_update_device(dev);
2342 return sprintf(buf,
"%d\n", LM93_INTERVAL_FROM_REG(tmp));
2347 const char *buf,
size_t count)
2351 struct lm93_data *data = i2c_get_clientdata(client);
2356 err = kstrtoul(buf, 10, &val);
2363 tmp = (tmp & 0x0f) | (LM93_INTERVAL_TO_REG(val) << 4);
2365 tmp = (tmp & 0xf0) | LM93_INTERVAL_TO_REG(val);
2373 show_prochot_interval, store_prochot_interval, 0);
2375 show_prochot_interval, store_prochot_interval, 1);
2377 static ssize_t show_prochot_override_duty_cycle(
struct device *dev,
2381 struct lm93_data *data = lm93_update_device(dev);
2385 static ssize_t store_prochot_override_duty_cycle(
struct device *dev,
2387 const char *buf,
size_t count)
2390 struct lm93_data *data = i2c_get_clientdata(client);
2394 err = kstrtoul(buf, 10, &val);
2400 SENSORS_LIMIT(val, 0, 15);
2408 show_prochot_override_duty_cycle,
2409 store_prochot_override_duty_cycle);
2414 struct lm93_data *data = lm93_update_device(dev);
2420 const char *buf,
size_t count)
2423 struct lm93_data *data = i2c_get_clientdata(client);
2427 err = kstrtoul(buf, 10, &val);
2442 show_prochot_short, store_prochot_short);
2448 struct lm93_data *data = lm93_update_device(dev);
2450 data->
block1.host_status_1 & (1 << (nr + 4)) ? 1 : 0);
2459 struct lm93_data *data = lm93_update_device(dev);
2460 return sprintf(buf,
"%d\n", LM93_GPI_FROM_REG(data->
gpi));
2468 struct lm93_data *data = lm93_update_device(dev);
2469 return sprintf(buf,
"%d\n", LM93_ALARMS_FROM_REG(data->
block1));
2474 static struct attribute *lm93_attrs[] = {
2475 &sensor_dev_attr_in1_input.dev_attr.attr,
2476 &sensor_dev_attr_in2_input.dev_attr.attr,
2477 &sensor_dev_attr_in3_input.dev_attr.attr,
2478 &sensor_dev_attr_in4_input.dev_attr.attr,
2479 &sensor_dev_attr_in5_input.dev_attr.attr,
2480 &sensor_dev_attr_in6_input.dev_attr.attr,
2481 &sensor_dev_attr_in7_input.dev_attr.attr,
2482 &sensor_dev_attr_in8_input.dev_attr.attr,
2483 &sensor_dev_attr_in9_input.dev_attr.attr,
2484 &sensor_dev_attr_in10_input.dev_attr.attr,
2485 &sensor_dev_attr_in11_input.dev_attr.attr,
2486 &sensor_dev_attr_in12_input.dev_attr.attr,
2487 &sensor_dev_attr_in13_input.dev_attr.attr,
2488 &sensor_dev_attr_in14_input.dev_attr.attr,
2489 &sensor_dev_attr_in15_input.dev_attr.attr,
2490 &sensor_dev_attr_in16_input.dev_attr.attr,
2491 &sensor_dev_attr_in1_min.dev_attr.attr,
2492 &sensor_dev_attr_in2_min.dev_attr.attr,
2493 &sensor_dev_attr_in3_min.dev_attr.attr,
2494 &sensor_dev_attr_in4_min.dev_attr.attr,
2495 &sensor_dev_attr_in5_min.dev_attr.attr,
2496 &sensor_dev_attr_in6_min.dev_attr.attr,
2497 &sensor_dev_attr_in7_min.dev_attr.attr,
2498 &sensor_dev_attr_in8_min.dev_attr.attr,
2499 &sensor_dev_attr_in9_min.dev_attr.attr,
2500 &sensor_dev_attr_in10_min.dev_attr.attr,
2501 &sensor_dev_attr_in11_min.dev_attr.attr,
2502 &sensor_dev_attr_in12_min.dev_attr.attr,
2503 &sensor_dev_attr_in13_min.dev_attr.attr,
2504 &sensor_dev_attr_in14_min.dev_attr.attr,
2505 &sensor_dev_attr_in15_min.dev_attr.attr,
2506 &sensor_dev_attr_in16_min.dev_attr.attr,
2507 &sensor_dev_attr_in1_max.dev_attr.attr,
2508 &sensor_dev_attr_in2_max.dev_attr.attr,
2509 &sensor_dev_attr_in3_max.dev_attr.attr,
2510 &sensor_dev_attr_in4_max.dev_attr.attr,
2511 &sensor_dev_attr_in5_max.dev_attr.attr,
2512 &sensor_dev_attr_in6_max.dev_attr.attr,
2513 &sensor_dev_attr_in7_max.dev_attr.attr,
2514 &sensor_dev_attr_in8_max.dev_attr.attr,
2515 &sensor_dev_attr_in9_max.dev_attr.attr,
2516 &sensor_dev_attr_in10_max.dev_attr.attr,
2517 &sensor_dev_attr_in11_max.dev_attr.attr,
2518 &sensor_dev_attr_in12_max.dev_attr.attr,
2519 &sensor_dev_attr_in13_max.dev_attr.attr,
2520 &sensor_dev_attr_in14_max.dev_attr.attr,
2521 &sensor_dev_attr_in15_max.dev_attr.attr,
2522 &sensor_dev_attr_in16_max.dev_attr.attr,
2523 &sensor_dev_attr_temp1_input.dev_attr.attr,
2524 &sensor_dev_attr_temp2_input.dev_attr.attr,
2525 &sensor_dev_attr_temp3_input.dev_attr.attr,
2526 &sensor_dev_attr_temp1_min.dev_attr.attr,
2527 &sensor_dev_attr_temp2_min.dev_attr.attr,
2528 &sensor_dev_attr_temp3_min.dev_attr.attr,
2529 &sensor_dev_attr_temp1_max.dev_attr.attr,
2530 &sensor_dev_attr_temp2_max.dev_attr.attr,
2531 &sensor_dev_attr_temp3_max.dev_attr.attr,
2532 &sensor_dev_attr_temp1_auto_base.dev_attr.attr,
2533 &sensor_dev_attr_temp2_auto_base.dev_attr.attr,
2534 &sensor_dev_attr_temp3_auto_base.dev_attr.attr,
2535 &sensor_dev_attr_temp1_auto_boost.dev_attr.attr,
2536 &sensor_dev_attr_temp2_auto_boost.dev_attr.attr,
2537 &sensor_dev_attr_temp3_auto_boost.dev_attr.attr,
2538 &sensor_dev_attr_temp1_auto_boost_hyst.dev_attr.attr,
2539 &sensor_dev_attr_temp2_auto_boost_hyst.dev_attr.attr,
2540 &sensor_dev_attr_temp3_auto_boost_hyst.dev_attr.attr,
2541 &sensor_dev_attr_temp1_auto_offset1.dev_attr.attr,
2542 &sensor_dev_attr_temp1_auto_offset2.dev_attr.attr,
2543 &sensor_dev_attr_temp1_auto_offset3.dev_attr.attr,
2544 &sensor_dev_attr_temp1_auto_offset4.dev_attr.attr,
2545 &sensor_dev_attr_temp1_auto_offset5.dev_attr.attr,
2546 &sensor_dev_attr_temp1_auto_offset6.dev_attr.attr,
2547 &sensor_dev_attr_temp1_auto_offset7.dev_attr.attr,
2548 &sensor_dev_attr_temp1_auto_offset8.dev_attr.attr,
2549 &sensor_dev_attr_temp1_auto_offset9.dev_attr.attr,
2550 &sensor_dev_attr_temp1_auto_offset10.dev_attr.attr,
2551 &sensor_dev_attr_temp1_auto_offset11.dev_attr.attr,
2552 &sensor_dev_attr_temp1_auto_offset12.dev_attr.attr,
2553 &sensor_dev_attr_temp2_auto_offset1.dev_attr.attr,
2554 &sensor_dev_attr_temp2_auto_offset2.dev_attr.attr,
2555 &sensor_dev_attr_temp2_auto_offset3.dev_attr.attr,
2556 &sensor_dev_attr_temp2_auto_offset4.dev_attr.attr,
2557 &sensor_dev_attr_temp2_auto_offset5.dev_attr.attr,
2558 &sensor_dev_attr_temp2_auto_offset6.dev_attr.attr,
2559 &sensor_dev_attr_temp2_auto_offset7.dev_attr.attr,
2560 &sensor_dev_attr_temp2_auto_offset8.dev_attr.attr,
2561 &sensor_dev_attr_temp2_auto_offset9.dev_attr.attr,
2562 &sensor_dev_attr_temp2_auto_offset10.dev_attr.attr,
2563 &sensor_dev_attr_temp2_auto_offset11.dev_attr.attr,
2564 &sensor_dev_attr_temp2_auto_offset12.dev_attr.attr,
2565 &sensor_dev_attr_temp3_auto_offset1.dev_attr.attr,
2566 &sensor_dev_attr_temp3_auto_offset2.dev_attr.attr,
2567 &sensor_dev_attr_temp3_auto_offset3.dev_attr.attr,
2568 &sensor_dev_attr_temp3_auto_offset4.dev_attr.attr,
2569 &sensor_dev_attr_temp3_auto_offset5.dev_attr.attr,
2570 &sensor_dev_attr_temp3_auto_offset6.dev_attr.attr,
2571 &sensor_dev_attr_temp3_auto_offset7.dev_attr.attr,
2572 &sensor_dev_attr_temp3_auto_offset8.dev_attr.attr,
2573 &sensor_dev_attr_temp3_auto_offset9.dev_attr.attr,
2574 &sensor_dev_attr_temp3_auto_offset10.dev_attr.attr,
2575 &sensor_dev_attr_temp3_auto_offset11.dev_attr.attr,
2576 &sensor_dev_attr_temp3_auto_offset12.dev_attr.attr,
2577 &sensor_dev_attr_temp1_auto_pwm_min.dev_attr.attr,
2578 &sensor_dev_attr_temp2_auto_pwm_min.dev_attr.attr,
2579 &sensor_dev_attr_temp3_auto_pwm_min.dev_attr.attr,
2580 &sensor_dev_attr_temp1_auto_offset_hyst.dev_attr.attr,
2581 &sensor_dev_attr_temp2_auto_offset_hyst.dev_attr.attr,
2582 &sensor_dev_attr_temp3_auto_offset_hyst.dev_attr.attr,
2583 &sensor_dev_attr_fan1_input.dev_attr.attr,
2584 &sensor_dev_attr_fan2_input.dev_attr.attr,
2585 &sensor_dev_attr_fan3_input.dev_attr.attr,
2586 &sensor_dev_attr_fan4_input.dev_attr.attr,
2587 &sensor_dev_attr_fan1_min.dev_attr.attr,
2588 &sensor_dev_attr_fan2_min.dev_attr.attr,
2589 &sensor_dev_attr_fan3_min.dev_attr.attr,
2590 &sensor_dev_attr_fan4_min.dev_attr.attr,
2591 &sensor_dev_attr_fan1_smart_tach.dev_attr.attr,
2592 &sensor_dev_attr_fan2_smart_tach.dev_attr.attr,
2593 &sensor_dev_attr_fan3_smart_tach.dev_attr.attr,
2594 &sensor_dev_attr_fan4_smart_tach.dev_attr.attr,
2595 &sensor_dev_attr_pwm1.dev_attr.attr,
2596 &sensor_dev_attr_pwm2.dev_attr.attr,
2597 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
2598 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
2599 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
2600 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
2601 &sensor_dev_attr_pwm1_auto_channels.dev_attr.attr,
2602 &sensor_dev_attr_pwm2_auto_channels.dev_attr.attr,
2603 &sensor_dev_attr_pwm1_auto_spinup_min.dev_attr.attr,
2604 &sensor_dev_attr_pwm2_auto_spinup_min.dev_attr.attr,
2605 &sensor_dev_attr_pwm1_auto_spinup_time.dev_attr.attr,
2606 &sensor_dev_attr_pwm2_auto_spinup_time.dev_attr.attr,
2607 &dev_attr_pwm_auto_prochot_ramp.attr,
2608 &dev_attr_pwm_auto_vrdhot_ramp.attr,
2609 &sensor_dev_attr_cpu0_vid.dev_attr.attr,
2610 &sensor_dev_attr_cpu1_vid.dev_attr.attr,
2611 &sensor_dev_attr_prochot1.dev_attr.attr,
2612 &sensor_dev_attr_prochot2.dev_attr.attr,
2613 &sensor_dev_attr_prochot1_avg.dev_attr.attr,
2614 &sensor_dev_attr_prochot2_avg.dev_attr.attr,
2615 &sensor_dev_attr_prochot1_max.dev_attr.attr,
2616 &sensor_dev_attr_prochot2_max.dev_attr.attr,
2617 &sensor_dev_attr_prochot1_override.dev_attr.attr,
2618 &sensor_dev_attr_prochot2_override.dev_attr.attr,
2619 &sensor_dev_attr_prochot1_interval.dev_attr.attr,
2620 &sensor_dev_attr_prochot2_interval.dev_attr.attr,
2621 &dev_attr_prochot_override_duty_cycle.attr,
2622 &dev_attr_prochot_short.attr,
2623 &sensor_dev_attr_vrdhot1.dev_attr.attr,
2624 &sensor_dev_attr_vrdhot2.dev_attr.attr,
2625 &dev_attr_gpio.attr,
2626 &dev_attr_alarms.attr,
2631 .attrs = lm93_attrs,
2634 static void lm93_init_client(
struct i2c_client *client)
2642 reg | (vid_agtl ? 0x03 : 0x00));
2659 reg &= ~(vccp_limit_type[0] ? 0x10 : 0);
2660 reg &= ~(vccp_limit_type[1] ? 0x20 : 0);
2669 for (i = 0; i < 20; i++) {
2675 dev_warn(&client->
dev,
"timed out waiting for sensor "
2676 "chip to signal ready!\n");
2693 "detect failed, bad manufacturer id 0x%02x!\n", mfr);
2710 "detect failed, bad version id 0x%02x!\n", ver);
2715 dev_dbg(&adapter->
dev,
"loading %s at %d, 0x%02x\n",
2722 static int lm93_probe(
struct i2c_client *client,
2730 func = i2c_get_functionality(client->
adapter);
2733 dev_dbg(&client->
dev,
"using SMBus block data transactions\n");
2734 update = lm93_update_client_full;
2736 dev_dbg(&client->
dev,
"disabled SMBus block data "
2738 update = lm93_update_client_min;
2741 "smbus byte and/or word data not supported!\n");
2750 i2c_set_clientdata(client, data);
2758 lm93_init_client(client);
2770 dev_err(&client->
dev,
"error registering hwmon device.\n");
2775 static int lm93_remove(
struct i2c_client *client)
2777 struct lm93_data *data = i2c_get_clientdata(client);
2797 .probe = lm93_probe,
2798 .remove = lm93_remove,
2799 .id_table = lm93_id,
2800 .detect = lm93_detect,
2801 .address_list = normal_i2c,
2807 "Hans J. Koch <hjk@hansjkoch.de>");