diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 7 | ||||
-rw-r--r-- | drivers/hwmon/acpi_power_meter.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/ad7314.c | 13 | ||||
-rw-r--r-- | drivers/hwmon/adm1031.c | 20 | ||||
-rw-r--r-- | drivers/hwmon/ads1015.c | 33 | ||||
-rw-r--r-- | drivers/hwmon/coretemp.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/f75375s.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/fam15h_power.c | 42 | ||||
-rw-r--r-- | drivers/hwmon/k10temp.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/max6639.c | 15 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 17 | ||||
-rw-r--r-- | drivers/hwmon/smsc47b397.c | 14 | ||||
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 19 | ||||
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 18 |
14 files changed, 136 insertions, 77 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 5b32d56dbb4d..8deedc1b9840 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -253,7 +253,8 @@ config SENSORS_K10TEMP | |||
253 | If you say yes here you get support for the temperature | 253 | If you say yes here you get support for the temperature |
254 | sensor(s) inside your CPU. Supported are later revisions of | 254 | sensor(s) inside your CPU. Supported are later revisions of |
255 | the AMD Family 10h and all revisions of the AMD Family 11h, | 255 | the AMD Family 10h and all revisions of the AMD Family 11h, |
256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. | 256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer/Trinity) |
257 | microarchitectures. | ||
257 | 258 | ||
258 | This driver can also be built as a module. If so, the module | 259 | This driver can also be built as a module. If so, the module |
259 | will be called k10temp. | 260 | will be called k10temp. |
@@ -425,7 +426,7 @@ config SENSORS_GL520SM | |||
425 | 426 | ||
426 | config SENSORS_GPIO_FAN | 427 | config SENSORS_GPIO_FAN |
427 | tristate "GPIO fan" | 428 | tristate "GPIO fan" |
428 | depends on GENERIC_GPIO | 429 | depends on GPIOLIB |
429 | help | 430 | help |
430 | If you say yes here you get support for fans connected to GPIO lines. | 431 | If you say yes here you get support for fans connected to GPIO lines. |
431 | 432 | ||
@@ -883,7 +884,7 @@ source drivers/hwmon/pmbus/Kconfig | |||
883 | 884 | ||
884 | config SENSORS_SHT15 | 885 | config SENSORS_SHT15 |
885 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." | 886 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." |
886 | depends on GENERIC_GPIO | 887 | depends on GPIOLIB |
887 | help | 888 | help |
888 | If you say yes here you get support for the Sensiron SHT10, SHT11, | 889 | If you say yes here you get support for the Sensiron SHT10, SHT11, |
889 | SHT15, SHT71, SHT75 humidity and temperature sensors. | 890 | SHT15, SHT71, SHT75 humidity and temperature sensors. |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 554f046bcf20..9140236a0182 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c | |||
@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev, | |||
391 | break; | 391 | break; |
392 | default: | 392 | default: |
393 | BUG(); | 393 | BUG(); |
394 | val = ""; | ||
394 | } | 395 | } |
395 | 396 | ||
396 | return sprintf(buf, "%s\n", val); | 397 | return sprintf(buf, "%s\n", val); |
@@ -632,6 +633,7 @@ static int register_ro_attrs(struct acpi_power_meter_resource *resource, | |||
632 | sensors->dev_attr.show = ro->show; | 633 | sensors->dev_attr.show = ro->show; |
633 | sensors->index = ro->index; | 634 | sensors->index = ro->index; |
634 | 635 | ||
636 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
635 | res = device_create_file(dev, &sensors->dev_attr); | 637 | res = device_create_file(dev, &sensors->dev_attr); |
636 | if (res) { | 638 | if (res) { |
637 | sensors->dev_attr.attr.name = NULL; | 639 | sensors->dev_attr.attr.name = NULL; |
@@ -661,6 +663,7 @@ static int register_rw_attrs(struct acpi_power_meter_resource *resource, | |||
661 | sensors->dev_attr.store = rw->set; | 663 | sensors->dev_attr.store = rw->set; |
662 | sensors->index = rw->index; | 664 | sensors->index = rw->index; |
663 | 665 | ||
666 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
664 | res = device_create_file(dev, &sensors->dev_attr); | 667 | res = device_create_file(dev, &sensors->dev_attr); |
665 | if (res) { | 668 | if (res) { |
666 | sensors->dev_attr.attr.name = NULL; | 669 | sensors->dev_attr.attr.name = NULL; |
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 0e0cfcc36f8d..f85ce70d9677 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
@@ -47,7 +47,7 @@ struct ad7314_data { | |||
47 | u16 rx ____cacheline_aligned; | 47 | u16 rx ____cacheline_aligned; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | 50 | static int ad7314_spi_read(struct ad7314_data *chip) |
51 | { | 51 | { |
52 | int ret; | 52 | int ret; |
53 | 53 | ||
@@ -57,9 +57,7 @@ static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | |||
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | *data = be16_to_cpu(chip->rx); | 60 | return be16_to_cpu(chip->rx); |
61 | |||
62 | return ret; | ||
63 | } | 61 | } |
64 | 62 | ||
65 | static ssize_t ad7314_show_temperature(struct device *dev, | 63 | static ssize_t ad7314_show_temperature(struct device *dev, |
@@ -70,12 +68,12 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
70 | s16 data; | 68 | s16 data; |
71 | int ret; | 69 | int ret; |
72 | 70 | ||
73 | ret = ad7314_spi_read(chip, &data); | 71 | ret = ad7314_spi_read(chip); |
74 | if (ret < 0) | 72 | if (ret < 0) |
75 | return ret; | 73 | return ret; |
76 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { | 74 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { |
77 | case ad7314: | 75 | case ad7314: |
78 | data = (data & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; | 76 | data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; |
79 | data = (data << 6) >> 6; | 77 | data = (data << 6) >> 6; |
80 | 78 | ||
81 | return sprintf(buf, "%d\n", 250 * data); | 79 | return sprintf(buf, "%d\n", 250 * data); |
@@ -86,7 +84,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
86 | * with a sign bit - which is a 14 bit 2's complement | 84 | * with a sign bit - which is a 14 bit 2's complement |
87 | * register. 1lsb - 31.25 milli degrees centigrade | 85 | * register. 1lsb - 31.25 milli degrees centigrade |
88 | */ | 86 | */ |
89 | data &= ADT7301_TEMP_MASK; | 87 | data = ret & ADT7301_TEMP_MASK; |
90 | data = (data << 2) >> 2; | 88 | data = (data << 2) >> 2; |
91 | 89 | ||
92 | return sprintf(buf, "%d\n", | 90 | return sprintf(buf, "%d\n", |
@@ -128,6 +126,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) | |||
128 | ret = PTR_ERR(chip->hwmon_dev); | 126 | ret = PTR_ERR(chip->hwmon_dev); |
129 | goto error_remove_group; | 127 | goto error_remove_group; |
130 | } | 128 | } |
129 | chip->spi_dev = spi_dev; | ||
131 | 130 | ||
132 | return 0; | 131 | return 0; |
133 | error_remove_group: | 132 | error_remove_group: |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index ff37363ea5bc..44e1fd7f3d81 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -233,18 +233,15 @@ static const auto_chan_table_t auto_channel_select_table_adm1030 = { | |||
233 | * nearest match if no exact match where found. | 233 | * nearest match if no exact match where found. |
234 | */ | 234 | */ |
235 | static int | 235 | static int |
236 | get_fan_auto_nearest(struct adm1031_data *data, | 236 | get_fan_auto_nearest(struct adm1031_data *data, int chan, u8 val, u8 reg) |
237 | int chan, u8 val, u8 reg, u8 *new_reg) | ||
238 | { | 237 | { |
239 | int i; | 238 | int i; |
240 | int first_match = -1, exact_match = -1; | 239 | int first_match = -1, exact_match = -1; |
241 | u8 other_reg_val = | 240 | u8 other_reg_val = |
242 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; | 241 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; |
243 | 242 | ||
244 | if (val == 0) { | 243 | if (val == 0) |
245 | *new_reg = 0; | ||
246 | return 0; | 244 | return 0; |
247 | } | ||
248 | 245 | ||
249 | for (i = 0; i < 8; i++) { | 246 | for (i = 0; i < 8; i++) { |
250 | if ((val == (*data->chan_select_table)[i][chan]) && | 247 | if ((val == (*data->chan_select_table)[i][chan]) && |
@@ -264,13 +261,11 @@ get_fan_auto_nearest(struct adm1031_data *data, | |||
264 | } | 261 | } |
265 | 262 | ||
266 | if (exact_match >= 0) | 263 | if (exact_match >= 0) |
267 | *new_reg = exact_match; | 264 | return exact_match; |
268 | else if (first_match >= 0) | 265 | else if (first_match >= 0) |
269 | *new_reg = first_match; | 266 | return first_match; |
270 | else | ||
271 | return -EINVAL; | ||
272 | 267 | ||
273 | return 0; | 268 | return -EINVAL; |
274 | } | 269 | } |
275 | 270 | ||
276 | static ssize_t show_fan_auto_channel(struct device *dev, | 271 | static ssize_t show_fan_auto_channel(struct device *dev, |
@@ -301,11 +296,12 @@ set_fan_auto_channel(struct device *dev, struct device_attribute *attr, | |||
301 | 296 | ||
302 | mutex_lock(&data->update_lock); | 297 | mutex_lock(&data->update_lock); |
303 | 298 | ||
304 | ret = get_fan_auto_nearest(data, nr, val, data->conf1, ®); | 299 | ret = get_fan_auto_nearest(data, nr, val, data->conf1); |
305 | if (ret) { | 300 | if (ret < 0) { |
306 | mutex_unlock(&data->update_lock); | 301 | mutex_unlock(&data->update_lock); |
307 | return ret; | 302 | return ret; |
308 | } | 303 | } |
304 | reg = ret; | ||
309 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); | 305 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); |
310 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ | 306 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ |
311 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { | 307 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { |
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 7765e4f74ec5..1958f03efd7a 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c | |||
@@ -59,14 +59,11 @@ struct ads1015_data { | |||
59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; | 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | 62 | static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) |
63 | int *value) | ||
64 | { | 63 | { |
65 | u16 config; | 64 | u16 config; |
66 | s16 conversion; | ||
67 | struct ads1015_data *data = i2c_get_clientdata(client); | 65 | struct ads1015_data *data = i2c_get_clientdata(client); |
68 | unsigned int pga = data->channel_data[channel].pga; | 66 | unsigned int pga = data->channel_data[channel].pga; |
69 | int fullscale; | ||
70 | unsigned int data_rate = data->channel_data[channel].data_rate; | 67 | unsigned int data_rate = data->channel_data[channel].data_rate; |
71 | unsigned int conversion_time_ms; | 68 | unsigned int conversion_time_ms; |
72 | int res; | 69 | int res; |
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
78 | if (res < 0) | 75 | if (res < 0) |
79 | goto err_unlock; | 76 | goto err_unlock; |
80 | config = res; | 77 | config = res; |
81 | fullscale = fullscale_table[pga]; | ||
82 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); | 78 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); |
83 | 79 | ||
84 | /* setup and start single conversion */ | 80 | /* setup and start single conversion */ |
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
105 | } | 101 | } |
106 | 102 | ||
107 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); | 103 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); |
108 | if (res < 0) | ||
109 | goto err_unlock; | ||
110 | conversion = res; | ||
111 | |||
112 | mutex_unlock(&data->update_lock); | ||
113 | |||
114 | *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0); | ||
115 | |||
116 | return 0; | ||
117 | 104 | ||
118 | err_unlock: | 105 | err_unlock: |
119 | mutex_unlock(&data->update_lock); | 106 | mutex_unlock(&data->update_lock); |
120 | return res; | 107 | return res; |
121 | } | 108 | } |
122 | 109 | ||
110 | static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, | ||
111 | s16 reg) | ||
112 | { | ||
113 | struct ads1015_data *data = i2c_get_clientdata(client); | ||
114 | unsigned int pga = data->channel_data[channel].pga; | ||
115 | int fullscale = fullscale_table[pga]; | ||
116 | |||
117 | return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0); | ||
118 | } | ||
119 | |||
123 | /* sysfs callback function */ | 120 | /* sysfs callback function */ |
124 | static ssize_t show_in(struct device *dev, struct device_attribute *da, | 121 | static ssize_t show_in(struct device *dev, struct device_attribute *da, |
125 | char *buf) | 122 | char *buf) |
126 | { | 123 | { |
127 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 124 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
128 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
129 | int in; | ||
130 | int res; | 126 | int res; |
127 | int index = attr->index; | ||
131 | 128 | ||
132 | res = ads1015_read_value(client, attr->index, &in); | 129 | res = ads1015_read_adc(client, index); |
130 | if (res < 0) | ||
131 | return res; | ||
133 | 132 | ||
134 | return (res < 0) ? res : sprintf(buf, "%d\n", in); | 133 | return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); |
135 | } | 134 | } |
136 | 135 | ||
137 | static const struct sensor_device_attribute ads1015_in[] = { | 136 | static const struct sensor_device_attribute ads1015_in[] = { |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0d3141fbbc20..b9d512331ed4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -52,7 +52,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | |||
52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); |
53 | 53 | ||
54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
55 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 55 | #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ |
56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
@@ -709,6 +709,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | |||
709 | 709 | ||
710 | indx = TO_ATTR_NO(cpu); | 710 | indx = TO_ATTR_NO(cpu); |
711 | 711 | ||
712 | /* The core id is too big, just return */ | ||
713 | if (indx > MAX_CORE_DATA - 1) | ||
714 | return; | ||
715 | |||
712 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | 716 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
713 | coretemp_remove_core(pdata, &pdev->dev, indx); | 717 | coretemp_remove_core(pdata, &pdev->dev, indx); |
714 | 718 | ||
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 729499e75210..ece4159bd453 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -276,6 +276,7 @@ static bool duty_mode_enabled(u8 pwm_enable) | |||
276 | return false; | 276 | return false; |
277 | default: | 277 | default: |
278 | BUG(); | 278 | BUG(); |
279 | return true; | ||
279 | } | 280 | } |
280 | } | 281 | } |
281 | 282 | ||
@@ -291,6 +292,7 @@ static bool auto_mode_enabled(u8 pwm_enable) | |||
291 | return true; | 292 | return true; |
292 | default: | 293 | default: |
293 | BUG(); | 294 | BUG(); |
295 | return false; | ||
294 | } | 296 | } |
295 | } | 297 | } |
296 | 298 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index b7494af1e4a9..e8e18cab1fb8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | ||
126 | * Newer BKDG versions have an updated recommendation on how to properly | ||
127 | * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
128 | * counter saturations resulting in bogus power readings. | ||
129 | * We correct this value ourselves to cope with older BIOSes. | ||
130 | */ | ||
131 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
132 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
133 | { 0 } | ||
134 | }; | ||
135 | |||
136 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
137 | { | ||
138 | u32 val; | ||
139 | |||
140 | /* | ||
141 | * let this quirk apply only to the current version of the | ||
142 | * northbridge, since future versions may change the behavior | ||
143 | */ | ||
144 | if (!pci_match_id(affected_device, pdev)) | ||
145 | return; | ||
146 | |||
147 | pci_bus_read_config_dword(pdev->bus, | ||
148 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
149 | REG_TDP_RUNNING_AVERAGE, &val); | ||
150 | if ((val & 0xf) != 0xe) | ||
151 | return; | ||
152 | |||
153 | val &= ~0xf; | ||
154 | val |= 0x9; | ||
155 | pci_bus_write_config_dword(pdev->bus, | ||
156 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
157 | REG_TDP_RUNNING_AVERAGE, val); | ||
158 | } | ||
159 | |||
125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 160 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
126 | struct fam15h_power_data *data) | 161 | struct fam15h_power_data *data) |
127 | { | 162 | { |
@@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | |||
155 | struct device *dev; | 190 | struct device *dev; |
156 | int err; | 191 | int err; |
157 | 192 | ||
193 | /* | ||
194 | * though we ignore every other northbridge, we still have to | ||
195 | * do the tweaking on _each_ node in MCM processors as the counters | ||
196 | * are working hand-in-hand | ||
197 | */ | ||
198 | tweak_runavg_range(pdev); | ||
199 | |||
158 | if (!fam15h_power_is_internal_node0(pdev)) { | 200 | if (!fam15h_power_is_internal_node0(pdev)) { |
159 | err = -ENODEV; | 201 | err = -ENODEV; |
160 | goto exit; | 202 | goto exit; |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index aba29d63f195..307bb325dde9 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -33,6 +33,9 @@ static bool force; | |||
33 | module_param(force, bool, 0444); | 33 | module_param(force, bool, 0444); |
34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); | 34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); |
35 | 35 | ||
36 | /* PCI-IDs for Northbridge devices not used anywhere else */ | ||
37 | #define PCI_DEVICE_ID_AMD_15H_M10H_NB_F3 0x1403 | ||
38 | |||
36 | /* CPUID function 0x80000001, ebx */ | 39 | /* CPUID function 0x80000001, ebx */ |
37 | #define CPUID_PKGTYPE_MASK 0xf0000000 | 40 | #define CPUID_PKGTYPE_MASK 0xf0000000 |
38 | #define CPUID_PKGTYPE_F 0x00000000 | 41 | #define CPUID_PKGTYPE_F 0x00000000 |
@@ -210,6 +213,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { | |||
210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 213 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | 214 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, |
212 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, | 215 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, |
216 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_NB_F3) }, | ||
213 | {} | 217 | {} |
214 | }; | 218 | }; |
215 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 219 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index 193067e27b6f..de8f7adaccbd 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c | |||
@@ -596,8 +596,10 @@ static int max6639_remove(struct i2c_client *client) | |||
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | 599 | #ifdef CONFIG_PM_SLEEP |
600 | static int max6639_suspend(struct device *dev) | ||
600 | { | 601 | { |
602 | struct i2c_client *client = to_i2c_client(dev); | ||
601 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 603 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
602 | if (data < 0) | 604 | if (data < 0) |
603 | return data; | 605 | return data; |
@@ -606,8 +608,9 @@ static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | |||
606 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); | 608 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); |
607 | } | 609 | } |
608 | 610 | ||
609 | static int max6639_resume(struct i2c_client *client) | 611 | static int max6639_resume(struct device *dev) |
610 | { | 612 | { |
613 | struct i2c_client *client = to_i2c_client(dev); | ||
611 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 614 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
612 | if (data < 0) | 615 | if (data < 0) |
613 | return data; | 616 | return data; |
@@ -615,6 +618,7 @@ static int max6639_resume(struct i2c_client *client) | |||
615 | return i2c_smbus_write_byte_data(client, | 618 | return i2c_smbus_write_byte_data(client, |
616 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); | 619 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); |
617 | } | 620 | } |
621 | #endif /* CONFIG_PM_SLEEP */ | ||
618 | 622 | ||
619 | static const struct i2c_device_id max6639_id[] = { | 623 | static const struct i2c_device_id max6639_id[] = { |
620 | {"max6639", 0}, | 624 | {"max6639", 0}, |
@@ -623,15 +627,18 @@ static const struct i2c_device_id max6639_id[] = { | |||
623 | 627 | ||
624 | MODULE_DEVICE_TABLE(i2c, max6639_id); | 628 | MODULE_DEVICE_TABLE(i2c, max6639_id); |
625 | 629 | ||
630 | static const struct dev_pm_ops max6639_pm_ops = { | ||
631 | SET_SYSTEM_SLEEP_PM_OPS(max6639_suspend, max6639_resume) | ||
632 | }; | ||
633 | |||
626 | static struct i2c_driver max6639_driver = { | 634 | static struct i2c_driver max6639_driver = { |
627 | .class = I2C_CLASS_HWMON, | 635 | .class = I2C_CLASS_HWMON, |
628 | .driver = { | 636 | .driver = { |
629 | .name = "max6639", | 637 | .name = "max6639", |
638 | .pm = &max6639_pm_ops, | ||
630 | }, | 639 | }, |
631 | .probe = max6639_probe, | 640 | .probe = max6639_probe, |
632 | .remove = max6639_remove, | 641 | .remove = max6639_remove, |
633 | .suspend = max6639_suspend, | ||
634 | .resume = max6639_resume, | ||
635 | .id_table = max6639_id, | 642 | .id_table = max6639_id, |
636 | .detect = max6639_detect, | 643 | .detect = max6639_detect, |
637 | .address_list = normal_i2c, | 644 | .address_list = normal_i2c, |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index be51037363c8..29b319db573e 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data, | |||
710 | * If a negative value is stored in any of the referenced registers, this value | 710 | * If a negative value is stored in any of the referenced registers, this value |
711 | * reflects an error code which will be returned. | 711 | * reflects an error code which will be returned. |
712 | */ | 712 | */ |
713 | static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | 713 | static int pmbus_get_boolean(struct pmbus_data *data, int index) |
714 | { | 714 | { |
715 | u8 s1 = (index >> 24) & 0xff; | 715 | u8 s1 = (index >> 24) & 0xff; |
716 | u8 s2 = (index >> 16) & 0xff; | 716 | u8 s2 = (index >> 16) & 0xff; |
717 | u8 reg = (index >> 8) & 0xff; | 717 | u8 reg = (index >> 8) & 0xff; |
718 | u8 mask = index & 0xff; | 718 | u8 mask = index & 0xff; |
719 | int status; | 719 | int ret, status; |
720 | u8 regval; | 720 | u8 regval; |
721 | 721 | ||
722 | status = data->status[reg]; | 722 | status = data->status[reg]; |
@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
725 | 725 | ||
726 | regval = status & mask; | 726 | regval = status & mask; |
727 | if (!s1 && !s2) | 727 | if (!s1 && !s2) |
728 | *val = !!regval; | 728 | ret = !!regval; |
729 | else { | 729 | else { |
730 | long v1, v2; | 730 | long v1, v2; |
731 | struct pmbus_sensor *sensor1, *sensor2; | 731 | struct pmbus_sensor *sensor1, *sensor2; |
@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
739 | 739 | ||
740 | v1 = pmbus_reg2data(data, sensor1); | 740 | v1 = pmbus_reg2data(data, sensor1); |
741 | v2 = pmbus_reg2data(data, sensor2); | 741 | v2 = pmbus_reg2data(data, sensor2); |
742 | *val = !!(regval && v1 >= v2); | 742 | ret = !!(regval && v1 >= v2); |
743 | } | 743 | } |
744 | return 0; | 744 | return ret; |
745 | } | 745 | } |
746 | 746 | ||
747 | static ssize_t pmbus_show_boolean(struct device *dev, | 747 | static ssize_t pmbus_show_boolean(struct device *dev, |
@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev, | |||
750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
751 | struct pmbus_data *data = pmbus_update_device(dev); | 751 | struct pmbus_data *data = pmbus_update_device(dev); |
752 | int val; | 752 | int val; |
753 | int err; | ||
754 | 753 | ||
755 | err = pmbus_get_boolean(data, attr->index, &val); | 754 | val = pmbus_get_boolean(data, attr->index); |
756 | if (err) | 755 | if (val < 0) |
757 | return err; | 756 | return val; |
758 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 757 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
759 | } | 758 | } |
760 | 759 | ||
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index d3b778da3f86..c5f6be478bad 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -343,10 +343,11 @@ exit: | |||
343 | return err; | 343 | return err; |
344 | } | 344 | } |
345 | 345 | ||
346 | static int __init smsc47b397_find(unsigned short *addr) | 346 | static int __init smsc47b397_find(void) |
347 | { | 347 | { |
348 | u8 id, rev; | 348 | u8 id, rev; |
349 | char *name; | 349 | char *name; |
350 | unsigned short addr; | ||
350 | 351 | ||
351 | superio_enter(); | 352 | superio_enter(); |
352 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 353 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr) | |||
370 | rev = superio_inb(SUPERIO_REG_DEVREV); | 371 | rev = superio_inb(SUPERIO_REG_DEVREV); |
371 | 372 | ||
372 | superio_select(SUPERIO_REG_LD8); | 373 | superio_select(SUPERIO_REG_LD8); |
373 | *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) | 374 | addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) |
374 | | superio_inb(SUPERIO_REG_BASE_LSB); | 375 | | superio_inb(SUPERIO_REG_BASE_LSB); |
375 | 376 | ||
376 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", | 377 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", |
377 | name, *addr, rev); | 378 | name, addr, rev); |
378 | 379 | ||
379 | superio_exit(); | 380 | superio_exit(); |
380 | return 0; | 381 | return addr; |
381 | } | 382 | } |
382 | 383 | ||
383 | static int __init smsc47b397_init(void) | 384 | static int __init smsc47b397_init(void) |
@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void) | |||
385 | unsigned short address; | 386 | unsigned short address; |
386 | int ret; | 387 | int ret; |
387 | 388 | ||
388 | ret = smsc47b397_find(&address); | 389 | ret = smsc47b397_find(); |
389 | if (ret) | 390 | if (ret < 0) |
390 | return ret; | 391 | return ret; |
392 | address = ret; | ||
391 | 393 | ||
392 | ret = platform_driver_register(&smsc47b397_driver); | 394 | ret = platform_driver_register(&smsc47b397_driver); |
393 | if (ret) | 395 | if (ret) |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index c590c1469793..b5aa38dd7ab9 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = { | |||
491 | .attrs = smsc47m1_attributes, | 491 | .attrs = smsc47m1_attributes, |
492 | }; | 492 | }; |
493 | 493 | ||
494 | static int __init smsc47m1_find(unsigned short *addr, | 494 | static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
495 | struct smsc47m1_sio_data *sio_data) | ||
496 | { | 495 | { |
497 | u8 val; | 496 | u8 val; |
497 | unsigned short addr; | ||
498 | 498 | ||
499 | superio_enter(); | 499 | superio_enter(); |
500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | superio_select(); | 548 | superio_select(); |
549 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) | 549 | addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
550 | | superio_inb(SUPERIO_REG_BASE + 1); | 550 | | superio_inb(SUPERIO_REG_BASE + 1); |
551 | if (*addr == 0) { | 551 | if (addr == 0) { |
552 | pr_info("Device address not set, will not use\n"); | 552 | pr_info("Device address not set, will not use\n"); |
553 | superio_exit(); | 553 | superio_exit(); |
554 | return -ENODEV; | 554 | return -ENODEV; |
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
565 | } | 565 | } |
566 | 566 | ||
567 | superio_exit(); | 567 | superio_exit(); |
568 | return 0; | 568 | return addr; |
569 | } | 569 | } |
570 | 570 | ||
571 | /* Restore device to its initial state */ | 571 | /* Restore device to its initial state */ |
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void) | |||
938 | unsigned short address; | 938 | unsigned short address; |
939 | struct smsc47m1_sio_data sio_data; | 939 | struct smsc47m1_sio_data sio_data; |
940 | 940 | ||
941 | if (smsc47m1_find(&address, &sio_data)) | 941 | err = smsc47m1_find(&sio_data); |
942 | return -ENODEV; | 942 | if (err < 0) |
943 | return err; | ||
944 | address = err; | ||
943 | 945 | ||
944 | /* Sets global pdev as a side effect */ | 946 | /* Sets global pdev as a side effect */ |
945 | err = smsc47m1_device_add(address, &sio_data); | 947 | err = smsc47m1_device_add(address, &sio_data); |
946 | if (err) | 948 | if (err) |
947 | goto exit; | 949 | return err; |
948 | 950 | ||
949 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); | 951 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); |
950 | if (err) | 952 | if (err) |
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void) | |||
955 | exit_device: | 957 | exit_device: |
956 | platform_device_unregister(pdev); | 958 | platform_device_unregister(pdev); |
957 | smsc47m1_restore(&sio_data); | 959 | smsc47m1_restore(&sio_data); |
958 | exit: | ||
959 | return err; | 960 | return err; |
960 | } | 961 | } |
961 | 962 | ||
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a25350cf9554..54922ed12978 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -2619,15 +2619,15 @@ static struct platform_driver w83627ehf_driver = { | |||
2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | 2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, |
2620 | struct w83627ehf_sio_data *sio_data) | 2620 | struct w83627ehf_sio_data *sio_data) |
2621 | { | 2621 | { |
2622 | static const char __initdata sio_name_W83627EHF[] = "W83627EHF"; | 2622 | static const char sio_name_W83627EHF[] __initconst = "W83627EHF"; |
2623 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; | 2623 | static const char sio_name_W83627EHG[] __initconst = "W83627EHG"; |
2624 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; | 2624 | static const char sio_name_W83627DHG[] __initconst = "W83627DHG"; |
2625 | static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; | 2625 | static const char sio_name_W83627DHG_P[] __initconst = "W83627DHG-P"; |
2626 | static const char __initdata sio_name_W83627UHG[] = "W83627UHG"; | 2626 | static const char sio_name_W83627UHG[] __initconst = "W83627UHG"; |
2627 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; | 2627 | static const char sio_name_W83667HG[] __initconst = "W83667HG"; |
2628 | static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B"; | 2628 | static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B"; |
2629 | static const char __initdata sio_name_NCT6775[] = "NCT6775F"; | 2629 | static const char sio_name_NCT6775[] __initconst = "NCT6775F"; |
2630 | static const char __initdata sio_name_NCT6776[] = "NCT6776F"; | 2630 | static const char sio_name_NCT6776[] __initconst = "NCT6776F"; |
2631 | 2631 | ||
2632 | u16 val; | 2632 | u16 val; |
2633 | const char *sio_name; | 2633 | const char *sio_name; |