linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zev Weiss <zev@bewilderbeest.net>
To: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>
Cc: Zev Weiss <zev@bewilderbeest.net>,
	openbmc@lists.ozlabs.org, Rob Herring <robh+dt@kernel.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Jean Delvare <jdelvare@suse.com>,
	devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: [PATCH 0/4] misc: Add power-efuse driver
Date: Thu, 17 Feb 2022 02:44:40 -0800	[thread overview]
Message-ID: <20220217104444.7695-1-zev@bewilderbeest.net> (raw)

Hello,

This patch series is another incarnation of some previous efforts [0]
at enabling userspace access to the OPERATION state (and now status
flags) of PMBus devices, specifically with respect to efuses
protecting general-purpose power outputs.  This functionality is an
important component enabling a port of OpenBMC to the Delta AHE-50DC
Open19 power shelf [1].

The first patch extends the pmbus core's regulator support with an
implementation of the .get_error_flags() operation, mapping PMBus
status flags to REGULATOR_ERROR_* flags where possible, and the second
patch adds regulator support for the lm25066 driver.  These two
patches are essentially independent of the power-efuse driver (and
each other) and could potentially be applicable individually, but are
necessary for the power-efuse driver to be useful on the AHE-50DC.

The third and fourth patches add dt-bindings and the implementation of
the power-efuse driver, respectively.  The driver is fairly simple; it
merely provides a sysfs interface to enable, disable, and retrieve
error flags from an underlying regulator.

There is one aspect of its usage of the regulator API I'm a bit
uncertain about, however: this driver seems like a case where an
exclusive 'get' of the regulator (i.e. devm_regulator_get_exclusive()
instead of devm_regulator_get() in efuse_probe()) would be
appropriate, since in the intended usage no other device should be
using an efuse's regulator.  With an exclusive get though, the
regulator's use_count and the consumer's enable_count don't balance
out properly to allow the enable/disable operations to work properly
(the former ending up one more than the latter, leading to
enable_count underflows on attempts to disable the regulator).  So at
least for now it's using a non-exclusive get -- I'd be happy to hear
any pointers on a way to allow an exclusive get to work here, though.


Thanks,
Zev

[0] https://lore.kernel.org/openbmc/YGLepYLvtlO6Ikzs@hatter.bewilderbeest.net/
[1] https://www.open19.org/marketplace/delta-16kw-power-shelf/

Zev Weiss (4):
  hwmon: (pmbus) Add get_error_flags support to regulator ops
  hwmon: (pmbus) lm25066: Add regulator support
  dt-bindings: Add power-efuse binding
  misc: Add power-efuse driver

 .../devicetree/bindings/misc/power-efuse.yaml |  37 +++
 MAINTAINERS                                   |   5 +
 drivers/hwmon/pmbus/Kconfig                   |   7 +
 drivers/hwmon/pmbus/lm25066.c                 |  14 ++
 drivers/hwmon/pmbus/pmbus_core.c              |  97 ++++++++
 drivers/misc/Kconfig                          |  15 ++
 drivers/misc/Makefile                         |   1 +
 drivers/misc/power-efuse.c                    | 221 ++++++++++++++++++
 8 files changed, 397 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yaml
 create mode 100644 drivers/misc/power-efuse.c

-- 
2.35.1


             reply	other threads:[~2022-02-17 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 10:44 Zev Weiss [this message]
2022-02-17 10:44 ` [PATCH 1/4] hwmon: (pmbus) Add get_error_flags support to regulator ops Zev Weiss
2022-02-17 18:11   ` Guenter Roeck
2022-02-17 23:37     ` Zev Weiss
2022-02-18  0:02       ` Guenter Roeck
2022-02-18  0:23         ` Zev Weiss
2022-02-17 10:44 ` [PATCH 2/4] hwmon: (pmbus) lm25066: Add regulator support Zev Weiss
2022-02-17 10:44 ` [PATCH 3/4] dt-bindings: Add power-efuse binding Zev Weiss
2022-02-17 16:39   ` Rob Herring
2022-02-17 22:35   ` Rob Herring
2022-02-18  0:17     ` Zev Weiss
2022-02-17 10:44 ` [PATCH 4/4] misc: Add power-efuse driver Zev Weiss
2022-02-17 13:34   ` Greg Kroah-Hartman
2022-02-17 22:53     ` Zev Weiss
2022-02-17 18:14 ` [PATCH 0/4] " Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217104444.7695-1-zev@bewilderbeest.net \
    --to=zev@bewilderbeest.net \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdelvare@suse.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).