aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/asus_atk0110.c1
-rw-r--r--drivers/hwmon/hih6130.c16
-rw-r--r--drivers/hwmon/lm78.c2
-rw-r--r--drivers/hwmon/lm90.c4
-rw-r--r--drivers/hwmon/sis5595.c2
-rw-r--r--drivers/hwmon/vt8231.c2
-rw-r--r--drivers/hwmon/w83l786ng.c13
7 files changed, 30 insertions, 10 deletions
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 1d7ff46812c3..dafc63c6932d 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -18,7 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19 19
20#include <acpi/acpi.h> 20#include <acpi/acpi.h>
21#include <acpi/acpixf.h>
22#include <acpi/acpi_drivers.h> 21#include <acpi/acpi_drivers.h>
23#include <acpi/acpi_bus.h> 22#include <acpi/acpi_bus.h>
24 23
diff --git a/drivers/hwmon/hih6130.c b/drivers/hwmon/hih6130.c
index 2dc37c7c6947..7d68a08baaa8 100644
--- a/drivers/hwmon/hih6130.c
+++ b/drivers/hwmon/hih6130.c
@@ -43,6 +43,7 @@
43 * @last_update: time of last update (jiffies) 43 * @last_update: time of last update (jiffies)
44 * @temperature: cached temperature measurement value 44 * @temperature: cached temperature measurement value
45 * @humidity: cached humidity measurement value 45 * @humidity: cached humidity measurement value
46 * @write_length: length for I2C measurement request
46 */ 47 */
47struct hih6130 { 48struct hih6130 {
48 struct device *hwmon_dev; 49 struct device *hwmon_dev;
@@ -51,6 +52,7 @@ struct hih6130 {
51 unsigned long last_update; 52 unsigned long last_update;
52 int temperature; 53 int temperature;
53 int humidity; 54 int humidity;
55 size_t write_length;
54}; 56};
55 57
56/** 58/**
@@ -121,8 +123,15 @@ static int hih6130_update_measurements(struct i2c_client *client)
121 */ 123 */
122 if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) { 124 if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) {
123 125
124 /* write to slave address, no data, to request a measurement */ 126 /*
125 ret = i2c_master_send(client, tmp, 0); 127 * Write to slave address to request a measurement.
128 * According with the datasheet it should be with no data, but
129 * for systems with I2C bus drivers that do not allow zero
130 * length packets we write one dummy byte to allow sensor
131 * measurements on them.
132 */
133 tmp[0] = 0;
134 ret = i2c_master_send(client, tmp, hih6130->write_length);
126 if (ret < 0) 135 if (ret < 0)
127 goto out; 136 goto out;
128 137
@@ -252,6 +261,9 @@ static int hih6130_probe(struct i2c_client *client,
252 goto fail_remove_sysfs; 261 goto fail_remove_sysfs;
253 } 262 }
254 263
264 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_QUICK))
265 hih6130->write_length = 1;
266
255 return 0; 267 return 0;
256 268
257fail_remove_sysfs: 269fail_remove_sysfs:
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 6cf6bff79003..a2f3b4a365e4 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -94,6 +94,8 @@ static inline u8 FAN_TO_REG(long rpm, int div)
94{ 94{
95 if (rpm <= 0) 95 if (rpm <= 0)
96 return 255; 96 return 255;
97 if (rpm > 1350000)
98 return 1;
97 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); 99 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
98} 100}
99 101
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 4c4c1421bf28..8b8f3aa49726 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client,
1610 "lm90", client); 1610 "lm90", client);
1611 if (err < 0) { 1611 if (err < 0) {
1612 dev_err(dev, "cannot request IRQ %d\n", client->irq); 1612 dev_err(dev, "cannot request IRQ %d\n", client->irq);
1613 goto exit_remove_files; 1613 goto exit_unregister;
1614 } 1614 }
1615 } 1615 }
1616 1616
1617 return 0; 1617 return 0;
1618 1618
1619exit_unregister:
1620 hwmon_device_unregister(data->hwmon_dev);
1619exit_remove_files: 1621exit_remove_files:
1620 lm90_remove_files(client, data); 1622 lm90_remove_files(client, data);
1621exit_restore: 1623exit_restore:
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 1404e6319deb..72a889702f0d 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -141,6 +141,8 @@ static inline u8 FAN_TO_REG(long rpm, int div)
141{ 141{
142 if (rpm <= 0) 142 if (rpm <= 0)
143 return 255; 143 return 255;
144 if (rpm > 1350000)
145 return 1;
144 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); 146 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
145} 147}
146 148
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 0e7017841f7d..aee14e2192f8 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -145,7 +145,7 @@ static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };
145 */ 145 */
146static inline u8 FAN_TO_REG(long rpm, int div) 146static inline u8 FAN_TO_REG(long rpm, int div)
147{ 147{
148 if (rpm == 0) 148 if (rpm <= 0 || rpm > 1310720)
149 return 0; 149 return 0;
150 return clamp_val(1310720 / (rpm * div), 1, 255); 150 return clamp_val(1310720 / (rpm * div), 1, 255);
151} 151}
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c
index edb06cda5a68..6ed76ceb9270 100644
--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -481,9 +481,11 @@ store_pwm(struct device *dev, struct device_attribute *attr,
481 if (err) 481 if (err)
482 return err; 482 return err;
483 val = clamp_val(val, 0, 255); 483 val = clamp_val(val, 0, 255);
484 val = DIV_ROUND_CLOSEST(val, 0x11);
484 485
485 mutex_lock(&data->update_lock); 486 mutex_lock(&data->update_lock);
486 data->pwm[nr] = val; 487 data->pwm[nr] = val * 0x11;
488 val |= w83l786ng_read_value(client, W83L786NG_REG_PWM[nr]) & 0xf0;
487 w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val); 489 w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val);
488 mutex_unlock(&data->update_lock); 490 mutex_unlock(&data->update_lock);
489 return count; 491 return count;
@@ -510,7 +512,7 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr,
510 mutex_lock(&data->update_lock); 512 mutex_lock(&data->update_lock);
511 reg = w83l786ng_read_value(client, W83L786NG_REG_FAN_CFG); 513 reg = w83l786ng_read_value(client, W83L786NG_REG_FAN_CFG);
512 data->pwm_enable[nr] = val; 514 data->pwm_enable[nr] = val;
513 reg &= ~(0x02 << W83L786NG_PWM_ENABLE_SHIFT[nr]); 515 reg &= ~(0x03 << W83L786NG_PWM_ENABLE_SHIFT[nr]);
514 reg |= (val - 1) << W83L786NG_PWM_ENABLE_SHIFT[nr]; 516 reg |= (val - 1) << W83L786NG_PWM_ENABLE_SHIFT[nr];
515 w83l786ng_write_value(client, W83L786NG_REG_FAN_CFG, reg); 517 w83l786ng_write_value(client, W83L786NG_REG_FAN_CFG, reg);
516 mutex_unlock(&data->update_lock); 518 mutex_unlock(&data->update_lock);
@@ -776,9 +778,10 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev)
776 ((pwmcfg >> W83L786NG_PWM_MODE_SHIFT[i]) & 1) 778 ((pwmcfg >> W83L786NG_PWM_MODE_SHIFT[i]) & 1)
777 ? 0 : 1; 779 ? 0 : 1;
778 data->pwm_enable[i] = 780 data->pwm_enable[i] =
779 ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 2) + 1; 781 ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 3) + 1;
780 data->pwm[i] = w83l786ng_read_value(client, 782 data->pwm[i] =
781 W83L786NG_REG_PWM[i]); 783 (w83l786ng_read_value(client, W83L786NG_REG_PWM[i])
784 & 0x0f) * 0x11;
782 } 785 }
783 786
784 787