Skip to contentSkip to conversation

negative voltages (was Re: [BK PATCH] i2c driver fixes for

DISCUSSION Mark M. Hoffman 2 participants 2 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

(trimmed CC list - we can report back to LKML with conclusion)

Quoted 8 lines
Quoted 8 lines · J.A. Magallon
Quoted 7 lines

Oops, not so good:

Quoted 2 lines
-12V:     -12.18 V  (min = -12.57 V, max = -11.35 V)    ALARM
-5V:       -4.96 V  (min =  -5.25 V, max =  -4.74 V)    ALARM

Why ALARM ?

<trimmed>

Quoted 8 lines · Jean Delvare

What Mark says is perfectly true as a generic remark, but this isn't the problem here. The problem is that the limits of negative voltages are swapped. Internally, the low limit is the one nearer from 0, i.e. the lesser in absolute value. Your output shows the contrary.

This is a bug in the driver, or libsensors, or both. We have to take a look at this really soon. This is on my to-do list for some times already, just gimme some more time.

There is no bug in the driver, *nor* (I think) in libsensors...

Nevermind sensors(1) or libsensors for a moment. With my w83781d, I see this:

/sys/.../in_max5 => 3.616V
/sys/.../in_input5 => 3.328V
/sys/.../in_min5 => 3.264V

This scenario shows no alarm, nor should it. This represents the voltage at the pin of the w83781d. Making no assumptions about what in5 is, this is the correct and logical conclusion.

Using sensors(1), I see this:

-12V: -11.57 V (min = -11.35 V, max = -12.57 V)

But it can't be that min > max, so how to fix it? Since changing the driver has been ruled out...

If we reverse the sense of min/max in libsensors, that leads to the undesirable effect of in_max5 modifying /sys/.../in_min5. But worse, what if in5 is a positive voltage on a given board? Oops, now we broke it for them.

If anything, what is needed in sensors.conf is a "negative voltage" flag which can signal the situtation to the library so it can be handled correctly.

Or, we can just document that min/max are absolute values and be done with it. That would force a review of all 2.4 drivers that might have reversed voltages (are there any?), but that's my vote... comments?

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]
#1 lore raw
Quoted 1 line

There is no bug in the driver, *nor* (I think) in libsensors...

This would explain why I couldn't find any in either place ;)

Quoted 10 lines

Nevermind sensors(1) or libsensors for a moment. With my w83781d, I see this:

/sys/.../in_max5 => 3.616V
/sys/.../in_input5 => 3.328V
/sys/.../in_min5 => 3.264V

This scenario shows no alarm, nor should it. This represents the voltage at the pin of the w83781d. Making no assumptions about what in5 is, this is the correct and logical conclusion.

Same observations made on an AS99127F here some times ago.

Quoted 6 lines

Using sensors(1), I see this:

-12V: -11.57 V (min = -11.35 V, max = -12.57 V)

But it can't be that min > max, so how to fix it? Since changing the driver has been ruled out...

The line above doesn't make me fill sick at all. I personally don't expect min to be greater than max for a negative voltage.

Quoted 4 lines

If we reverse the sense of min/max in libsensors, that leads to the undesirable effect of in_max5 modifying /sys/.../in_min5. But worse, what if in5 is a positive voltage on a given board? Oops, now we broke it for them.

Obviously this is the choice that was made in 2.4. I don't know why it was made however. The incoming trouble was obvious, and I don't see much benefit, if any.

The problem is, I couldn't find in the 2.4 w83781d driver, nor in libsensors, nor in sensors, where the min and max are swapped, although the values are swapped in sensors.conf and it *does* work correctly with this combination of driver and user-space stuff. Can anyone point me to the place where the swapping is done?

Quoted 3 lines

If anything, what is needed in sensors.conf is a "negative voltage" flag which can signal the situtation to the library so it can be handled correctly.

This would mean changing the file format. Much trouble for nothing IMHO.

Quoted 2 lines

Or, we can just document that min/max are absolute values and be done with it. That would force a review of all 2.4 drivers that

might

Quoted 2 lines

have reversed voltages (are there any?), but that's my vote... comments?

I completely agree with you on this. Chips don't work with negative voltages internally. Min and max are meant for absolute values. I don't see why it should trouble the user. It should sound very logical to the newcomer that -13V is a stronger voltage than -11V, since what matters are voltage differences, not intrinsic values. Let's stick to that for the sake of simplicity.

However, I would much like to hear MDS on that topic, because I feel like we are missing something important. There's an interesting change in sensors.conf.eg about two years ago with the following log:

----------------------------
revision 1.67
date: 2002/01/31 00:43:14; author: mds; state: Exp; lines: +27 -16 (mds) flip 'set' limits for negative voltages for those chips
with non-inverting 'compute' lines:
782d, 783s, 627hf, 697hf, and it87.
Min should be -12 * 1.05, max is -12 * 0.95, for example. Ticket 800 - part 1 of fix.
----------------------------

Link to the above-mentioned ticket:
http://secure.netroedge.com/~lm78/readticket.cgi?ticket€0

Definitely worth reading. This clearly divides the chips in two categories, which (it says) should be handled differently. I can't really see why. If we stick to the internal representation used by the chips, I'd expect no special treatment to be needed.

If the only reason for this mess is so that min is always numerically less than max in sensors' output, it's not worth the trouble IMHO and everything should be cleaned up in that respect.

Unless I'm missing something, of course. Any insight appreciated.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/