All of lore.kernel.org
 help / color / mirror / Atom feed
* PMBus driver for FSP/3Y Power device with non-standard VOUT values (LINEAR11 vs LINEAR16)
@ 2019-03-13 12:31 Grönke, Christian
  2019-03-13 15:19 ` Guenter Roeck
  0 siblings, 1 reply; 14+ messages in thread
From: Grönke, Christian @ 2019-03-13 12:31 UTC (permalink / raw)
  To: linux-hwmon; +Cc: Guenter Roeck

Hello all,

I am currently working on a hwmon/pmbus driver for a PMBus capable 3Y Power/FSP power supply (YH5301-1EAR).

The datasheet has limited information. But with the help of some online sources, other datasheets from the vendor and the pmbus sub-system I could figure out most of it.

However, I did run in some troubles with the VOUT values. To my understanding (and from what I could validate) the device does encode _all_ values as "LINEAR11". Meaning all values have a mantissa of 11 bit and the exponent in the other 5 bits of the register word. This causes some troubles with the read out of the VOUT registers (e.g. READ_VOUT). The pmbus subsystem expects these values to be in "LINEAR16" encoding. Hence the full word register is the mantissa and the exponent is supposed to be in VOUT_MODE.
Sadly, the VOUT_MODE register isn't supported. It reads 0xFF.

In my first attempt to work around this, I provided a custom read_word_data function that would fixup the value. However, that did lead to problems with negative values and also had a precision loss (12,09V -> 12V). I tried to compensate by faking the values as 'direct' and adjusting the m/b/R values to match. This is also not perfect, as it is messy and also seems to report the wrong values in some cases.

I think the best solution would be to prevent pmbus (more specifically 'pmbus_reg2data_linear') to treat the obtained value as LINEAR16. A quick hack shows me that this would work with all the reported values of the device. However, this means proving da vendor/device specific workaround by changing a generic component.

I am not sure how you feel about this. Ultimately, I'd like to upstream the driver (and potential fix), so I would like to find a solution that is fine with you all.

My current proposal would be to introduce a flag in pmbus_platform_data.flags that allows to disable the LINEAR16 switch in case the sensor has the class PSC_VOLTAGE_OUT. At least this seems the change with the smallest impact. I am not sure how to name the flag but to propose something I'd say 'PMBUS_VOUT_IS_LINEAR11'

What do you think?

Kind regards
Christian

-- 

Christian GRÖNKE

INFODAS GmbH ~ Rhonestraße 2 ~ 50765 Köln ~ Germany
Phone: +49 221 70912 187 ~ Mail: c.groenke@infodas.de

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

end of thread, other threads:[~2019-03-16 15:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 12:31 PMBus driver for FSP/3Y Power device with non-standard VOUT values (LINEAR11 vs LINEAR16) Grönke, Christian
2019-03-13 15:19 ` Guenter Roeck
2019-03-13 16:20   ` AW: " Grönke, Christian
2019-03-13 16:30     ` Guenter Roeck
2019-03-13 17:35       ` AW: " Grönke, Christian
2019-03-14  3:18         ` Guenter Roeck
2019-03-14 16:08           ` AW: " Grönke, Christian
2019-03-14 16:22             ` Guenter Roeck
2019-03-14 16:53             ` Guenter Roeck
2019-03-15 10:19               ` AW: " Grönke, Christian
2019-03-15 18:29                 ` Guenter Roeck
2019-03-15 19:38                   ` Guenter Roeck
2019-03-16 15:27                     ` Guenter Roeck
2019-03-13 16:21   ` Guenter Roeck

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.