linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] pmbus: extend configurability via sysfs
@ 2019-04-13 16:02 Adamski, Krzysztof (Nokia - PL/Wroclaw)
  0 siblings, 0 replies; only message in thread
From: Adamski, Krzysztof (Nokia - PL/Wroclaw) @ 2019-04-13 16:02 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: linux-hwmon, Sverdlin, Alexander (Nokia - DE/Ulm)

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-13 16:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13 16:02 [PATCH v2 0/3] pmbus: extend configurability via sysfs Adamski, Krzysztof (Nokia - PL/Wroclaw)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).