[PATCH v2 0/3] pmbus: extend configurability via sysfs

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

 



Hi,

I'm posting updated version of this patchet. I think first two patches
implement things in the way that where suggested by Guenter (using
PMBUS_VIRT_*). I have to admit, I like this better than using custom
sysfs approach from v1.

I'm also posting updated version of the patch exporting coefficients
even though it was not liked by Guenter. I hope you could reconsider as
I think your arguments would be completely valid if it was "raw" hwmon
device but for pmbus devices, values are already reported in real-world
units and all drivers using "direct" mode uses those coefficients and
the only way userspace could adjust those reported values knowing proper
coefficients would be to also know the coefficients used and basically
reverse the calculations made by kernel and made them with proper
coeffs. While doable, I don't find this elegant or practical. If we
already do conversion in the kernel, I think there should be a way to
make sure this conversion produces sane values.

This patch series extends pmbus core for two specific use cases we have:
- First two patches allows lm25066 driver to set number of samples for
  average values (by controlling manufacturer specific SAMPLES_FOR_AVG
  register). It is useful to be able to set this register when using any
  of the *_average registers, especially since the default value means
  we are averaging 1 sample which isn't that useful.
- Third patch exports m, b, R coefficients so that they can be adjusted
  by user space. We can't use default coefficients values and in order
  to achieve high accuracy, we calibrate then per unit so using
  device-tree or similar concepts (which are generally shared by all
  board of the same type) to store them is not an option too. Thus, we
  export it so that the logic of loading proper coeffs can be
  implemented in user space instead.

v2 changes:
- PMBUS_VIRT_* registers used instead of custom sysfs groups for
  configuring samples for average
- coeffs are only exported as sysfs attirbutes if the format used is
  "direct"
- fixed memory allocation issue in coeffs patch

Krzysztor Adamski (3):
  pmbus: introduce PMBUS_VIRT_*_SAMPLES registers
  lm25066: support SAMPLES_FOR_AVG register
  pmbus_core: export coefficients via sysfs

 Documentation/hwmon/sysfs-interface |  18 +++
 drivers/hwmon/pmbus/lm25066.c       |  15 +-
 drivers/hwmon/pmbus/pmbus.h         |  15 ++
 drivers/hwmon/pmbus/pmbus_core.c    | 213 +++++++++++++++++++++++++++-
 4 files changed, 258 insertions(+), 3 deletions(-)

-- 
2.20.1





[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