From: Jonathan Cameron <jic23@kernel.org>
To: "chr[]" <chris@rudorff.com>
Cc: "Linus Walleij" <linusw@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 2/3] iio: light: gp2ap002: add led power supply
Date: Sun, 18 Oct 2026 18:56:19 +0100 [thread overview]
Message-ID: <20261018185619.2aa694da@jic23-hlaptop> (raw)
In-Reply-To: <d06d51cf-a53d-4bef-881e-cdcb4925a316@rudorff.com>
On Sun, 18 Oct 2026 16:41:48 +0200
"chr[]" <chris@rudorff.com> wrote:
> Hi,
>
> In preparation of v3:
>
> Am 17.10.26 um 20:00 schrieb Jonathan Cameron:
> > On Sat, 17 Oct 2026 19:27:42 +0200
> > Christoph Rudorff <chris@rudorff.com> wrote:
> >
> >> /* VIO should be between 1.65V and VDD */
> >> - ret = regulator_get_voltage(gp2ap002->vdd);
> >> + ret = regulator_get_voltage(gp2ap002->supplies[SUPPLY_VDD].consumer);
> >
> > Ah. I'd failed to register the voltages were being manually set (generally
> > we leave that to firmware in more modern drivers).
> > That rather reduces the advantage in using bulk regulators. Probably
> > still just about worth doing.
> >
>
> Yes, this is why I didn't made it in v1.
>
> >
> >> if (ret < 0) {
> >> dev_err(dev, "failed to get VDD voltage\n");
> >> return ret;
> >> }
> >> - ret = regulator_set_voltage(gp2ap002->vio, 1650000, ret);
> >> + ret = regulator_set_voltage(gp2ap002->supplies[SUPPLY_VIO].consumer, 1650000, ret);
> >> if (ret) {
> >> dev_err(dev, "failed to set VIO voltage\n");
> >> return ret;
> >> }
> >> + /* LED voltage 2.4V .. 3.6V according to datasheet */
> >> + /* We need to check this, as dummy or fixed controllers trigger an error. */
> > I'd make that a multiline comment and say what 'this' is.
> > /*
> > * LED voltage 2.4V .. 3.6V according to datasheet
> > * We need to check control is supported, as controlling dummy or fixed
> > * controllers results in an error.
> > */
> >
> > Do you actually need to control this for your board? I'm not that
> > keen to replicate the controlling of voltages if we don't have
> > to. We can't drop existing code as maybe a board is relying on it
> > but we can avoid adding new examples!
> >
>
> So we don't want to drop all the set_voltage code in general.
> My board does not need that at all, all voltages are already set
> to valid values in DT, ... I hope ... I check downstream ...
Unfortunately it would be a bit of a gamble to remove the in
driver voltage control on existing supplies. Given it works
for yours though let us not do it for the new one!
>
> So I skip the "example" for set_voltage(vled)?!
Exactly.
Jonathan
>
> And thanks for the advice to pretty up the code!
>
> chr[]
>
> >> @@ -632,9 +650,8 @@ static void gp2ap002_remove(struct i2c_client
> *client)>> pm_runtime_get_sync(dev);
> >> pm_runtime_put_noidle(dev);
> >> pm_runtime_disable(dev);
> >> + regulator_bulk_disable(NUM_SUPPLIES, gp2ap002->supplies);
> >
> > Why at that point in sequence? You are turning the power off
> > before removing the userspace interfaces which seems unlikely to
> > be race free. More generally it is no longer reverse of probe
> > order. If that is necessary for some reason I'd expect a comment
> > to say why.
> >
>
> Sorry, just a stupid mistake.
>
> >> iio_device_unregister(indio_dev);
> >> - regulator_disable(gp2ap002->vio);
> >> - regulator_disable(gp2ap002->vdd);
> >> }
> >
> >
>
next prev parent reply other threads:[~2026-10-18 17:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 17:27 [PATCH v2 0/3] MSM8916-mainline: improve gp2ap002 proximity sensor v2 Christoph Rudorff
2026-10-17 17:27 ` [PATCH v2 1/3] dt-bindings: iio: light: gp2ap002: add vled Christoph Rudorff
2026-10-17 18:02 ` Jonathan Cameron
2026-10-18 18:50 ` Conor Dooley
2026-10-18 22:07 ` Linus Walleij
2026-10-17 17:27 ` [PATCH v2 2/3] iio: light: gp2ap002: add led power supply Christoph Rudorff
2026-10-17 18:00 ` Jonathan Cameron
2026-10-18 14:41 ` chr[]
2026-10-18 17:56 ` Jonathan Cameron [this message]
2026-10-17 17:27 ` [PATCH v2 3/3] arm64: dts: qcom: msm8916-samsung-j5: Add proximity sensor Christoph Rudorff
2026-10-17 18:03 ` [PATCH v2 0/3] MSM8916-mainline: improve gp2ap002 proximity sensor v2 Jonathan Cameron
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=20261018185619.2aa694da@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andersson@kernel.org \
--cc=andy@kernel.org \
--cc=chris@rudorff.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@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
all inboxes | Powered by JetHome®