* pmbus: dealing with unsigned mantissa in linear reading
@ 2021-06-15 23:34 Chris Packham
2021-06-16 1:46 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Chris Packham @ 2021-06-15 23:34 UTC (permalink / raw)
To: Guenter Roeck, Jean Delvare; +Cc: linux-hwmon, linux-kernel
Hi Guenter,
I've had a report from someone testing the BPA-RS600.
When they have the input voltage set to >= 256V (apparently the PSU can
handle input up to 264V). The Vin reading goes negative.
CMD 0x88, VAL=0xf3f8, Vin=254
CMD 0x88, VAL=0xf3fc, Vin=255
CMD 0x88, VAL=0xf400, Vin=-256
Looking at pmbus_reg2data_linear() the mantissa is cast to s16 which is
correct according to section 7.1 of the PMBUS spec which says that the
mantissa is an 11-bit two's complement value.
It seems that the BPA-RS600 is using a non-standard format for the
mantissa (probably because the range of the standard linear encoding
can't support values >255V). Does the pmbus infrastructure provide a way
for me to define a custom format/conversion for a given sensor?
Thanks,
Chris
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pmbus: dealing with unsigned mantissa in linear reading
2021-06-15 23:34 pmbus: dealing with unsigned mantissa in linear reading Chris Packham
@ 2021-06-16 1:46 ` Guenter Roeck
2021-06-16 1:57 ` Chris Packham
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2021-06-16 1:46 UTC (permalink / raw)
To: Chris Packham; +Cc: Jean Delvare, linux-hwmon, linux-kernel
On Tue, Jun 15, 2021 at 11:34:53PM +0000, Chris Packham wrote:
> Hi Guenter,
>
> I've had a report from someone testing the BPA-RS600.
>
> When they have the input voltage set to >= 256V (apparently the PSU can
> handle input up to 264V). The Vin reading goes negative.
>
> CMD 0x88, VAL=0xf3f8, Vin=254
> CMD 0x88, VAL=0xf3fc, Vin=255
> CMD 0x88, VAL=0xf400, Vin=-256
>
> Looking at pmbus_reg2data_linear() the mantissa is cast to s16 which is
> correct according to section 7.1 of the PMBUS spec which says that the
> mantissa is an 11-bit two's complement value.
>
> It seems that the BPA-RS600 is using a non-standard format for the
> mantissa (probably because the range of the standard linear encoding
> can't support values >255V). Does the pmbus infrastructure provide a way
> for me to define a custom format/conversion for a given sensor?
Essentially you'll have to implement a custom read word function and
convert the value reported by the power supply to a valid linear11
value. In this case, you may have to shift the reported value by 1 bit
and increase the exponent by one.
Not sure what you mean with "standard linear encoding can't support values
>255V". Why not ? That is what the exponent is for, after all. It rather
seems to me that the PS vendor decided to violate the standard to get
another bit of accuracy.
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pmbus: dealing with unsigned mantissa in linear reading
2021-06-16 1:46 ` Guenter Roeck
@ 2021-06-16 1:57 ` Chris Packham
0 siblings, 0 replies; 3+ messages in thread
From: Chris Packham @ 2021-06-16 1:57 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, linux-kernel
On 16/06/21 1:46 pm, Guenter Roeck wrote:
> On Tue, Jun 15, 2021 at 11:34:53PM +0000, Chris Packham wrote:
>> Hi Guenter,
>>
>> I've had a report from someone testing the BPA-RS600.
>>
>> When they have the input voltage set to >= 256V (apparently the PSU can
>> handle input up to 264V). The Vin reading goes negative.
>>
>> CMD 0x88, VAL=0xf3f8, Vin=254
>> CMD 0x88, VAL=0xf3fc, Vin=255
>> CMD 0x88, VAL=0xf400, Vin=-256
>>
>> Looking at pmbus_reg2data_linear() the mantissa is cast to s16 which is
>> correct according to section 7.1 of the PMBUS spec which says that the
>> mantissa is an 11-bit two's complement value.
>>
>> It seems that the BPA-RS600 is using a non-standard format for the
>> mantissa (probably because the range of the standard linear encoding
>> can't support values >255V). Does the pmbus infrastructure provide a way
>> for me to define a custom format/conversion for a given sensor?
> Essentially you'll have to implement a custom read word function and
> convert the value reported by the power supply to a valid linear11
> value. In this case, you may have to shift the reported value by 1 bit
> and increase the exponent by one.
OK I'll look at doing that. I already have bpa_rs600_read_word_data() so
I can hook in there.
> Not sure what you mean with "standard linear encoding can't support values
Yeah I figured that out after I sent the email. There are a few ways of
representing >256V in a standard conforming way.
>> 255V". Why not ? That is what the exponent is for, after all. It rather
> seems to me that the PS vendor decided to violate the standard to get
> another bit of accuracy.
Indeed that seems to be the case.
> Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-16 1:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 23:34 pmbus: dealing with unsigned mantissa in linear reading Chris Packham
2021-06-16 1:46 ` Guenter Roeck
2021-06-16 1:57 ` Chris Packham
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.