diff options
author | James Bottomley <JBottomley@Parallels.com> | 2011-07-23 13:09:03 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-07-23 13:09:03 -0400 |
commit | 87045b033a62777337ae4aa62834876da09b5fb5 (patch) | |
tree | 26aefd28e436668ff906e42b1e0d75c056e33e01 /drivers/hwmon | |
parent | 0d83ab65ff1b54ce8b6cd172285cf71a38c4cceb (diff) | |
parent | bfe159a51203c15d23cb3158fffdc25ec4b4dda1 (diff) |
Merge branch 'scsi-fixes'
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 2 | ||||
-rw-r--r-- | drivers/hwmon/adm1275.c | 26 | ||||
-rw-r--r-- | drivers/hwmon/asus_atk0110.c | 1 | ||||
-rw-r--r-- | drivers/hwmon/emc6w201.c | 58 | ||||
-rw-r--r-- | drivers/hwmon/f71882fg.c | 19 | ||||
-rw-r--r-- | drivers/hwmon/hwmon-vid.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/it87.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/lm95241.c | 22 | ||||
-rw-r--r-- | drivers/hwmon/max1111.c | 11 | ||||
-rw-r--r-- | drivers/hwmon/pmbus.c | 19 | ||||
-rw-r--r-- | drivers/hwmon/pmbus_core.c | 31 | ||||
-rw-r--r-- | drivers/hwmon/sch5627.c | 2 |
12 files changed, 135 insertions, 60 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 16db83c83c8b..5f888f7e7dcb 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -333,7 +333,7 @@ config SENSORS_F71882FG | |||
333 | F71858FG | 333 | F71858FG |
334 | F71862FG | 334 | F71862FG |
335 | F71863FG | 335 | F71863FG |
336 | F71869F/E | 336 | F71869F/E/A |
337 | F71882FG | 337 | F71882FG |
338 | F71883FG | 338 | F71883FG |
339 | F71889FG/ED/A | 339 | F71889FG/ED/A |
diff --git a/drivers/hwmon/adm1275.c b/drivers/hwmon/adm1275.c index c2ee2048ab91..8bc1bd663721 100644 --- a/drivers/hwmon/adm1275.c +++ b/drivers/hwmon/adm1275.c | |||
@@ -32,6 +32,7 @@ static int adm1275_probe(struct i2c_client *client, | |||
32 | const struct i2c_device_id *id) | 32 | const struct i2c_device_id *id) |
33 | { | 33 | { |
34 | int config; | 34 | int config; |
35 | int ret; | ||
35 | struct pmbus_driver_info *info; | 36 | struct pmbus_driver_info *info; |
36 | 37 | ||
37 | if (!i2c_check_functionality(client->adapter, | 38 | if (!i2c_check_functionality(client->adapter, |
@@ -43,30 +44,32 @@ static int adm1275_probe(struct i2c_client *client, | |||
43 | return -ENOMEM; | 44 | return -ENOMEM; |
44 | 45 | ||
45 | config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG); | 46 | config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG); |
46 | if (config < 0) | 47 | if (config < 0) { |
47 | return config; | 48 | ret = config; |
49 | goto err_mem; | ||
50 | } | ||
48 | 51 | ||
49 | info->pages = 1; | 52 | info->pages = 1; |
50 | info->direct[PSC_VOLTAGE_IN] = true; | 53 | info->direct[PSC_VOLTAGE_IN] = true; |
51 | info->direct[PSC_VOLTAGE_OUT] = true; | 54 | info->direct[PSC_VOLTAGE_OUT] = true; |
52 | info->direct[PSC_CURRENT_OUT] = true; | 55 | info->direct[PSC_CURRENT_OUT] = true; |
53 | info->m[PSC_CURRENT_OUT] = 800; | 56 | info->m[PSC_CURRENT_OUT] = 807; |
54 | info->b[PSC_CURRENT_OUT] = 20475; | 57 | info->b[PSC_CURRENT_OUT] = 20475; |
55 | info->R[PSC_CURRENT_OUT] = -1; | 58 | info->R[PSC_CURRENT_OUT] = -1; |
56 | info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; | 59 | info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; |
57 | 60 | ||
58 | if (config & ADM1275_VRANGE) { | 61 | if (config & ADM1275_VRANGE) { |
59 | info->m[PSC_VOLTAGE_IN] = 19045; | 62 | info->m[PSC_VOLTAGE_IN] = 19199; |
60 | info->b[PSC_VOLTAGE_IN] = 0; | 63 | info->b[PSC_VOLTAGE_IN] = 0; |
61 | info->R[PSC_VOLTAGE_IN] = -2; | 64 | info->R[PSC_VOLTAGE_IN] = -2; |
62 | info->m[PSC_VOLTAGE_OUT] = 19045; | 65 | info->m[PSC_VOLTAGE_OUT] = 19199; |
63 | info->b[PSC_VOLTAGE_OUT] = 0; | 66 | info->b[PSC_VOLTAGE_OUT] = 0; |
64 | info->R[PSC_VOLTAGE_OUT] = -2; | 67 | info->R[PSC_VOLTAGE_OUT] = -2; |
65 | } else { | 68 | } else { |
66 | info->m[PSC_VOLTAGE_IN] = 6666; | 69 | info->m[PSC_VOLTAGE_IN] = 6720; |
67 | info->b[PSC_VOLTAGE_IN] = 0; | 70 | info->b[PSC_VOLTAGE_IN] = 0; |
68 | info->R[PSC_VOLTAGE_IN] = -1; | 71 | info->R[PSC_VOLTAGE_IN] = -1; |
69 | info->m[PSC_VOLTAGE_OUT] = 6666; | 72 | info->m[PSC_VOLTAGE_OUT] = 6720; |
70 | info->b[PSC_VOLTAGE_OUT] = 0; | 73 | info->b[PSC_VOLTAGE_OUT] = 0; |
71 | info->R[PSC_VOLTAGE_OUT] = -1; | 74 | info->R[PSC_VOLTAGE_OUT] = -1; |
72 | } | 75 | } |
@@ -76,7 +79,14 @@ static int adm1275_probe(struct i2c_client *client, | |||
76 | else | 79 | else |
77 | info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT; | 80 | info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT; |
78 | 81 | ||
79 | return pmbus_do_probe(client, id, info); | 82 | ret = pmbus_do_probe(client, id, info); |
83 | if (ret) | ||
84 | goto err_mem; | ||
85 | return 0; | ||
86 | |||
87 | err_mem: | ||
88 | kfree(info); | ||
89 | return ret; | ||
80 | } | 90 | } |
81 | 91 | ||
82 | static int adm1275_remove(struct i2c_client *client) | 92 | static int adm1275_remove(struct i2c_client *client) |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index dcb78a7a8047..00e98517f94c 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -674,6 +674,7 @@ static int atk_debugfs_gitm_get(void *p, u64 *val) | |||
674 | else | 674 | else |
675 | err = -EIO; | 675 | err = -EIO; |
676 | 676 | ||
677 | ACPI_FREE(ret); | ||
677 | return err; | 678 | return err; |
678 | } | 679 | } |
679 | 680 | ||
diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c index e0ef32378ac6..0064432f361f 100644 --- a/drivers/hwmon/emc6w201.c +++ b/drivers/hwmon/emc6w201.c | |||
@@ -78,8 +78,9 @@ static u16 emc6w201_read16(struct i2c_client *client, u8 reg) | |||
78 | 78 | ||
79 | lsb = i2c_smbus_read_byte_data(client, reg); | 79 | lsb = i2c_smbus_read_byte_data(client, reg); |
80 | msb = i2c_smbus_read_byte_data(client, reg + 1); | 80 | msb = i2c_smbus_read_byte_data(client, reg + 1); |
81 | if (lsb < 0 || msb < 0) { | 81 | if (unlikely(lsb < 0 || msb < 0)) { |
82 | dev_err(&client->dev, "16-bit read failed at 0x%02x\n", reg); | 82 | dev_err(&client->dev, "%d-bit %s failed at 0x%02x\n", |
83 | 16, "read", reg); | ||
83 | return 0xFFFF; /* Arbitrary value */ | 84 | return 0xFFFF; /* Arbitrary value */ |
84 | } | 85 | } |
85 | 86 | ||
@@ -95,10 +96,39 @@ static int emc6w201_write16(struct i2c_client *client, u8 reg, u16 val) | |||
95 | int err; | 96 | int err; |
96 | 97 | ||
97 | err = i2c_smbus_write_byte_data(client, reg, val & 0xff); | 98 | err = i2c_smbus_write_byte_data(client, reg, val & 0xff); |
98 | if (!err) | 99 | if (likely(!err)) |
99 | err = i2c_smbus_write_byte_data(client, reg + 1, val >> 8); | 100 | err = i2c_smbus_write_byte_data(client, reg + 1, val >> 8); |
100 | if (err < 0) | 101 | if (unlikely(err < 0)) |
101 | dev_err(&client->dev, "16-bit write failed at 0x%02x\n", reg); | 102 | dev_err(&client->dev, "%d-bit %s failed at 0x%02x\n", |
103 | 16, "write", reg); | ||
104 | |||
105 | return err; | ||
106 | } | ||
107 | |||
108 | /* Read 8-bit value from register */ | ||
109 | static u8 emc6w201_read8(struct i2c_client *client, u8 reg) | ||
110 | { | ||
111 | int val; | ||
112 | |||
113 | val = i2c_smbus_read_byte_data(client, reg); | ||
114 | if (unlikely(val < 0)) { | ||
115 | dev_err(&client->dev, "%d-bit %s failed at 0x%02x\n", | ||
116 | 8, "read", reg); | ||
117 | return 0x00; /* Arbitrary value */ | ||
118 | } | ||
119 | |||
120 | return val; | ||
121 | } | ||
122 | |||
123 | /* Write 8-bit value to register */ | ||
124 | static int emc6w201_write8(struct i2c_client *client, u8 reg, u8 val) | ||
125 | { | ||
126 | int err; | ||
127 | |||
128 | err = i2c_smbus_write_byte_data(client, reg, val); | ||
129 | if (unlikely(err < 0)) | ||
130 | dev_err(&client->dev, "%d-bit %s failed at 0x%02x\n", | ||
131 | 8, "write", reg); | ||
102 | 132 | ||
103 | return err; | 133 | return err; |
104 | } | 134 | } |
@@ -114,25 +144,25 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev) | |||
114 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | 144 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { |
115 | for (nr = 0; nr < 6; nr++) { | 145 | for (nr = 0; nr < 6; nr++) { |
116 | data->in[input][nr] = | 146 | data->in[input][nr] = |
117 | i2c_smbus_read_byte_data(client, | 147 | emc6w201_read8(client, |
118 | EMC6W201_REG_IN(nr)); | 148 | EMC6W201_REG_IN(nr)); |
119 | data->in[min][nr] = | 149 | data->in[min][nr] = |
120 | i2c_smbus_read_byte_data(client, | 150 | emc6w201_read8(client, |
121 | EMC6W201_REG_IN_LOW(nr)); | 151 | EMC6W201_REG_IN_LOW(nr)); |
122 | data->in[max][nr] = | 152 | data->in[max][nr] = |
123 | i2c_smbus_read_byte_data(client, | 153 | emc6w201_read8(client, |
124 | EMC6W201_REG_IN_HIGH(nr)); | 154 | EMC6W201_REG_IN_HIGH(nr)); |
125 | } | 155 | } |
126 | 156 | ||
127 | for (nr = 0; nr < 6; nr++) { | 157 | for (nr = 0; nr < 6; nr++) { |
128 | data->temp[input][nr] = | 158 | data->temp[input][nr] = |
129 | i2c_smbus_read_byte_data(client, | 159 | emc6w201_read8(client, |
130 | EMC6W201_REG_TEMP(nr)); | 160 | EMC6W201_REG_TEMP(nr)); |
131 | data->temp[min][nr] = | 161 | data->temp[min][nr] = |
132 | i2c_smbus_read_byte_data(client, | 162 | emc6w201_read8(client, |
133 | EMC6W201_REG_TEMP_LOW(nr)); | 163 | EMC6W201_REG_TEMP_LOW(nr)); |
134 | data->temp[max][nr] = | 164 | data->temp[max][nr] = |
135 | i2c_smbus_read_byte_data(client, | 165 | emc6w201_read8(client, |
136 | EMC6W201_REG_TEMP_HIGH(nr)); | 166 | EMC6W201_REG_TEMP_HIGH(nr)); |
137 | } | 167 | } |
138 | 168 | ||
@@ -192,7 +222,7 @@ static ssize_t set_in(struct device *dev, struct device_attribute *devattr, | |||
192 | 222 | ||
193 | mutex_lock(&data->update_lock); | 223 | mutex_lock(&data->update_lock); |
194 | data->in[sf][nr] = SENSORS_LIMIT(val, 0, 255); | 224 | data->in[sf][nr] = SENSORS_LIMIT(val, 0, 255); |
195 | err = i2c_smbus_write_byte_data(client, reg, data->in[sf][nr]); | 225 | err = emc6w201_write8(client, reg, data->in[sf][nr]); |
196 | mutex_unlock(&data->update_lock); | 226 | mutex_unlock(&data->update_lock); |
197 | 227 | ||
198 | return err < 0 ? err : count; | 228 | return err < 0 ? err : count; |
@@ -229,7 +259,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, | |||
229 | 259 | ||
230 | mutex_lock(&data->update_lock); | 260 | mutex_lock(&data->update_lock); |
231 | data->temp[sf][nr] = SENSORS_LIMIT(val, -127, 128); | 261 | data->temp[sf][nr] = SENSORS_LIMIT(val, -127, 128); |
232 | err = i2c_smbus_write_byte_data(client, reg, data->temp[sf][nr]); | 262 | err = emc6w201_write8(client, reg, data->temp[sf][nr]); |
233 | mutex_unlock(&data->update_lock); | 263 | mutex_unlock(&data->update_lock); |
234 | 264 | ||
235 | return err < 0 ? err : count; | 265 | return err < 0 ? err : count; |
@@ -444,7 +474,7 @@ static int emc6w201_detect(struct i2c_client *client, | |||
444 | 474 | ||
445 | /* Check configuration */ | 475 | /* Check configuration */ |
446 | config = i2c_smbus_read_byte_data(client, EMC6W201_REG_CONFIG); | 476 | config = i2c_smbus_read_byte_data(client, EMC6W201_REG_CONFIG); |
447 | if ((config & 0xF4) != 0x04) | 477 | if (config < 0 || (config & 0xF4) != 0x04) |
448 | return -ENODEV; | 478 | return -ENODEV; |
449 | if (!(config & 0x01)) { | 479 | if (!(config & 0x01)) { |
450 | dev_err(&client->dev, "Monitoring not enabled\n"); | 480 | dev_err(&client->dev, "Monitoring not enabled\n"); |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index a4a94a096c90..2d96ed2bf8ed 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ | 52 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ |
53 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ | 53 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ |
54 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ | 54 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ |
55 | #define SIO_F71869A_ID 0x1007 /* Chipset ID */ | ||
55 | #define SIO_F71882_ID 0x0541 /* Chipset ID */ | 56 | #define SIO_F71882_ID 0x0541 /* Chipset ID */ |
56 | #define SIO_F71889_ID 0x0723 /* Chipset ID */ | 57 | #define SIO_F71889_ID 0x0723 /* Chipset ID */ |
57 | #define SIO_F71889E_ID 0x0909 /* Chipset ID */ | 58 | #define SIO_F71889E_ID 0x0909 /* Chipset ID */ |
@@ -108,8 +109,8 @@ static unsigned short force_id; | |||
108 | module_param(force_id, ushort, 0); | 109 | module_param(force_id, ushort, 0); |
109 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 110 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
110 | 111 | ||
111 | enum chips { f71808e, f71808a, f71858fg, f71862fg, f71869, f71882fg, f71889fg, | 112 | enum chips { f71808e, f71808a, f71858fg, f71862fg, f71869, f71869a, f71882fg, |
112 | f71889ed, f71889a, f8000, f81865f }; | 113 | f71889fg, f71889ed, f71889a, f8000, f81865f }; |
113 | 114 | ||
114 | static const char *f71882fg_names[] = { | 115 | static const char *f71882fg_names[] = { |
115 | "f71808e", | 116 | "f71808e", |
@@ -117,6 +118,7 @@ static const char *f71882fg_names[] = { | |||
117 | "f71858fg", | 118 | "f71858fg", |
118 | "f71862fg", | 119 | "f71862fg", |
119 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ | 120 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ |
121 | "f71869a", | ||
120 | "f71882fg", | 122 | "f71882fg", |
121 | "f71889fg", /* f81801u too, same id */ | 123 | "f71889fg", /* f81801u too, same id */ |
122 | "f71889ed", | 124 | "f71889ed", |
@@ -131,6 +133,7 @@ static const char f71882fg_has_in[][F71882FG_MAX_INS] = { | |||
131 | [f71858fg] = { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, | 133 | [f71858fg] = { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, |
132 | [f71862fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 134 | [f71862fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
133 | [f71869] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 135 | [f71869] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
136 | [f71869a] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | ||
134 | [f71882fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 137 | [f71882fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
135 | [f71889fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 138 | [f71889fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
136 | [f71889ed] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 139 | [f71889ed] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
@@ -145,6 +148,7 @@ static const char f71882fg_has_in1_alarm[] = { | |||
145 | [f71858fg] = 0, | 148 | [f71858fg] = 0, |
146 | [f71862fg] = 0, | 149 | [f71862fg] = 0, |
147 | [f71869] = 0, | 150 | [f71869] = 0, |
151 | [f71869a] = 0, | ||
148 | [f71882fg] = 1, | 152 | [f71882fg] = 1, |
149 | [f71889fg] = 1, | 153 | [f71889fg] = 1, |
150 | [f71889ed] = 1, | 154 | [f71889ed] = 1, |
@@ -159,6 +163,7 @@ static const char f71882fg_fan_has_beep[] = { | |||
159 | [f71858fg] = 0, | 163 | [f71858fg] = 0, |
160 | [f71862fg] = 1, | 164 | [f71862fg] = 1, |
161 | [f71869] = 1, | 165 | [f71869] = 1, |
166 | [f71869a] = 1, | ||
162 | [f71882fg] = 1, | 167 | [f71882fg] = 1, |
163 | [f71889fg] = 1, | 168 | [f71889fg] = 1, |
164 | [f71889ed] = 1, | 169 | [f71889ed] = 1, |
@@ -173,6 +178,7 @@ static const char f71882fg_nr_fans[] = { | |||
173 | [f71858fg] = 3, | 178 | [f71858fg] = 3, |
174 | [f71862fg] = 3, | 179 | [f71862fg] = 3, |
175 | [f71869] = 3, | 180 | [f71869] = 3, |
181 | [f71869a] = 3, | ||
176 | [f71882fg] = 4, | 182 | [f71882fg] = 4, |
177 | [f71889fg] = 3, | 183 | [f71889fg] = 3, |
178 | [f71889ed] = 3, | 184 | [f71889ed] = 3, |
@@ -187,6 +193,7 @@ static const char f71882fg_temp_has_beep[] = { | |||
187 | [f71858fg] = 0, | 193 | [f71858fg] = 0, |
188 | [f71862fg] = 1, | 194 | [f71862fg] = 1, |
189 | [f71869] = 1, | 195 | [f71869] = 1, |
196 | [f71869a] = 1, | ||
190 | [f71882fg] = 1, | 197 | [f71882fg] = 1, |
191 | [f71889fg] = 1, | 198 | [f71889fg] = 1, |
192 | [f71889ed] = 1, | 199 | [f71889ed] = 1, |
@@ -201,6 +208,7 @@ static const char f71882fg_nr_temps[] = { | |||
201 | [f71858fg] = 3, | 208 | [f71858fg] = 3, |
202 | [f71862fg] = 3, | 209 | [f71862fg] = 3, |
203 | [f71869] = 3, | 210 | [f71869] = 3, |
211 | [f71869a] = 3, | ||
204 | [f71882fg] = 3, | 212 | [f71882fg] = 3, |
205 | [f71889fg] = 3, | 213 | [f71889fg] = 3, |
206 | [f71889ed] = 3, | 214 | [f71889ed] = 3, |
@@ -2243,6 +2251,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2243 | case f71808e: | 2251 | case f71808e: |
2244 | case f71808a: | 2252 | case f71808a: |
2245 | case f71869: | 2253 | case f71869: |
2254 | case f71869a: | ||
2246 | /* These always have signed auto point temps */ | 2255 | /* These always have signed auto point temps */ |
2247 | data->auto_point_temp_signed = 1; | 2256 | data->auto_point_temp_signed = 1; |
2248 | /* Fall through to select correct fan/pwm reg bank! */ | 2257 | /* Fall through to select correct fan/pwm reg bank! */ |
@@ -2305,6 +2314,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2305 | case f71808e: | 2314 | case f71808e: |
2306 | case f71808a: | 2315 | case f71808a: |
2307 | case f71869: | 2316 | case f71869: |
2317 | case f71869a: | ||
2308 | case f71889fg: | 2318 | case f71889fg: |
2309 | case f71889ed: | 2319 | case f71889ed: |
2310 | case f71889a: | 2320 | case f71889a: |
@@ -2528,6 +2538,9 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2528 | case SIO_F71869_ID: | 2538 | case SIO_F71869_ID: |
2529 | sio_data->type = f71869; | 2539 | sio_data->type = f71869; |
2530 | break; | 2540 | break; |
2541 | case SIO_F71869A_ID: | ||
2542 | sio_data->type = f71869a; | ||
2543 | break; | ||
2531 | case SIO_F71882_ID: | 2544 | case SIO_F71882_ID: |
2532 | sio_data->type = f71882fg; | 2545 | sio_data->type = f71882fg; |
2533 | break; | 2546 | break; |
@@ -2662,7 +2675,7 @@ static void __exit f71882fg_exit(void) | |||
2662 | } | 2675 | } |
2663 | 2676 | ||
2664 | MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver"); | 2677 | MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver"); |
2665 | MODULE_AUTHOR("Hans Edgington, Hans de Goede (hdegoede@redhat.com)"); | 2678 | MODULE_AUTHOR("Hans Edgington, Hans de Goede <hdegoede@redhat.com>"); |
2666 | MODULE_LICENSE("GPL"); | 2679 | MODULE_LICENSE("GPL"); |
2667 | 2680 | ||
2668 | module_init(f71882fg_init); | 2681 | module_init(f71882fg_init); |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 2582bfef6ccb..c8195a077da3 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -202,7 +202,7 @@ static struct vrm_model vrm_models[] = { | |||
202 | 202 | ||
203 | {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ | 203 | {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ |
204 | {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ | 204 | {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ |
205 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nemiah */ | 205 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */ |
206 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ | 206 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ |
207 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ | 207 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ |
208 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ | 208 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index bb6405b92007..5f5247750430 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -1538,7 +1538,7 @@ static struct attribute *it87_attributes_label[] = { | |||
1538 | }; | 1538 | }; |
1539 | 1539 | ||
1540 | static const struct attribute_group it87_group_label = { | 1540 | static const struct attribute_group it87_group_label = { |
1541 | .attrs = it87_attributes_vid, | 1541 | .attrs = it87_attributes_label, |
1542 | }; | 1542 | }; |
1543 | 1543 | ||
1544 | /* SuperIO detection - will change isa_address if a chip is found */ | 1544 | /* SuperIO detection - will change isa_address if a chip is found */ |
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 1a6dfb6df1e7..d3b464b74ced 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c | |||
@@ -98,11 +98,16 @@ struct lm95241_data { | |||
98 | }; | 98 | }; |
99 | 99 | ||
100 | /* Conversions */ | 100 | /* Conversions */ |
101 | static int TempFromReg(u8 val_h, u8 val_l) | 101 | static int temp_from_reg_signed(u8 val_h, u8 val_l) |
102 | { | 102 | { |
103 | if (val_h & 0x80) | 103 | s16 val_hl = (val_h << 8) | val_l; |
104 | return val_h - 0x100; | 104 | return val_hl * 1000 / 256; |
105 | return val_h * 1000 + val_l * 1000 / 256; | 105 | } |
106 | |||
107 | static int temp_from_reg_unsigned(u8 val_h, u8 val_l) | ||
108 | { | ||
109 | u16 val_hl = (val_h << 8) | val_l; | ||
110 | return val_hl * 1000 / 256; | ||
106 | } | 111 | } |
107 | 112 | ||
108 | static struct lm95241_data *lm95241_update_device(struct device *dev) | 113 | static struct lm95241_data *lm95241_update_device(struct device *dev) |
@@ -135,10 +140,13 @@ static ssize_t show_input(struct device *dev, struct device_attribute *attr, | |||
135 | char *buf) | 140 | char *buf) |
136 | { | 141 | { |
137 | struct lm95241_data *data = lm95241_update_device(dev); | 142 | struct lm95241_data *data = lm95241_update_device(dev); |
143 | int index = to_sensor_dev_attr(attr)->index; | ||
138 | 144 | ||
139 | return snprintf(buf, PAGE_SIZE - 1, "%d\n", | 145 | return snprintf(buf, PAGE_SIZE - 1, "%d\n", |
140 | TempFromReg(data->temp[to_sensor_dev_attr(attr)->index], | 146 | index == 0 || (data->config & (1 << (index / 2))) ? |
141 | data->temp[to_sensor_dev_attr(attr)->index + 1])); | 147 | temp_from_reg_signed(data->temp[index], data->temp[index + 1]) : |
148 | temp_from_reg_unsigned(data->temp[index], | ||
149 | data->temp[index + 1])); | ||
142 | } | 150 | } |
143 | 151 | ||
144 | static ssize_t show_type(struct device *dev, struct device_attribute *attr, | 152 | static ssize_t show_type(struct device *dev, struct device_attribute *attr, |
@@ -339,7 +347,7 @@ static int lm95241_detect(struct i2c_client *new_client, | |||
339 | if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID) | 347 | if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID) |
340 | == MANUFACTURER_ID) | 348 | == MANUFACTURER_ID) |
341 | && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID) | 349 | && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID) |
342 | >= DEFAULT_REVISION)) { | 350 | == DEFAULT_REVISION)) { |
343 | name = DEVNAME; | 351 | name = DEVNAME; |
344 | } else { | 352 | } else { |
345 | dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n", | 353 | dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n", |
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c index 12a54aa29776..14335bbc9bdc 100644 --- a/drivers/hwmon/max1111.c +++ b/drivers/hwmon/max1111.c | |||
@@ -40,6 +40,8 @@ struct max1111_data { | |||
40 | struct spi_transfer xfer[2]; | 40 | struct spi_transfer xfer[2]; |
41 | uint8_t *tx_buf; | 41 | uint8_t *tx_buf; |
42 | uint8_t *rx_buf; | 42 | uint8_t *rx_buf; |
43 | struct mutex drvdata_lock; | ||
44 | /* protect msg, xfer and buffers from multiple access */ | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | static int max1111_read(struct device *dev, int channel) | 47 | static int max1111_read(struct device *dev, int channel) |
@@ -48,6 +50,9 @@ static int max1111_read(struct device *dev, int channel) | |||
48 | uint8_t v1, v2; | 50 | uint8_t v1, v2; |
49 | int err; | 51 | int err; |
50 | 52 | ||
53 | /* writing to drvdata struct is not thread safe, wait on mutex */ | ||
54 | mutex_lock(&data->drvdata_lock); | ||
55 | |||
51 | data->tx_buf[0] = (channel << MAX1111_CTRL_SEL_SH) | | 56 | data->tx_buf[0] = (channel << MAX1111_CTRL_SEL_SH) | |
52 | MAX1111_CTRL_PD0 | MAX1111_CTRL_PD1 | | 57 | MAX1111_CTRL_PD0 | MAX1111_CTRL_PD1 | |
53 | MAX1111_CTRL_SGL | MAX1111_CTRL_UNI | MAX1111_CTRL_STR; | 58 | MAX1111_CTRL_SGL | MAX1111_CTRL_UNI | MAX1111_CTRL_STR; |
@@ -55,12 +60,15 @@ static int max1111_read(struct device *dev, int channel) | |||
55 | err = spi_sync(data->spi, &data->msg); | 60 | err = spi_sync(data->spi, &data->msg); |
56 | if (err < 0) { | 61 | if (err < 0) { |
57 | dev_err(dev, "spi_sync failed with %d\n", err); | 62 | dev_err(dev, "spi_sync failed with %d\n", err); |
63 | mutex_unlock(&data->drvdata_lock); | ||
58 | return err; | 64 | return err; |
59 | } | 65 | } |
60 | 66 | ||
61 | v1 = data->rx_buf[0]; | 67 | v1 = data->rx_buf[0]; |
62 | v2 = data->rx_buf[1]; | 68 | v2 = data->rx_buf[1]; |
63 | 69 | ||
70 | mutex_unlock(&data->drvdata_lock); | ||
71 | |||
64 | if ((v1 & 0xc0) || (v2 & 0x3f)) | 72 | if ((v1 & 0xc0) || (v2 & 0x3f)) |
65 | return -EINVAL; | 73 | return -EINVAL; |
66 | 74 | ||
@@ -176,6 +184,8 @@ static int __devinit max1111_probe(struct spi_device *spi) | |||
176 | if (err) | 184 | if (err) |
177 | goto err_free_data; | 185 | goto err_free_data; |
178 | 186 | ||
187 | mutex_init(&data->drvdata_lock); | ||
188 | |||
179 | data->spi = spi; | 189 | data->spi = spi; |
180 | spi_set_drvdata(spi, data); | 190 | spi_set_drvdata(spi, data); |
181 | 191 | ||
@@ -213,6 +223,7 @@ static int __devexit max1111_remove(struct spi_device *spi) | |||
213 | 223 | ||
214 | hwmon_device_unregister(data->hwmon_dev); | 224 | hwmon_device_unregister(data->hwmon_dev); |
215 | sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); | 225 | sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); |
226 | mutex_destroy(&data->drvdata_lock); | ||
216 | kfree(data->rx_buf); | 227 | kfree(data->rx_buf); |
217 | kfree(data->tx_buf); | 228 | kfree(data->tx_buf); |
218 | kfree(data); | 229 | kfree(data); |
diff --git a/drivers/hwmon/pmbus.c b/drivers/hwmon/pmbus.c index 98e2e28899e2..9b1f0c37ef77 100644 --- a/drivers/hwmon/pmbus.c +++ b/drivers/hwmon/pmbus.c | |||
@@ -47,22 +47,29 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, | |||
47 | if (info->func[0] | 47 | if (info->func[0] |
48 | && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) | 48 | && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) |
49 | info->func[0] |= PMBUS_HAVE_STATUS_INPUT; | 49 | info->func[0] |= PMBUS_HAVE_STATUS_INPUT; |
50 | if (pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { | 50 | if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && |
51 | pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { | ||
51 | info->func[0] |= PMBUS_HAVE_FAN12; | 52 | info->func[0] |= PMBUS_HAVE_FAN12; |
52 | if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) | 53 | if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) |
53 | info->func[0] |= PMBUS_HAVE_STATUS_FAN12; | 54 | info->func[0] |= PMBUS_HAVE_STATUS_FAN12; |
54 | } | 55 | } |
55 | if (pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) { | 56 | if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) && |
57 | pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) { | ||
56 | info->func[0] |= PMBUS_HAVE_FAN34; | 58 | info->func[0] |= PMBUS_HAVE_FAN34; |
57 | if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) | 59 | if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) |
58 | info->func[0] |= PMBUS_HAVE_STATUS_FAN34; | 60 | info->func[0] |= PMBUS_HAVE_STATUS_FAN34; |
59 | } | 61 | } |
60 | if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) { | 62 | if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) |
61 | info->func[0] |= PMBUS_HAVE_TEMP; | 63 | info->func[0] |= PMBUS_HAVE_TEMP; |
62 | if (pmbus_check_byte_register(client, 0, | 64 | if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) |
63 | PMBUS_STATUS_TEMPERATURE)) | 65 | info->func[0] |= PMBUS_HAVE_TEMP2; |
66 | if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) | ||
67 | info->func[0] |= PMBUS_HAVE_TEMP3; | ||
68 | if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | ||
69 | | PMBUS_HAVE_TEMP3) | ||
70 | && pmbus_check_byte_register(client, 0, | ||
71 | PMBUS_STATUS_TEMPERATURE)) | ||
64 | info->func[0] |= PMBUS_HAVE_STATUS_TEMP; | 72 | info->func[0] |= PMBUS_HAVE_STATUS_TEMP; |
65 | } | ||
66 | 73 | ||
67 | /* Sensors detected on all pages */ | 74 | /* Sensors detected on all pages */ |
68 | for (page = 0; page < info->pages; page++) { | 75 | for (page = 0; page < info->pages; page++) { |
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c index 354770ed3186..8e31a8e2c746 100644 --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c | |||
@@ -362,8 +362,8 @@ static struct pmbus_data *pmbus_update_device(struct device *dev) | |||
362 | * Convert linear sensor values to milli- or micro-units | 362 | * Convert linear sensor values to milli- or micro-units |
363 | * depending on sensor type. | 363 | * depending on sensor type. |
364 | */ | 364 | */ |
365 | static int pmbus_reg2data_linear(struct pmbus_data *data, | 365 | static long pmbus_reg2data_linear(struct pmbus_data *data, |
366 | struct pmbus_sensor *sensor) | 366 | struct pmbus_sensor *sensor) |
367 | { | 367 | { |
368 | s16 exponent; | 368 | s16 exponent; |
369 | s32 mantissa; | 369 | s32 mantissa; |
@@ -397,15 +397,15 @@ static int pmbus_reg2data_linear(struct pmbus_data *data, | |||
397 | else | 397 | else |
398 | val >>= -exponent; | 398 | val >>= -exponent; |
399 | 399 | ||
400 | return (int)val; | 400 | return val; |
401 | } | 401 | } |
402 | 402 | ||
403 | /* | 403 | /* |
404 | * Convert direct sensor values to milli- or micro-units | 404 | * Convert direct sensor values to milli- or micro-units |
405 | * depending on sensor type. | 405 | * depending on sensor type. |
406 | */ | 406 | */ |
407 | static int pmbus_reg2data_direct(struct pmbus_data *data, | 407 | static long pmbus_reg2data_direct(struct pmbus_data *data, |
408 | struct pmbus_sensor *sensor) | 408 | struct pmbus_sensor *sensor) |
409 | { | 409 | { |
410 | long val = (s16) sensor->data; | 410 | long val = (s16) sensor->data; |
411 | long m, b, R; | 411 | long m, b, R; |
@@ -440,12 +440,12 @@ static int pmbus_reg2data_direct(struct pmbus_data *data, | |||
440 | R++; | 440 | R++; |
441 | } | 441 | } |
442 | 442 | ||
443 | return (int)((val - b) / m); | 443 | return (val - b) / m; |
444 | } | 444 | } |
445 | 445 | ||
446 | static int pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) | 446 | static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) |
447 | { | 447 | { |
448 | int val; | 448 | long val; |
449 | 449 | ||
450 | if (data->info->direct[sensor->class]) | 450 | if (data->info->direct[sensor->class]) |
451 | val = pmbus_reg2data_direct(data, sensor); | 451 | val = pmbus_reg2data_direct(data, sensor); |
@@ -619,7 +619,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
619 | if (!s1 && !s2) | 619 | if (!s1 && !s2) |
620 | *val = !!regval; | 620 | *val = !!regval; |
621 | else { | 621 | else { |
622 | int v1, v2; | 622 | long v1, v2; |
623 | struct pmbus_sensor *sensor1, *sensor2; | 623 | struct pmbus_sensor *sensor1, *sensor2; |
624 | 624 | ||
625 | sensor1 = &data->sensors[s1]; | 625 | sensor1 = &data->sensors[s1]; |
@@ -661,7 +661,7 @@ static ssize_t pmbus_show_sensor(struct device *dev, | |||
661 | if (sensor->data < 0) | 661 | if (sensor->data < 0) |
662 | return sensor->data; | 662 | return sensor->data; |
663 | 663 | ||
664 | return snprintf(buf, PAGE_SIZE, "%d\n", pmbus_reg2data(data, sensor)); | 664 | return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor)); |
665 | } | 665 | } |
666 | 666 | ||
667 | static ssize_t pmbus_set_sensor(struct device *dev, | 667 | static ssize_t pmbus_set_sensor(struct device *dev, |
@@ -1430,14 +1430,9 @@ int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, | |||
1430 | i2c_set_clientdata(client, data); | 1430 | i2c_set_clientdata(client, data); |
1431 | mutex_init(&data->update_lock); | 1431 | mutex_init(&data->update_lock); |
1432 | 1432 | ||
1433 | /* | 1433 | /* Bail out if PMBus status register does not exist. */ |
1434 | * Bail out if status register or PMBus revision register | 1434 | if (i2c_smbus_read_byte_data(client, PMBUS_STATUS_BYTE) < 0) { |
1435 | * does not exist. | 1435 | dev_err(&client->dev, "PMBus status register not found\n"); |
1436 | */ | ||
1437 | if (i2c_smbus_read_byte_data(client, PMBUS_STATUS_BYTE) < 0 | ||
1438 | || i2c_smbus_read_byte_data(client, PMBUS_REVISION) < 0) { | ||
1439 | dev_err(&client->dev, | ||
1440 | "Status or revision register not found\n"); | ||
1441 | ret = -ENODEV; | 1436 | ret = -ENODEV; |
1442 | goto out_data; | 1437 | goto out_data; |
1443 | } | 1438 | } |
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 020c87273ea1..3494a4cce414 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c | |||
@@ -887,7 +887,7 @@ static void __exit sch5627_exit(void) | |||
887 | } | 887 | } |
888 | 888 | ||
889 | MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver"); | 889 | MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver"); |
890 | MODULE_AUTHOR("Hans de Goede (hdegoede@redhat.com)"); | 890 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
891 | MODULE_LICENSE("GPL"); | 891 | MODULE_LICENSE("GPL"); |
892 | 892 | ||
893 | module_init(sch5627_init); | 893 | module_init(sch5627_init); |