Re: [PATCH v3 4/4] pmbus_core: export coefficients via sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 14, 2019 at 07:38:33PM -0700, Guenter Roeck wrote:
>On 4/14/19 3:37 PM, Adamski, Krzysztof (Nokia - PL/Wroclaw) wrote:
>>On Sun, Apr 14, 2019 at 11:59:38PM +0200, Krzysztof Adamski wrote:
>>>PMBUS devices report values in real-world units. Those using direct
>>>format require conversion using standarised coefficients and formula.
>>>This operation is already done by pmbus_core and the default values for
>>>coefficients are configured by chip drivers.
>>>
>>>However those default values are not allways suitable as they depend on
>>>the value of sense register and environment used. For that reason, in
>>>order to get values that make sense or just to get best accuracy, in it
>>>may be required to tweak coefficient values. The proper values may be
>>>measured during device production (to get best accuracy, they might be
>>>callibrated for each individual unit) and stored as calibration values
>>>in some place (like EEPROM or even a file).
>>>
>>>To support wide range of possible use cases, lets export those to user
>>>space via sysfs attributes so that it can implement its own policies
>>>about them. All those attributes are put into separate attribute_group
>>>struct so that we can set its name to group all of them in a
>>>"coefficients" subdirectory in sysfs.
>>>
>>>Signed-off-by: Krzysztof Adamski <krzysztof.adamski@xxxxxxxxx>
>>>---
>>>drivers/hwmon/pmbus/pmbus_core.c | 104 ++++++++++++++++++++++++++++++-
>>>1 file changed, 102 insertions(+), 2 deletions(-)
>>>
>>
>>[...]
>>
>>>+	pmbus_dev_attr_init(&ext_attr->attr, name, (S_IWUSR | S_IRUGO),
>>
>>I screwed up and did not fix this also, sorry for that. I'm not sending
>>an updated version (yet) as I didn't get your approval for the concept
>>itself (though I still hope you will reconsider taking into account my
>>latest arguments).
>>
>
>I won't, sorry. As mentioned before, this is a generic problem that needs
>to be solved for all hwmon drivers, not just for pmbus devices, and also
>not just for pmbus devices using direct mode.
>
>Even worse, this doesn't even work for pmbus devices in general.
>PMBus supports commands such as VOUT_SCALE_LOOP and various other
>calibration commands such as VOUT_CAL_OFFSET, IOUT_CAL_GAIN and
>IOUT_CAL_OFFSET. Your approach doesn't even try to support those
>commands; you only look at r/m/b which may suit your needs but are
>hardly generic

I agree I don't see this problem as general as you. The mentioned
registers can easily be supported if needed by just attaching attributes
to them. That would allow doing things that cannot be done currently
(configuring precision of the regulation of the devices) while I see
coefficients problems as something totally different - more like a fix
to the already supported functionality (reporting current measurements).

> and even misleading since chip programming isn't adjusted even when
> that is possible.

I don't understand what you mean by that, could you explain?

>
>Addressing this problem in a generic way will require substantially
>more thought than just adding a couple of pmbus direct mode specific
>attributes.

I'm willing to put more effort into that but I would need to better
understand what is your view of the scope of problem here.

Krzysztof




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux