Re: [PATCH 2/2] HID: i2c-hid: goodix: Add support for powered-in-suspend property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sun, Apr 23, 2023 at 8:38 PM Jeff LaBundy <jeff@xxxxxxxxxxx> 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.




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux