All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Missing thmc50 support in sensors
@ 2007-09-06 11:06 Jean Delvare
  2007-09-09  8:42 ` Krzysztof Helt
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Jean Delvare @ 2007-09-06 11:06 UTC (permalink / raw)
  To: lm-sensors

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,
-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
@ 2007-09-09  8:42 ` Krzysztof Helt
  2007-09-09 11:17 ` Jean Delvare
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Helt @ 2007-09-09  8:42 UTC (permalink / raw)
  To: lm-sensors

On Thu, 6 Sep 2007 13:06:00 +0200
Jean Delvare <khali@linux-fr.org> 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
  2007-09-09  8:42 ` Krzysztof Helt
@ 2007-09-09 11:17 ` Jean Delvare
  2007-09-09 14:30 ` Krzysztof Helt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jean Delvare @ 2007-09-09 11:17 UTC (permalink / raw)
  To: lm-sensors

Hi Krzysztof,

On Sun, 9 Sep 2007 10:42:20 +0200, Krzysztof Helt wrote:
> 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":
> > 
> > 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.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
  2007-09-09  8:42 ` Krzysztof Helt
  2007-09-09 11:17 ` Jean Delvare
@ 2007-09-09 14:30 ` Krzysztof Helt
  2007-09-17 11:25 ` Jean Delvare
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Helt @ 2007-09-09 14:30 UTC (permalink / raw)
  To: lm-sensors

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

diff -urp lm-sensors/lib/chips.c lm-sensors.new/lib/chips.c
--- lm-sensors/lib/chips.c	2007-09-09 16:10:40.206761317 +0200
+++ lm-sensors.new/lib/chips.c	2007-09-09 16:25:37.105872685 +0200
@@ -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 },
diff -urp lm-sensors/lib/chips.h lm-sensors.new/lib/chips.h
--- lm-sensors/lib/chips.h	2007-09-09 16:10:40.258764281 +0200
+++ lm-sensors.new/lib/chips.h	2007-09-09 15:44:43.238034726 +0200
@@ -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 */
diff -urp lm-sensors/prog/sensors/chips.c lm-sensors.new/prog/sensors/chips.c
--- lm-sensors/prog/sensors/chips.c	2007-09-09 16:10:49.851310930 +0200
+++ lm-sensors.new/prog/sensors/chips.c	2007-09-09 16:27:01.798699053 +0200
@@ -6255,6 +6255,100 @@ void print_f71882fg(const sensors_chip_n
     print_f71882fg_temp(name, i);
 }
 
+void print_thmc50(const sensors_chip_name *name)
+{
+  char *label;
+  double cur,hyst,over;
+  int valid;
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_TEMP,&label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_TEMP,&cur) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_TEMP_HYST,&hyst) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_TEMP_OVER,&over))  {
+    if (valid) {
+      print_label(label,14);
+      print_temp_info( cur, over, hyst, MINMAX, 0, 0);
+      printf("\n");
+    }
+  } else
+    printf("ERROR: Can't get temperature1 data!\n");
+  free(label);
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_REMOTE_TEMP,
+                                   &label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_REMOTE_TEMP,&cur) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_REMOTE_TEMP_HYST,&hyst) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_REMOTE_TEMP_OVER,&over))  {
+    if (valid) {
+      print_label(label,14);
+      print_temp_info( cur, over, hyst, MINMAX, 0, 0);
+      printf("\n");
+    }
+  } else
+    printf("ERROR: Can't get temperature2 data!\n");
+  free(label);
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_ADM1022_REMOTE_TEMP2,
+                                   &label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_ADM1022_REMOTE_TEMP2,&cur) &&
+      !sensors_get_feature(*name,SENSORS_ADM1022_REMOTE_TEMP2_HYST,&hyst) &&
+      !sensors_get_feature(*name,SENSORS_ADM1022_REMOTE_TEMP2_OVER,&over))  {
+    if (valid) {
+      print_label(label,14);
+      print_temp_info( cur, over, hyst, MINMAX, 0, 0);
+      printf("\n");
+    }
+  }
+  /* No error if files are missing as it will happen for original thmc50 */
+  free(label);
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_ANALOG_OUT,
+                                   &label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_ANALOG_OUT,&cur)) {
+    if (valid) {
+      print_label(label,14);
+      printf("%4.0f\n", cur);
+    }
+  } else
+    printf("ERROR: Can't get analog output data!\n");
+  free(label);
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_INTER,
+                                   &label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_INTER,&cur)) {
+    if (valid) {
+      print_label(label,14);
+      printf("%4.0f\n", cur);
+    }
+  }
+  /* No error if files are missing as it will happen with 2.6 kernels */
+  free(label);
+
+  if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_INTER_MASK,
+                                   &label,&valid) &&
+      !sensors_get_feature(*name,SENSORS_THMC50_INTER_MASK,&cur)) {
+    if (valid) {
+      print_label(label,14);
+      printf("%4.0f\n", cur);
+    }
+  }
+  /* No error if files are missing as it will happen with 2.6 kernels */
+  free(label);
+
+  if (!strcmp(name->prefix,"thmc50")) {
+    if (!sensors_get_label_and_valid(*name,SENSORS_THMC50_DIE_CODE,
+                                     &label,&valid) &&
+        !sensors_get_feature(*name,SENSORS_THMC50_DIE_CODE,&cur)) {
+      if (valid) {
+        print_label(label,14);
+        printf("%4.0f\n",cur);
+      }
+    }
+  /* No error if files are missing as it will happen with 2.6 kernels */
+    free(label);
+  }
+}
+
 void print_unknown_chip(const sensors_chip_name *name)
 {
   int a,b,valid;
diff -urp lm-sensors/prog/sensors/chips.h lm-sensors.new/prog/sensors/chips.h
--- lm-sensors/prog/sensors/chips.h	2007-09-09 16:10:49.871312069 +0200
+++ lm-sensors.new/prog/sensors/chips.h	2007-09-09 15:19:46.556743721 +0200
@@ -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 */
diff -urp lm-sensors/prog/sensors/main.c lm-sensors.new/prog/sensors/main.c
--- lm-sensors/prog/sensors/main.c	2007-09-09 16:10:49.819309105 +0200
+++ lm-sensors.new/prog/sensors/main.c	2007-09-09 15:34:52.712382587 +0200
@@ -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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
                   ` (2 preceding siblings ...)
  2007-09-09 14:30 ` Krzysztof Helt
@ 2007-09-17 11:25 ` Jean Delvare
  2007-09-17 12:28 ` Krzysztof Helt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jean Delvare @ 2007-09-17 11:25 UTC (permalink / raw)
  To: lm-sensors

Hi Krzysztof,

On Sun, 9 Sep 2007 16:30:51 +0200, Krzysztof Helt wrote:
> 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.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
                   ` (3 preceding siblings ...)
  2007-09-17 11:25 ` Jean Delvare
@ 2007-09-17 12:28 ` Krzysztof Helt
  2007-09-17 14:00 ` Jean Delvare
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Helt @ 2007-09-17 12:28 UTC (permalink / raw)
  To: lm-sensors

On Mon, 17 Sep 2007 13:25:53 +0200
Jean Delvare <khali@linux-fr.org> 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
                   ` (4 preceding siblings ...)
  2007-09-17 12:28 ` Krzysztof Helt
@ 2007-09-17 14:00 ` Jean Delvare
  2007-09-19 12:01 ` Philippe Michiels
  2007-09-19 13:31 ` Krzysztof Helt
  7 siblings, 0 replies; 9+ messages in thread
From: Jean Delvare @ 2007-09-17 14:00 UTC (permalink / raw)
  To: lm-sensors

Hi Krzysztof,

On Mon, 17 Sep 2007 14:28:17 +0200, Krzysztof Helt wrote:
> 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,
-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
                   ` (5 preceding siblings ...)
  2007-09-17 14:00 ` Jean Delvare
@ 2007-09-19 12:01 ` Philippe Michiels
  2007-09-19 13:31 ` Krzysztof Helt
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Michiels @ 2007-09-19 12:01 UTC (permalink / raw)
  To: lm-sensors


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 <khali@linux-fr.org>

wrote:

> Hi Krzysztof,

> 

> On Sun, 9 Sep 2007 16:30:51 +0200, Krzysztof Helt wrote:

>> 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.

> 

> --

> Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [lm-sensors] Missing thmc50 support in sensors
  2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
                   ` (6 preceding siblings ...)
  2007-09-19 12:01 ` Philippe Michiels
@ 2007-09-19 13:31 ` Krzysztof Helt
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Helt @ 2007-09-19 13:31 UTC (permalink / raw)
  To: lm-sensors

On Wed, 19 Sep 2007 14:01:29 +0200
Philippe Michiels <philippe@michiels.nu> wrote:

> 
> 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)  
> 
> 
> 
[..] 
> 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-09-19 13:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-06 11:06 [lm-sensors] Missing thmc50 support in sensors Jean Delvare
2007-09-09  8:42 ` Krzysztof Helt
2007-09-09 11:17 ` Jean Delvare
2007-09-09 14:30 ` Krzysztof Helt
2007-09-17 11:25 ` Jean Delvare
2007-09-17 12:28 ` Krzysztof Helt
2007-09-17 14:00 ` Jean Delvare
2007-09-19 12:01 ` Philippe Michiels
2007-09-19 13:31 ` Krzysztof Helt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.