Re: Unexpected behavior of of_regulator_get()?
From: Mark Brown
Date: Thu Apr 30 2026 - 07:27:53 EST
On Thu, Apr 30, 2026 at 08:44:40AM +0200, Luca Weiss wrote:
> On Thu Apr 30, 2026 at 2:10 AM CEST, Mark Brown wrote:
> > On Wed, Apr 29, 2026 at 10:18:31AM +0200, Luca Weiss wrote:
> >> event-hall-sensor {
> >> label = "Hall Effect Sensor";
> >> vdd-supply = <&vreg_l10b>;
> >> };
> > I don't understand what this is supposed to describe.
> Such hall effect sensor requires power, so the IC has a VDD/VCC pin
Neither of which is "supply".
> which needs to be powered, in order for the GPIO of the IC to trigger,
> and that Linux can create an input event from it. So far this was mostly
> described in devicetree using regulator-always-on because the devicetree
> bindings & driver did not support that.
I think at the point where you're shoehorning a separate device into the
middle of a keyboard with a non-descriptive binding you're making
problems - at some point someone is going to try to shoehorn something
that has two supplies into the binding and everyone will be sad. These
sorts of attempts to describe regulators in a "standard" way that
doesn't correspond to the actual hardware generally cause problems like
the AHCI ones. I'd just make a separate input device here, you're
trying to solve a problem that you've actively created by not
representing the hardware.
> There's devm_regulator_get_optional() which gets a regulator for a given
> device (on the gpio-keys level), and my expectation of
> of_regulator_get() was that you point it at a devicetree node (e.g. the
> event-hall-sensor subnode and it grabs the regulator from that node, not
> from the parent (gpio-keys), nor from a different subnode of gpio-keys.
of_regulator_get() is not intended to be used by anything other than
framework code, the use case for a driver to use it would be that it's
got bindings that don't map well onto Linux or it's just made a mess of
it's bindings and needs to bodge it's way out of that situation.
Attachment:
signature.asc
Description: PGP signature