From: Guenter Roeck <linux@roeck-us.net>
To: Zev Weiss <zev@bewilderbeest.net>,
Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org
Cc: Andrew Jeffery <andrew@aj.id.au>,
openbmc@lists.ozlabs.org, Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: Enabling pmbus power control
Date: Tue, 30 Mar 2021 03:34:16 -0700 [thread overview]
Message-ID: <5105ada1-643a-8e58-a52d-d3c8dbef86b9@roeck-us.net> (raw)
In-Reply-To: <YGLepYLvtlO6Ikzs@hatter.bewilderbeest.net>
On 3/30/21 1:17 AM, Zev Weiss wrote:
>
> Hello,
>
> I'm working on a board that has a handful of LM25066 PMICs controlling
> the power supply to various devices, and I'd like to have both the
> existing hwmon sensor functionality as well as userspace power on/off
> control, which does not currently seem to be available (other than via
> 'i2cset -f', which I'd of course prefer to avoid). I've drafted up a
> couple possible versions of this, and was hoping to get some opinions
> on the appropriate overall approach.
>
> One option is to add a read-write sysfs attribute to the existing
> hwmon directory (current incarnation of the patch:
> https://thorn.bewilderbeest.net/~zev/patches/pmbus-statectl.patch).
> This bears a vague resemblance to a patch that was rejected a couple
> years ago
> (https://lore.kernel.org/linux-hwmon/20190417161817.GA13109@roeck-us.net/),
> but is different enough that I wonder if it might potentially be
> tolerable? (It exposes significantly less, for one thing.)
>
This is a no-go. We are not going to replicate regulator functionality
in the hwmon subsystem, no matter by what means.
> The other approach involves layering a regulator device over the pmbus
> device as is done in the LTC2978 driver, and then putting a
> reg-userspace-consumer on top of that (current patch:
> https://thorn.bewilderbeest.net/~zev/patches/pmbus-ureg.patch). My
This is the way to go, but the regulator descriptor (what is currently
CONFIG_PMBUS_USERSPACE_REGULATOR_CONSUMER) should be in the lm25066
driver. I don't want to pollute the pmbus core with that at this point
(and I don't know if the userspace consumer code is appropriate - you
might want to check with the regulator maintainer on that).
> first attempt at this ran into problems with all the
> reg-userspace-consumer instances getting attached to the first
> regulator device, I think due to all of the regulators ending up under
> the same name in the global namespace of regulator_map_list. I worked
> around that by adding an ID counter to produce a unique name for each,
> though that changes device names in userspace-visible ways that I'm
> not sure would be considered OK for backwards compatibility. (I'm not
> familiar enough with the regulator code to know if there's a better
> way of fixing that problem.) The #if-ing to keep it behind a Kconfig
Maybe ask that question on the regulator mailing list.
Guenter
> option is also kind of ugly as it stands.
>
> The first version seems simpler to me (and avoids the rather more
> cumbersome sysfs paths the second one produces, for what that's
> worth). I think the second is (at least structurally) perhaps more
> aligned with what Guenter was saying in the previous discussion linked
> above, though. Does anyone have any advice on the best way to proceed
> with this? If the reg-userspace-consumer approach is the preferred
> route, suggestions on a better fix for the name collision problem
> would be welcome.
>
>
> Thanks,
> Zev
>
next prev parent reply other threads:[~2021-03-30 10:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 8:17 Enabling pmbus power control Zev Weiss
2021-03-30 10:34 ` Guenter Roeck [this message]
2021-03-30 11:22 ` Mark Brown
2021-03-30 17:19 ` Zev Weiss
2021-03-30 17:42 ` Mark Brown
2021-03-30 17:56 ` Zev Weiss
2021-03-30 18:02 ` Mark Brown
2021-03-30 19:38 ` Guenter Roeck
2021-04-20 1:29 ` Zev Weiss
2021-04-20 3:36 ` Guenter Roeck
2021-04-20 5:50 ` Zev Weiss
2021-04-20 6:00 ` Guenter Roeck
2021-04-20 7:06 ` Zev Weiss
2021-04-20 10:52 ` Guenter Roeck
2021-04-20 15:19 ` Zev Weiss
2021-04-20 16:13 ` Mark Brown
2021-04-20 16:40 ` Zev Weiss
2021-04-20 17:15 ` Mark Brown
2021-04-20 18:54 ` Zev Weiss
2021-04-21 11:05 ` Mark Brown
2021-04-21 18:29 ` Zev Weiss
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=5105ada1-643a-8e58-a52d-d3c8dbef86b9@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew@aj.id.au \
--cc=broonie@kernel.org \
--cc=jdelvare@suse.com \
--cc=lgirdwood@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=zev@bewilderbeest.net \
/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).