Skip to contentSkip to conversation

Missing thmc50 support in sensors

lm-sensors Jean Delvare 4 participants 9 messages Sep 6, 2007 – Sep 19, 2007 Library code

lore
Share & tools
lore
#0 lore raw

Hi Krzysztof,

In ticket #2250, someone using your new thmc50 driver is complaining about the lack of pretty-print support in "sensors":

http://www.lm-sensors.org/ticket/2250#comment:2

Could you possibly provide a patch adding support? You can simply copy the code for a similar chip in prog/sensors/chips.c (for example lm63) and adjust it for the thmc50 symbols.

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 7 lines · On Thu, 6 Sep 2007 13:06:00 +0200 Jean Delvare <[email protected]> wrote:

Hi Krzysztof,

In ticket #2250, someone using your new thmc50 driver is complaining about the lack of pretty-print support in "sensors":

http://www.lm-sensors.org/ticket/2250#comment:2

The current lmsensors2 displays all information it can get from 2.6 driver. The only problem is the lmsensors2 cannot get information about non-existing entries.

How can I hide entries (like die_code) which do not exist in the 2.6 driver?

Regards,
Krzysztof

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Jean Delvare

Hi Krzysztof,

Quoted 4 lines · Krzysztof Helt
Quoted 3 lines · On Thu, 6 Sep 2007 13:06:00 +0200 Jean Delvare wrote:

In ticket #2250, someone using your new thmc50 driver is complaining about the lack of pretty-print support in "sensors":

Quoted 8 lines
Quoted 1 line

http://www.lm-sensors.org/ticket/2250#comment:2

The current lmsensors2 displays all information it can get from 2.6 driver. The only problem is the lmsensors2 cannot get information about non-existing entries.

How can I hide entries (like die_code) which do not exist in the 2.6 driver?

With the current code, you can't because "sensors" has no pretty-print routine for the thmc50/adm1022. So it falls back to the "unknown chip" printing routine, which blindly trusts the feature list provided by libsensors. This somewhat worked for Linux 2.4 drivers but no longer for Linux 2.6 drivers, as you found out.

The solution is to write a pretty-print routine for the thmc50/adm1022. Or more simply, copy and paste a similar one (for example print_lm63) and change the symbols to the THMC50 ones. In this custom routine you can simply omit the error messages for features which you now might be missing for the Linux 2.6 driver.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Jean Delvare

The patch below adds support for the 2.6 thmc50 and adm1022 to the lmsensors.

Feel free to fix any shortcomings of the patch.

Regards,
Krzysztof

lib/chips.c +13 -0
diff -urp lm-sensors/lib/chips.c lm-sensors.new/lib/chips.c
@@ -2756,6 +2756,19 @@ static sensors_chip_feature thmc50_featu
                                          SENSORS_THMC50_REMOTE_TEMP, RW }, 
                                          THMC50_SYSCTL_REMOTE_TEMP, VALUE(1), 
                                          0 },
+    { { SENSORS_ADM1022_REMOTE_TEMP2, "remote_temp2", NOMAP, NOMAP, R }, 
+                                      ADM1022_SYSCTL_REMOTE_TEMP2, VALUE(3),
+                                      0, "temp3_input", 3 },
+    { { SENSORS_ADM1022_REMOTE_TEMP2_HYST, "remote_temp2_hyst", 
+                                         SENSORS_ADM1022_REMOTE_TEMP2, 
+                                         SENSORS_ADM1022_REMOTE_TEMP2, RW }, 
+                                         ADM1022_SYSCTL_REMOTE_TEMP2, VALUE(2), 
+                                         0, "temp3_min", 3 },
+    { { SENSORS_ADM1022_REMOTE_TEMP2_OVER, "remote2_temp_over", 
+                                         SENSORS_ADM1022_REMOTE_TEMP2, 
+                                         SENSORS_ADM1022_REMOTE_TEMP2, RW }, 
+                                         ADM1022_SYSCTL_REMOTE_TEMP2, VALUE(1), 
+                                         0, "temp3_max", 3 },
     { { SENSORS_THMC50_ANALOG_OUT, "analog output", NOMAP, NOMAP, RW }, 
                                    THMC50_SYSCTL_ANALOG_OUT, VALUE(1), 0,
                                    "pwm1", 0 },
lib/chips.h +3 -0
diff -urp lm-sensors/lib/chips.h lm-sensors.new/lib/chips.h
@@ -1191,6 +1191,9 @@
 #define SENSORS_THMC50_REMOTE_TEMP 54 /* R */
 #define SENSORS_THMC50_REMOTE_TEMP_HYST 55 /* RW */
 #define SENSORS_THMC50_REMOTE_TEMP_OVER 56 /* RW */
+#define SENSORS_ADM1022_REMOTE_TEMP2 57 /* R */
+#define SENSORS_ADM1022_REMOTE_TEMP2_HYST 58 /* RW */
+#define SENSORS_ADM1022_REMOTE_TEMP2_OVER 59 /* RW */
 #define SENSORS_THMC50_ANALOG_OUT 71 /* RW */
 #define SENSORS_THMC50_INTER 81 /* R */
 #define SENSORS_THMC50_INTER_MASK 82 /* RW */
prog/sensors/chips.c +94 -0

100 lines not on this page · raw message

prog/sensors/chips.h +1 -0
diff -urp lm-sensors/prog/sensors/chips.h lm-sensors.new/prog/sensors/chips.h
@@ -80,5 +80,6 @@ extern void print_coretemp(const sensors
 extern void print_dme1737(const sensors_chip_name *name);
 extern void print_applesmc(const sensors_chip_name *name);
 extern void print_f71882fg(const sensors_chip_name *name);
+extern void print_thmc50(const sensors_chip_name *name);
 
 #endif /* def PROG_SENSORS_CHIPS_H */
prog/sensors/main.c +2 -0
diff -urp lm-sensors/prog/sensors/main.c lm-sensors.new/prog/sensors/main.c
@@ -427,6 +427,8 @@ static struct match matches[] = {
  	{ "sch311x", print_dme1737 },
 	{ "applesmc", print_applesmc },
 	{ "f71882fg", print_f71882fg },
+	{ "thmc50", print_thmc50 },
+	{ "adm1022", print_thmc50 },
 	{ NULL, NULL }
 };
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Jean Delvare

Hi Krzysztof,

Quoted 3 lines · Krzysztof Helt

The patch below adds support for the 2.6 thmc50 and adm1022 to the lmsensors.

Feel free to fix any shortcomings of the patch.

Patch applied, thanks for your contribution. I've dropped the printing of the misc features as the new libsensors won't support that and I don't want users to feel that this is a regression.

Krzysztof, can you please send me (in private) a dump of your chip (as returned by i2cdump)? I'd like to add it to my collection so that I can emulate this chip with i2c-stub.

Philippe, you can fetch the SVN head of lm-sensors and give it a try now. It should display your temperatures nicely.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Jean Delvare
Quoted 5 lines · On Mon, 17 Sep 2007 13:25:53 +0200 Jean Delvare <[email protected]> wrote:

Krzysztof, can you please send me (in private) a dump of your chip (as returned by i2cdump)? I'd like to add it to my collection so that I can emulate this chip with i2c-stub.

Give me commands to do this (i2cdump something). Chips are located at 0x2d and 0x2e.

Regards,
Krzysztof

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw
In reply to Jean Delvare

Hi Krzysztof,

Quoted 6 lines · Krzysztof Helt
Quoted 3 lines · On Mon, 17 Sep 2007 13:25:53 +0200 Jean Delvare wrote:

Krzysztof, can you please send me (in private) a dump of your chip (as returned by i2cdump)? I'd like to add it to my collection so that I can emulate this chip with i2c-stub.

Give me commands to do this (i2cdump something). Chips are located at 0x2d and 0x2e.

# modprobe i2c-dev
# i2cdetect -l
(find out which i2c bus corresponds to the motherboard SMBus)
# i2cdetect <N>
(where <N> is the bus number in question; this should show chips at 0x2d
 0x2e)
# i2cdump <N> 0x2d b > thmc50-2d.dump
# i2cdump <N> 0x2e b > thmc50-2e.dump

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#7 lore raw
In reply to Jean Delvare

Hey Jean, Krzysztof,

Isengard:~/lm-sensors-r4800-20070918# sensors

adm1022-i2c-0-2e

Adapter: SMBus I801 adapter at fc00

temp: +22°C (low = -128°C, high = +127°C)

remote_temp:

             +32°C  (low  =  -127°C, high =   +59°C)  

remote_temp2:

+0°C (low = +0°C, high = +0°C)

Isengard:~/lm-sensors-r4800-20070918# sensors -v

sensors version 2.10.4-SVN with libsensors version 2.10.4-SVN

Am I using the right version here ?

Regards,

Philippe

On Mon, 17 Sep 2007 13:25:53 +0200, Jean Delvare <[email protected]>

Quoted 34 lines · wrote:

Hi Krzysztof,

Quoted 1 line · Krzysztof Helt

The patch below adds support for the 2.6 thmc50 and adm1022 to the

lmsensors.

Quoted 3 lines

Feel free to fix any shortcomings of the patch.

Patch applied, thanks for your contribution. I've dropped the printing

of the misc features as the new libsensors won't support that and I

don't want users to feel that this is a regression.

Krzysztof, can you please send me (in private) a dump of your chip (as

returned by i2cdump)? I'd like to add it to my collection so that I can

emulate this chip with i2c-stub.

Philippe, you can fetch the SVN head of lm-sensors and give it a try

Quoted 7 lines

now. It should display your temperatures nicely.

--

Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#8 lore raw
In reply to Jean Delvare
Quoted 23 lines · On Wed, 19 Sep 2007 14:01:29 +0200 Philippe Michiels <[email protected]>…

Hey Jean, Krzysztof,

Isengard:~/lm-sensors-r4800-20070918# sensors

adm1022-i2c-0-2e

Adapter: SMBus I801 adapter at fc00

temp: +22°C (low = -128°C, high = +127°C)

remote_temp:

             +32°C  (low  =  -127°C, high =   +59°C)  

remote_temp2:

              +0°C  (low  =    +0°C, high =    +0°C)  

[..]

Quoted 3 lines

Am I using the right version here ?

Yes. The Jean's new patch removes remote_temp2 (from the kernel driver) as it is probably not connected on you motherboard.

Regards,
Krzysztof

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors