diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ad7314.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/ads7871.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/applesmc.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/coretemp.c | 5 | ||||
-rw-r--r-- | drivers/hwmon/fam15h_power.c | 15 | ||||
-rw-r--r-- | drivers/hwmon/ina2xx.c | 30 | ||||
-rw-r--r-- | drivers/hwmon/twl4030-madc-hwmon.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/via-cputemp.c | 5 |
8 files changed, 56 insertions, 29 deletions
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index cfec802cf9ca..f915eb1c29f7 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | static ssize_t ad7314_show_name(struct device *dev, | ||
91 | struct device_attribute *devattr, char *buf) | ||
92 | { | ||
93 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); | ||
94 | } | ||
95 | |||
96 | static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL); | ||
90 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, | 97 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, |
91 | ad7314_show_temperature, NULL, 0); | 98 | ad7314_show_temperature, NULL, 0); |
92 | 99 | ||
93 | static struct attribute *ad7314_attributes[] = { | 100 | static struct attribute *ad7314_attributes[] = { |
101 | &dev_attr_name.attr, | ||
94 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 102 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
95 | NULL, | 103 | NULL, |
96 | }; | 104 | }; |
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index e65c6e45d36b..7bf4ce3d405e 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c | |||
@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | static ssize_t ads7871_show_name(struct device *dev, | ||
143 | struct device_attribute *devattr, char *buf) | ||
144 | { | ||
145 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); | ||
146 | } | ||
147 | |||
142 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); | 148 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); |
143 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); | 149 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); |
144 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); | 150 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); |
@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); | |||
148 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); | 154 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); |
149 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); | 155 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); |
150 | 156 | ||
157 | static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); | ||
158 | |||
151 | static struct attribute *ads7871_attributes[] = { | 159 | static struct attribute *ads7871_attributes[] = { |
152 | &sensor_dev_attr_in0_input.dev_attr.attr, | 160 | &sensor_dev_attr_in0_input.dev_attr.attr, |
153 | &sensor_dev_attr_in1_input.dev_attr.attr, | 161 | &sensor_dev_attr_in1_input.dev_attr.attr, |
@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { | |||
157 | &sensor_dev_attr_in5_input.dev_attr.attr, | 165 | &sensor_dev_attr_in5_input.dev_attr.attr, |
158 | &sensor_dev_attr_in6_input.dev_attr.attr, | 166 | &sensor_dev_attr_in6_input.dev_attr.attr, |
159 | &sensor_dev_attr_in7_input.dev_attr.attr, | 167 | &sensor_dev_attr_in7_input.dev_attr.attr, |
168 | &dev_attr_name.attr, | ||
160 | NULL | 169 | NULL |
161 | }; | 170 | }; |
162 | 171 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 282708860517..8f3f6f2c45fd 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -53,10 +53,10 @@ | |||
53 | 53 | ||
54 | #define APPLESMC_MAX_DATA_LENGTH 32 | 54 | #define APPLESMC_MAX_DATA_LENGTH 32 |
55 | 55 | ||
56 | /* wait up to 32 ms for a status change. */ | 56 | /* wait up to 128 ms for a status change. */ |
57 | #define APPLESMC_MIN_WAIT 0x0010 | 57 | #define APPLESMC_MIN_WAIT 0x0010 |
58 | #define APPLESMC_RETRY_WAIT 0x0100 | 58 | #define APPLESMC_RETRY_WAIT 0x0100 |
59 | #define APPLESMC_MAX_WAIT 0x8000 | 59 | #define APPLESMC_MAX_WAIT 0x20000 |
60 | 60 | ||
61 | #define APPLESMC_READ_CMD 0x10 | 61 | #define APPLESMC_READ_CMD 0x10 |
62 | #define APPLESMC_WRITE_CMD 0x11 | 62 | #define APPLESMC_WRITE_CMD 0x11 |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0fa356fe82cc..984a3f13923b 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -815,17 +815,20 @@ static int __init coretemp_init(void) | |||
815 | if (err) | 815 | if (err) |
816 | goto exit; | 816 | goto exit; |
817 | 817 | ||
818 | get_online_cpus(); | ||
818 | for_each_online_cpu(i) | 819 | for_each_online_cpu(i) |
819 | get_core_online(i); | 820 | get_core_online(i); |
820 | 821 | ||
821 | #ifndef CONFIG_HOTPLUG_CPU | 822 | #ifndef CONFIG_HOTPLUG_CPU |
822 | if (list_empty(&pdev_list)) { | 823 | if (list_empty(&pdev_list)) { |
824 | put_online_cpus(); | ||
823 | err = -ENODEV; | 825 | err = -ENODEV; |
824 | goto exit_driver_unreg; | 826 | goto exit_driver_unreg; |
825 | } | 827 | } |
826 | #endif | 828 | #endif |
827 | 829 | ||
828 | register_hotcpu_notifier(&coretemp_cpu_notifier); | 830 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
831 | put_online_cpus(); | ||
829 | return 0; | 832 | return 0; |
830 | 833 | ||
831 | #ifndef CONFIG_HOTPLUG_CPU | 834 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) | |||
840 | { | 843 | { |
841 | struct pdev_entry *p, *n; | 844 | struct pdev_entry *p, *n; |
842 | 845 | ||
846 | get_online_cpus(); | ||
843 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); | 847 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); |
844 | mutex_lock(&pdev_list_mutex); | 848 | mutex_lock(&pdev_list_mutex); |
845 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 849 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -848,6 +852,7 @@ static void __exit coretemp_exit(void) | |||
848 | kfree(p); | 852 | kfree(p); |
849 | } | 853 | } |
850 | mutex_unlock(&pdev_list_mutex); | 854 | mutex_unlock(&pdev_list_mutex); |
855 | put_online_cpus(); | ||
851 | platform_driver_unregister(&coretemp_driver); | 856 | platform_driver_unregister(&coretemp_driver); |
852 | } | 857 | } |
853 | 858 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 2764b78a784b..af69073b3fe8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
129 | * counter saturations resulting in bogus power readings. | 129 | * counter saturations resulting in bogus power readings. |
130 | * We correct this value ourselves to cope with older BIOSes. | 130 | * We correct this value ourselves to cope with older BIOSes. |
131 | */ | 131 | */ |
132 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | 132 | static const struct pci_device_id affected_device[] = { |
133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
134 | { 0 } | 134 | { 0 } |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | 137 | static void tweak_runavg_range(struct pci_dev *pdev) |
138 | { | 138 | { |
139 | u32 val; | 139 | u32 val; |
140 | 140 | ||
@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) | |||
158 | REG_TDP_RUNNING_AVERAGE, val); | 158 | REG_TDP_RUNNING_AVERAGE, val); |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifdef CONFIG_PM | ||
162 | static int fam15h_power_resume(struct pci_dev *pdev) | ||
163 | { | ||
164 | tweak_runavg_range(pdev); | ||
165 | return 0; | ||
166 | } | ||
167 | #else | ||
168 | #define fam15h_power_resume NULL | ||
169 | #endif | ||
170 | |||
161 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 171 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
162 | struct fam15h_power_data *data) | 172 | struct fam15h_power_data *data) |
163 | { | 173 | { |
@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { | |||
256 | .id_table = fam15h_power_id_table, | 266 | .id_table = fam15h_power_id_table, |
257 | .probe = fam15h_power_probe, | 267 | .probe = fam15h_power_probe, |
258 | .remove = __devexit_p(fam15h_power_remove), | 268 | .remove = __devexit_p(fam15h_power_remove), |
269 | .resume = fam15h_power_resume, | ||
259 | }; | 270 | }; |
260 | 271 | ||
261 | module_pci_driver(fam15h_power_driver); | 272 | module_pci_driver(fam15h_power_driver); |
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 7f3f4a385729..602148299f68 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c | |||
@@ -69,22 +69,6 @@ struct ina2xx_data { | |||
69 | u16 regs[INA2XX_MAX_REGISTERS]; | 69 | u16 regs[INA2XX_MAX_REGISTERS]; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | int ina2xx_read_word(struct i2c_client *client, int reg) | ||
73 | { | ||
74 | int val = i2c_smbus_read_word_data(client, reg); | ||
75 | if (unlikely(val < 0)) { | ||
76 | dev_dbg(&client->dev, | ||
77 | "Failed to read register: %d\n", reg); | ||
78 | return val; | ||
79 | } | ||
80 | return be16_to_cpu(val); | ||
81 | } | ||
82 | |||
83 | void ina2xx_write_word(struct i2c_client *client, int reg, int data) | ||
84 | { | ||
85 | i2c_smbus_write_word_data(client, reg, cpu_to_be16(data)); | ||
86 | } | ||
87 | |||
88 | static struct ina2xx_data *ina2xx_update_device(struct device *dev) | 72 | static struct ina2xx_data *ina2xx_update_device(struct device *dev) |
89 | { | 73 | { |
90 | struct i2c_client *client = to_i2c_client(dev); | 74 | struct i2c_client *client = to_i2c_client(dev); |
@@ -102,7 +86,7 @@ static struct ina2xx_data *ina2xx_update_device(struct device *dev) | |||
102 | 86 | ||
103 | /* Read all registers */ | 87 | /* Read all registers */ |
104 | for (i = 0; i < data->registers; i++) { | 88 | for (i = 0; i < data->registers; i++) { |
105 | int rv = ina2xx_read_word(client, i); | 89 | int rv = i2c_smbus_read_word_swapped(client, i); |
106 | if (rv < 0) { | 90 | if (rv < 0) { |
107 | ret = ERR_PTR(rv); | 91 | ret = ERR_PTR(rv); |
108 | goto abort; | 92 | goto abort; |
@@ -279,22 +263,26 @@ static int ina2xx_probe(struct i2c_client *client, | |||
279 | switch (data->kind) { | 263 | switch (data->kind) { |
280 | case ina219: | 264 | case ina219: |
281 | /* device configuration */ | 265 | /* device configuration */ |
282 | ina2xx_write_word(client, INA2XX_CONFIG, INA219_CONFIG_DEFAULT); | 266 | i2c_smbus_write_word_swapped(client, INA2XX_CONFIG, |
267 | INA219_CONFIG_DEFAULT); | ||
283 | 268 | ||
284 | /* set current LSB to 1mA, shunt is in uOhms */ | 269 | /* set current LSB to 1mA, shunt is in uOhms */ |
285 | /* (equation 13 in datasheet) */ | 270 | /* (equation 13 in datasheet) */ |
286 | ina2xx_write_word(client, INA2XX_CALIBRATION, 40960000 / shunt); | 271 | i2c_smbus_write_word_swapped(client, INA2XX_CALIBRATION, |
272 | 40960000 / shunt); | ||
287 | dev_info(&client->dev, | 273 | dev_info(&client->dev, |
288 | "power monitor INA219 (Rshunt = %li uOhm)\n", shunt); | 274 | "power monitor INA219 (Rshunt = %li uOhm)\n", shunt); |
289 | data->registers = INA219_REGISTERS; | 275 | data->registers = INA219_REGISTERS; |
290 | break; | 276 | break; |
291 | case ina226: | 277 | case ina226: |
292 | /* device configuration */ | 278 | /* device configuration */ |
293 | ina2xx_write_word(client, INA2XX_CONFIG, INA226_CONFIG_DEFAULT); | 279 | i2c_smbus_write_word_swapped(client, INA2XX_CONFIG, |
280 | INA226_CONFIG_DEFAULT); | ||
294 | 281 | ||
295 | /* set current LSB to 1mA, shunt is in uOhms */ | 282 | /* set current LSB to 1mA, shunt is in uOhms */ |
296 | /* (equation 1 in datasheet)*/ | 283 | /* (equation 1 in datasheet)*/ |
297 | ina2xx_write_word(client, INA2XX_CALIBRATION, 5120000 / shunt); | 284 | i2c_smbus_write_word_swapped(client, INA2XX_CALIBRATION, |
285 | 5120000 / shunt); | ||
298 | dev_info(&client->dev, | 286 | dev_info(&client->dev, |
299 | "power monitor INA226 (Rshunt = %li uOhm)\n", shunt); | 287 | "power monitor INA226 (Rshunt = %li uOhm)\n", shunt); |
300 | data->registers = INA226_REGISTERS; | 288 | data->registers = INA226_REGISTERS; |
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c index 0018c7dd0097..1a174f0a3cde 100644 --- a/drivers/hwmon/twl4030-madc-hwmon.c +++ b/drivers/hwmon/twl4030-madc-hwmon.c | |||
@@ -44,12 +44,13 @@ static ssize_t madc_read(struct device *dev, | |||
44 | struct device_attribute *devattr, char *buf) | 44 | struct device_attribute *devattr, char *buf) |
45 | { | 45 | { |
46 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 46 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
47 | struct twl4030_madc_request req; | 47 | struct twl4030_madc_request req = { |
48 | .channels = 1 << attr->index, | ||
49 | .method = TWL4030_MADC_SW2, | ||
50 | .type = TWL4030_MADC_WAIT, | ||
51 | }; | ||
48 | long val; | 52 | long val; |
49 | 53 | ||
50 | req.channels = (1 << attr->index); | ||
51 | req.method = TWL4030_MADC_SW2; | ||
52 | req.func_cb = NULL; | ||
53 | val = twl4030_madc_conversion(&req); | 54 | val = twl4030_madc_conversion(&req); |
54 | if (val < 0) | 55 | if (val < 0) |
55 | return val; | 56 | return val; |
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ee4ebc198a94..2e56c6ce9fb6 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c | |||
@@ -328,6 +328,7 @@ static int __init via_cputemp_init(void) | |||
328 | if (err) | 328 | if (err) |
329 | goto exit; | 329 | goto exit; |
330 | 330 | ||
331 | get_online_cpus(); | ||
331 | for_each_online_cpu(i) { | 332 | for_each_online_cpu(i) { |
332 | struct cpuinfo_x86 *c = &cpu_data(i); | 333 | struct cpuinfo_x86 *c = &cpu_data(i); |
333 | 334 | ||
@@ -347,12 +348,14 @@ static int __init via_cputemp_init(void) | |||
347 | 348 | ||
348 | #ifndef CONFIG_HOTPLUG_CPU | 349 | #ifndef CONFIG_HOTPLUG_CPU |
349 | if (list_empty(&pdev_list)) { | 350 | if (list_empty(&pdev_list)) { |
351 | put_online_cpus(); | ||
350 | err = -ENODEV; | 352 | err = -ENODEV; |
351 | goto exit_driver_unreg; | 353 | goto exit_driver_unreg; |
352 | } | 354 | } |
353 | #endif | 355 | #endif |
354 | 356 | ||
355 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); | 357 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); |
358 | put_online_cpus(); | ||
356 | return 0; | 359 | return 0; |
357 | 360 | ||
358 | #ifndef CONFIG_HOTPLUG_CPU | 361 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) | |||
367 | { | 370 | { |
368 | struct pdev_entry *p, *n; | 371 | struct pdev_entry *p, *n; |
369 | 372 | ||
373 | get_online_cpus(); | ||
370 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); | 374 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); |
371 | mutex_lock(&pdev_list_mutex); | 375 | mutex_lock(&pdev_list_mutex); |
372 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 376 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void) | |||
375 | kfree(p); | 379 | kfree(p); |
376 | } | 380 | } |
377 | mutex_unlock(&pdev_list_mutex); | 381 | mutex_unlock(&pdev_list_mutex); |
382 | put_online_cpus(); | ||
378 | platform_driver_unregister(&via_cputemp_driver); | 383 | platform_driver_unregister(&via_cputemp_driver); |
379 | } | 384 | } |
380 | 385 | ||