All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [patches pc87360]  printk-format, magic-init
@ 2005-07-22 15:41 Jim Cromie
  2005-07-22 15:58 ` Jim Cromie
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Cromie @ 2005-07-22 15:41 UTC (permalink / raw)
  To: lm-sensors


1st is self-explanatory.

2nd adds some missing parts of the magic init sequence.
It doesnt seem to change anything, (ie improve my numbers),

I cant cut-paste from the PDF, but its page 208.

its also in this code;
http://phk.freebsd.dk/soekris/env4801/env4801.c

if (argc = 2 && !strcmp(argv[1], "-i")) {
		/* Magic init sequence from page 208 */
		outb(atms + 0x8, 0x00);
		outb(atms + 0x9, 0x0f);
		outb(atms + 0xa, 0x08);
		outb(atms + 0xb, 0x04);
		outb(atms + 0xc, 0x35);
		outb(atms + 0xd, 0x05);
		outb(atms + 0xe, 0x05);


Incidentally, the reason I got into this that,
despite the fact that Ive got an 'ignore fan2' in my config,
Im getting this error:

    prog/sensors/chips.c:    printf("ERROR: Can't get FAN2 data!\n");




Ive been unable to build 2.9.1 or cvs on my fedora 3 laptop,
so Ive been unable to add prints to narrow the source of the problem.

For now, Id like to find out if others are building ok on Fedora 3,
how they got around the lack of modversions.h.


fwiw, my soekris board has no fans, so I think the module-code
detects that lack via extra_isa, and sets fannr = 0, so never creates
the sysfs files.  The lib code apparently doesnt handle a missing
sysfs node well.

I'll verify this supposition with printks b4 returning here.


-------------- next part --------------
diff -ruN -X exclude-diffs linux-2.6.12-ska12/drivers/i2c/chips/pc87360.c linux-2.6.12-i2c/drivers/i2c/chips/pc87360.c
--- linux-2.6.12-ska12/drivers/i2c/chips/pc87360.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-i2c/drivers/i2c/chips/pc87360.c	2005-07-21 11:25:16.000000000 -0600
@@ -1045,7 +1047,7 @@
 		reg = pc87360_read_value(data, LD_IN, NO_BANK,
 					 PC87365_REG_IN_CONVRATE);
 		dev_info(&client->dev, "VLM conversion set to"
-			 "1s period, 160us delay\n");
+			 " 1s period, 160us delay\n");
 		pc87360_write_value(data, LD_IN, NO_BANK,
 				    PC87365_REG_IN_CONVRATE,
 				    (reg & 0xC0) | 0x11);
-------------- next part --------------
diff -ruN -X exclude-diffs linux-2.6.12-ska12/drivers/i2c/chips/pc87360.c linux-2.6.12-i2c/drivers/i2c/chips/pc87360.c
--- linux-2.6.12-ska12/drivers/i2c/chips/pc87360.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-i2c/drivers/i2c/chips/pc87360.c	2005-07-21 11:25:16.000000000 -0600
@@ -1144,11 +1146,14 @@
 
 		if (init >= 2) {
 			/* Chip config as documented by National Semi. */
-			pc87360_write_value(data, LD_TEMP, 0xF, 0xA, 0x08);
+			pc87360_write_value(data, LD_TEMP, 0xF, 0x8, 0x00);
 			/* We voluntarily omit the bank here, in case the
 			   sequence itself matters. It shouldn't be a problem,
 			   since nobody else is supposed to access the
 			   device at that point. */
+			pc87360_write_value(data, LD_TEMP, NO_BANK, 0x9, 0x0F);
+			pc87360_write_value(data, LD_TEMP, NO_BANK, 0xA, 0x08);
+
 			pc87360_write_value(data, LD_TEMP, NO_BANK, 0xB, 0x04);
 			pc87360_write_value(data, LD_TEMP, NO_BANK, 0xC, 0x35);
 			pc87360_write_value(data, LD_TEMP, NO_BANK, 0xD, 0x05);

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [lm-sensors] [patches pc87360]  printk-format, magic-init
@ 2005-07-22 21:20 Jean Delvare
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2005-07-22 21:20 UTC (permalink / raw)
  To: lm-sensors

Hi Jim,

> 1st is self-explanatory.

And obviously correct, but it happens that I already have a patch
pending solving 5 more of this type of error in 4 different drivers:

http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.13-rc3-i2c-missing-space-in-split-strings.diff

Note that since 2.6.13-rc3, hardware monitoring drivers are in
drivers/hwmon and no more in drivers/i2c/chips. Thus I'd invite you to
send any future patch at least based on 2.6.13-rc3.

> 2nd adds some missing parts of the magic init sequence.

The missing part is thiner than you seem to think, and is additionally
missing on purpose. You seem to have missed the fact that:

  pc87360_write_value(data, LD_TEMP, 0xF, 0xA, 0x08);

actually writes *two* bytes, one at 0x9 and one at 0xA. And the 0x00
write to 0x08 I voluntarily omitted, because it would force the chip to
use an internal vref, while the system manufacturer may provide an
external one instead. Instead, my code carefully forces *only* bit 0 to
0 so as to start monitoring if needs be.

Of course, if anyone ever proves that restoring the missing write helps
in any way, I'll reconsider.

> Incidentally, the reason I got into this that,
> despite the fact that Ive got an 'ignore fan2' in my config,
> Im getting this error:
> 
>     prog/sensors/chips.c:    printf("ERROR: Can't get FAN2 data!\n");

Fixed in CVS:

revision 1.158
date: 2005/04/22 18:08:06;  author: khali;  state: Exp;  lines: +1 -2
(Khali) No error on missing pc87360 fan2, as this can happen with the
Linux 2.6 version of the driver. Reported by Christian Schwamborn.

The fix is in the "sensors" program, file chips.c.

> fwiw, my soekris board has no fans, so I think the module-code
> detects that lack via extra_isa, and sets fannr = 0, so never creates
> the sysfs files.  The lib code apparently doesnt handle a missing
> sysfs node well.

Yes, your analysis is correct. libsensors was written for the old procfs
interface which always created files even when the features were
missing, and was hacked later for sysfs, just enough to make it work for
most cases. We know that not all corner cases are handled, we currently
hack the "sensors" program to hide most errors, until the library is
rewritten from scratch with the sysfs interface in mind.

-- 
Jean Delvare

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

end of thread, other threads:[~2005-07-22 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 15:41 [lm-sensors] [patches pc87360] printk-format, magic-init Jim Cromie
2005-07-22 15:58 ` Jim Cromie
  -- strict thread matches above, loose matches on Subject: below --
2005-07-22 21:20 Jean Delvare

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.