[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=XnrSskS=0UKRGGPBxSnPYQtUkJeoBm44bDnwKVBHJLyA@mail.gmail.com>
Date: Mon, 24 Apr 2023 11:16:10 -0700
From: Doug Anderson <dianders@...omium.org>
To: Jeff LaBundy <jeff@...undy.com>
Cc: Fei Shao <fshao@...omium.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
linux-mediatek <linux-mediatek@...ts.infradead.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jiri Kosina <jikos@...nel.org>,
Matthias Kaehlcke <mka@...omium.org>,
Stephen Kitt <steve@....org>, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] HID: i2c-hid: goodix: Add support for
powered-in-suspend property
Hi,
On Sun, Apr 23, 2023 at 8:38 PM Jeff LaBundy <jeff@...undy.com> wrote:
>
> > @@ -37,13 +38,34 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops)
> > container_of(ops, struct i2c_hid_of_goodix, ops);
> > int ret;
> >
> > - ret = regulator_enable(ihid_goodix->vdd);
> > - if (ret)
> > - return ret;
> > -
> > - ret = regulator_enable(ihid_goodix->vddio);
> > - if (ret)
> > - return ret;
> > + /*
> > + * This is to ensure that the reset GPIO will be asserted and the
> > + * regulators will be enabled for all cases.
> > + */
> > + if (ihid_goodix->powered_in_suspend) {
> > + /*
> > + * This is not mandatory, but we assert reset here (instead of
> > + * in power-down) to ensure that the device will have a clean
> > + * state later on just like the normal scenarios would have.
> > + *
> > + * Also, since the regulators were not disabled in power-down,
> > + * we don't need to enable them here.
> > + */
> > + gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1);
> > + } else {
> > + /*
> > + * In this case, the reset is already asserted (either in
> > + * probe or power-down).
> > + * All we need is to enable the regulators.
> > + */
> > + ret = regulator_enable(ihid_goodix->vdd);
> > + if (ret)
> > + return ret;
> > +
> > + ret = regulator_enable(ihid_goodix->vddio);
> > + if (ret)
> > + return ret;
> > + }
>
> Please let me know in case I have misunderstood, but I don't see a need
> to change the regulator_enable/disable() logic if this property is set.
> If the regulators are truly always-on, the regulator core already knows
> what to do and we should not duplicate that logic here.
>
> Based on the alleged silicon erratum discussed in patch [1/2], it seems
> we only want to control the behavior of the reset GPIO. Therefore, only
> the calls to gpiod_set_value_cansleep() should be affected and the name
> of the property updated to reflect what it's actually doing.
This would be OK w/ me.
Powered by blists - more mailing lists