hwmon: Add a driver for the ADT7475 thermal sensor
Subsystems (3)
Quoted 7 lines · Hans de Goede
Quoted 5 lines · Jordan Crouse
Resend of the ADT7475 driver. Jean said he would like to see a review on this version, even though it had been discussed before. Therefore I'm CCing Hans for his opinion.. :) I would really like to see this go into 2.6.28 and get out of my patch stack.
Quoted 7 lines
Jordan,
I did do a review although very late (but didn't get very far, as there are some sysfs API issues that need addressing first).
See:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-August/023948.html
Oops - some how I missed that email (/me kicks mutt). I wish i had seen it when you wrote it, I hope I can get the changes made before the next kernel goes lives.
Thanks,
Jordan
Signature · 9 lines
Jordan Crouse Systems Software Development Engineer Advanced Micro Devices, Inc. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 7 lines · Hans de Goede
Quoted 5 lines · Jordan Crouse
Resend of the ADT7475 driver. Jean said he would like to see a review on this version, even though it had been discussed before. Therefore I'm CCing Hans for his opinion.. :) I would really like to see this go into 2.6.28 and get out of my patch stack.
Quoted 7 lines
Jordan,
I did do a review although very late (but didn't get very far, as there are some sysfs API issues that need addressing first).
See:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-August/023948.html
Okay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
There is one possible issue in the patch - I pulled the decimal point from the pwmX_freq numbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.
Compile tested and run on an ADT7475 platform.
Jordan
Signature · 3 lines
Jordan Crouse Systems Software Development Engineer Advanced Micro Devices, Inc.
[PATCH] hwmon: Add a driver for the ADT7475 thermal sensor
From: Jordan Crouse <[email protected]>
HWMON driver for the ADT7475 thermal sensor.
---
Documentation/hwmon/adt7475 | 90 +++ drivers/hwmon/Kconfig | 10 drivers/hwmon/Makefile | 2 drivers/hwmon/adt7475.c | 1137 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1239 insertions(+), 0 deletions(-)
Documentation/hwmon/adt7475 new file +90 -0
@@ -0,0 +1,90 @@ +This describes the interface for the ADT7475 driver: + +(there are 4 fans, numbered fan1 to fan4): + +fanX_input Read the current speed of the fan (in RPMs) +fanX_min Read/write the minimum speed of the fan. Dropping + below this sets an alarm. + +(there are three PWMs, numbered pwm1 to pwm3): + +pwmX Read/write the current duty cycle of the PWM. Writes + only have effect when auto mode is turned off (see + below). Range is 0 - 255. + +pwmX_enable Fan speed control method: + + 0 - No control (fan at full speed) + 1 - Manual fan speed control (using pwm[1-*]) + 2 - Automatic fan speed control + +pwmX_auto_channels_temp Select which channels affect this PWM + + 1 - TEMP1 controls PWM + 2 - TEMP2 controls PWM + 4 - TEMP3 controls PWM + 6 - TEMP2 and TEMP3 control PWM + 7 - All three inputs control PWM + +pwmX_freq Read/write the PWM frequency in Hz. The number + should be one of the following: + + 11 Hz + 14 Hz + 22 Hz + 29 Hz + 35 Hz + 44 Hz + 58 Hz + 88 Hz + +pwmX_max Read/write the maximum PWM duty cycle. The PWM + duty cycle will never exceed this. + +pwmX_min Read/write the minimum PWM duty cycle in automatic mode + +(there are three temperature settings numbered temp1 to temp3): + +tempX_input Read the current temperature. The value is in milli + degrees of Celsius. + +tempX_max Read/write the upper temperature limit - exceeding this + will cause an alarm. + +tempX_min Read/write the lower temperature limit - exceeding this + will cause an alarm. + +tempX_offset Read/write the temperature adjustment offset + +tempX_crit Read/write the THERM limit for remote1. Exceeding this + causes the chip to force the processor off. + +tempX_auto_point1_temp Read/write the minimum temperature where the fans will + turn on in automatic mode. + +tempX_auto_point2_temp Read/write the maximum temperature over which the fans + will run in automatic mode. tempX_auto_point1_temp + and tempX_auto_point2_temp together define the + range of automatic control. + +tempX_crit_hyst set the temperature value below crit where the + fans will stay on - this helps drive the temperature + low enough so it doesn't stay near the edge and + cause THERM to keep tripping. + +tempX_alarm Read a 1 if the max/min alarm is set +tempX_crit_alarm Read a 1 if the critical limit is exceeded +tempX_fault Read a 1 if either temp1 or temp3 diode has a fault + +(There are two voltage settings, in1 and in2): + +inX_input Read the current voltage on VCC. Value is in + millivolts. + +inX_min read/write the minimum voltage limit. + Dropping below this causes an alarm. + +inX_max read/write the maximum voltage limit. + Exceeding this causes an alarm. + +inX_alarm Read a 1 if the max/min alarm is set.
drivers/hwmon/Kconfig +10 -0
@@ -179,6 +179,16 @@ config SENSORS_ADT7473 This driver can also be built as a module. If so, the module will be called adt7473. +config SENSORS_ADT7475 + tristate "Analog Devices ADT7475" + depends on I2C && EXPERIMENTAL + help + If you say yes here you get support for the Analog Devices + ADT7475 temperature monitoring chips. + + This driver can also be build as a module. If so, the module + will be called adt7475. + config SENSORS_K8TEMP tristate "AMD Athlon64/FX or Opteron temperature sensor" depends on X86 && PCI && EXPERIMENTAL
drivers/hwmon/Makefile +2 -0
@@ -27,6 +27,8 @@ obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o +obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o + obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o obj-$(CONFIG_SENSORS_AMS) += ams/ obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
drivers/hwmon/adt7475.c new file +1137 -0
1,137 lines not on this page · raw message
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Jordan,
Quoted 15 lines · Jordan Crouse
Quoted 6 lines · Hans de Goede
Quoted 4 lines · Jordan Crouse
Resend of the ADT7475 driver. Jean said he would like to see a review on this version, even though it had been discussed before. Therefore I'm CCing Hans for his opinion.. :) I would really like to see this go into 2.6.28 and get out of my patch stack.
Quoted 7 lines
Jordan,
I did do a review although very late (but didn't get very far, as there are some sysfs API issues that need addressing first).
See:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-August/023948.html
Quoted 8 lines
Okay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
There is one possible issue in the patch - I pulled the decimal point from the
pwmX_freqnumbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.
You did the right thing, we do not want to express PWM frequencies in millihertz. The standard resolution is 1 hertz and tt should be totally sufficient in practice: we don't really care about the exact frequency values.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hans de Goede
Reviewed-byQuoted 20 lines · Jordan Crouse
Quoted 6 lines · Hans de Goede
Quoted 5 lines · Jordan Crouse
Resend of the ADT7475 driver. Jean said he would like to see a review on this version, even though it had been discussed before. Therefore I'm CCing Hans for his opinion.. :) I would really like to see this go into 2.6.28 and get out of my patch stack.
Quoted 7 lines
Jordan,
I did do a review although very late (but didn't get very far, as there are some sysfs API issues that need addressing first).
See:
http://lists.lm-sensors.org/pipermail/lm-sensors/2008-August/023948.htmlOkay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
Quoted 6 lines
There is one possible issue in the patch - I pulled the decimal point from the
pwmX_freqnumbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.Compile tested and run on an ADT7475 platform.
Hi Jordan et all,
I've given this a quick review (not as thorough as I would have liked to do but I simply don't have enough time for a really thorough review) and I've found no issues. So this patch is now:
Regards,
Hans
p.s.
Yes the email I'm signing-off with changed as my employer has changed
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Hans, Jordan,
Le samedi 13 septembre 2008, Hans de Goede a écrit :
Quoted 13 lines
Quoted 11 lines · Jordan Crouse
Okay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
There is one possible issue in the patch - I pulled the decimal point from the
pwmX_freqnumbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.Compile tested and run on an ADT7475 platform.
Quoted 7 lines
Hi Jordan et all,
I've given this a quick review (not as thorough as I would have liked to do but I simply don't have enough time for a really thorough review) and I've found no issues. So this patch is now:
Reviewed-by Hans de Goede <[email protected]>
Am I the only one seeing these warnings at build time?
CC [M] drivers/hwmon/adt7475.odrivers/hwmon/adt7475.c: In function ‘adt7475_update_device’:drivers/hwmon/adt7475.c:1043: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:1044: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:1045: warning: array subscript is above array bounds drivers/hwmon/adt7475.c: In function ‘set_temp’:drivers/hwmon/adt7475.c:381: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:381: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:382: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:382: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:384: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:384: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:385: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:385: warning: array subscript is above array bounds drivers/hwmon/adt7475.c:388: warning: array subscript is above array bounds
Apparently struct adt7475_data should be changed from
s16 temp[6][3]; to s16 temp[7][3];
Thanks,
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 17 lines · Jean Delvare
Hi Hans, Jordan,
Quoted 14 lines · Hans de Goede
Quoted 11 lines · Jordan Crouse
Okay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
There is one possible issue in the patch - I pulled the decimal point from the
pwmX_freqnumbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.Compile tested and run on an ADT7475 platform.
Hi Jordan et all,
Quoted 8 lines
Quoted 5 lines
I've given this a quick review (not as thorough as I would have liked to do but I simply don't have enough time for a really thorough review) and I've found no issues. So this patch is now:
Reviewed-by Hans de Goede <[email protected]>Am I the only one seeing these warnings at build time?
No as said I didn't have all that much time, so I just reviewed it I didn't actually try to build it (I assumed Jordan alreayd build it).
Quoted 4 lines
CC [M]
drivers/hwmon/adt7475.odrivers/hwmon/adt7475.c: In function ‘adt7475_update_device’:drivers/hwmon/adt7475.c:1043: warning: array subscript is above array bounds
<snip>
Quoted 5 lines
Apparently struct
adt7475_datashould be changed froms16 temp[6][3]; to s16 temp[7][3];
Looking closer at the code: you are completely right
Also while looking closer:
This snippet in adt7475_update_device() :
data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS);
data->temp[HYSTERSIS][1] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS);
data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);Should be rewritten to:
data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS);
data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0];
data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);To avoid 1 (slow) unnecessary i2c transaction.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 42 lines · Jean Delvare
Hi Hans, Jordan,
Le samedi 13 septembre 2008, Hans de Goede a écrit :
Quoted 13 lines
Quoted 11 lines · Jordan Crouse
Okay - I have generated a new patch. I implemented all of your suggestions - the only one I had any concerns about was the hystersis (hystersis makes more sense to me as an offset rather then an absolute), but consistancy among hwmon drivers is rather more important.
There is one possible issue in the patch - I pulled the decimal point from the
pwmX_freqnumbers since I wasn't sure if we wanted to express the number in milihertz. If we do, then it is an easy fix.Compile tested and run on an ADT7475 platform.
Quoted 7 lines
Hi Jordan et all,
I've given this a quick review (not as thorough as I would have liked to do but I simply don't have enough time for a really thorough review) and I've found no issues. So this patch is now:
Reviewed-by Hans de Goede <[email protected]>Am I the only one seeing these warnings at build time?
CC [M]
drivers/hwmon/adt7475.odrivers/hwmon/adt7475.c: In function ‘adt7475_update_device’:drivers/hwmon/adt7475.c:1043: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:1044: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:1045: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c: In function ‘set_temp’:drivers/hwmon/adt7475.c:381: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:381: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:382: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:382: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:384: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:384: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:385: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:385: warning: array subscript is above array boundsdrivers/hwmon/adt7475.c:388: warning: array subscript is above array bounds
Quoted 4 lines
Apparently struct
adt7475_datashould be changed froms16 temp[6][3]; to s16 temp[7][3];
Ohh - geeze. I had that changed in my development tree, but not in my pristine tree. Argh! I'll send up a new patch with that and the other fix Hans identified.
Jordan
Signature · 9 lines
Jordan Crouse Systems Software Development Engineer Advanced Micro Devices, Inc. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 23 lines · Hans de Goede
Quoted 4 lines
CC [M]
drivers/hwmon/adt7475.odrivers/hwmon/adt7475.c: In function ‘adt7475_update_device’:drivers/hwmon/adt7475.c:1043: warning: array subscript is above array bounds<snip>
Quoted 5 lines
Apparently struct
adt7475_datashould be changed froms16 temp[6][3]; to s16 temp[7][3];Looking closer at the code: you are completely right
Also while looking closer:
This snippet in
adt7475_update_device():data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); data->temp[HYSTERSIS][1] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);
Quoted 6 lines
Should be rewritten to:
data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0]; data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);To avoid 1 (slow) unnecessary i2c transaction.
With much egg on my face, here is an updated patch. Compiles clean with gcc 4.2.3. Updated the index and removed the redundant smbus read.
Jordan
Signature · 3 lines
Jordan Crouse Systems Software Development Engineer Advanced Micro Devices, Inc.
[PATCH] hwmon: Add a driver for the ADT7475 thermal sensor
From: Jordan Crouse <[email protected]>
HWMON driver for the ADT7475 thermal sensor.
---
Documentation/hwmon/adt7475 | 90 +++ drivers/hwmon/Kconfig | 10 drivers/hwmon/Makefile | 2 drivers/hwmon/adt7475.c | 1140 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1242 insertions(+), 0 deletions(-)
Documentation/hwmon/adt7475 new file +90 -0
@@ -0,0 +1,90 @@ +This describes the interface for the ADT7475 driver: + +(there are 4 fans, numbered fan1 to fan4): + +fanX_input Read the current speed of the fan (in RPMs) +fanX_min Read/write the minimum speed of the fan. Dropping + below this sets an alarm. + +(there are three PWMs, numbered pwm1 to pwm3): + +pwmX Read/write the current duty cycle of the PWM. Writes + only have effect when auto mode is turned off (see + below). Range is 0 - 255. + +pwmX_enable Fan speed control method: + + 0 - No control (fan at full speed) + 1 - Manual fan speed control (using pwm[1-*]) + 2 - Automatic fan speed control + +pwmX_auto_channels_temp Select which channels affect this PWM + + 1 - TEMP1 controls PWM + 2 - TEMP2 controls PWM + 4 - TEMP3 controls PWM + 6 - TEMP2 and TEMP3 control PWM + 7 - All three inputs control PWM + +pwmX_freq Read/write the PWM frequency in Hz. The number + should be one of the following: + + 11 Hz + 14 Hz + 22 Hz + 29 Hz + 35 Hz + 44 Hz + 58 Hz + 88 Hz + +pwmX_max Read/write the maximum PWM duty cycle. The PWM + duty cycle will never exceed this. + +pwmX_min Read/write the minimum PWM duty cycle in automatic mode + +(there are three temperature settings numbered temp1 to temp3): + +tempX_input Read the current temperature. The value is in milli + degrees of Celsius. + +tempX_max Read/write the upper temperature limit - exceeding this + will cause an alarm. + +tempX_min Read/write the lower temperature limit - exceeding this + will cause an alarm. + +tempX_offset Read/write the temperature adjustment offset + +tempX_crit Read/write the THERM limit for remote1. Exceeding this + causes the chip to force the processor off. + +tempX_auto_point1_temp Read/write the minimum temperature where the fans will + turn on in automatic mode. + +tempX_auto_point2_temp Read/write the maximum temperature over which the fans + will run in automatic mode. tempX_auto_point1_temp + and tempX_auto_point2_temp together define the + range of automatic control. + +tempX_crit_hyst set the temperature value below crit where the + fans will stay on - this helps drive the temperature + low enough so it doesn't stay near the edge and + cause THERM to keep tripping. + +tempX_alarm Read a 1 if the max/min alarm is set +tempX_crit_alarm Read a 1 if the critical limit is exceeded +tempX_fault Read a 1 if either temp1 or temp3 diode has a fault + +(There are two voltage settings, in1 and in2): + +inX_input Read the current voltage on VCC. Value is in + millivolts. + +inX_min read/write the minimum voltage limit. + Dropping below this causes an alarm. + +inX_max read/write the maximum voltage limit. + Exceeding this causes an alarm. + +inX_alarm Read a 1 if the max/min alarm is set.
drivers/hwmon/Kconfig +10 -0
@@ -179,6 +179,16 @@ config SENSORS_ADT7473 This driver can also be built as a module. If so, the module will be called adt7473. +config SENSORS_ADT7475 + tristate "Analog Devices ADT7475" + depends on I2C && EXPERIMENTAL + help + If you say yes here you get support for the Analog Devices + ADT7475 temperature monitoring chips. + + This driver can also be build as a module. If so, the module + will be called adt7475. + config SENSORS_K8TEMP tristate "AMD Athlon64/FX or Opteron temperature sensor" depends on X86 && PCI && EXPERIMENTAL
drivers/hwmon/Makefile +2 -0
@@ -27,6 +27,8 @@ obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o +obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o + obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o obj-$(CONFIG_SENSORS_AMS) += ams/ obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
drivers/hwmon/adt7475.c new file +1140 -0
1,140 lines not on this page · raw message
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors