[PATCH] asus_atk0110: fix limit readings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On newer Asus boards the "upper" limit of a sensor is encoded as delta from the
"lower" limit. Fix the driver to correctly handle this case.
Note that the bug is purely cosmetic.

Signed-off-by: Luca Tettamanti <kronos.it at gmail.com>
Tested-by: Alex Macfarlane Smith <nospam at archifishal.co.uk>
---

 drivers/hwmon/asus_atk0110.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index bff0103..fe4fa29 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -593,7 +593,11 @@ static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
 	sensor->data = data;
 	sensor->id = flags->integer.value;
 	sensor->limit1 = limit1->integer.value;
-	sensor->limit2 = limit2->integer.value;
+	if (data->old_interface)
+		sensor->limit2 = limit2->integer.value;
+	else
+		/* The upper limit is expressed as delta from lower limit */
+		sensor->limit2 = sensor->limit1 + limit2->integer.value;
 
 	snprintf(sensor->input_attr_name, ATTR_NAME_SIZE,
 			"%s%d_input", base_name, start + *num);

Luca



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux