Re: [PATCH v2 4/7] HID: i2c-hid: elan: fix reset suspend current leakage

From: Doug Anderson
Date: Mon May 20 2024 - 11:38:54 EST


Hi,

On Mon, May 20, 2024 at 4:52 AM Johan Hovold <johan@xxxxxxxxxx> wrote:
>
> On Mon, May 20, 2024 at 01:44:06PM +0200, Johan Hovold wrote:
> > On Fri, May 10, 2024 at 04:36:08PM -0700, Doug Anderson wrote:
> > > On Tue, May 7, 2024 at 7:48 AM Johan Hovold <johan+linaro@xxxxxxxxxx> wrote:
>
> > > > @@ -67,7 +77,14 @@ static void elan_i2c_hid_power_down(struct i2chid_ops *ops)
> > > > struct i2c_hid_of_elan *ihid_elan =
> > > > container_of(ops, struct i2c_hid_of_elan, ops);
> > > >
> > > > - gpiod_set_value_cansleep(ihid_elan->reset_gpio, 1);
> > > > + /*
> > > > + * Do not assert reset when the hardware allows for it to remain
> > > > + * deasserted regardless of the state of the (shared) power supply to
> > > > + * avoid wasting power when the supply is left on.
> > > > + */
> > > > + if (!ihid_elan->no_reset_on_power_off)
> > > > + gpiod_set_value_cansleep(ihid_elan->reset_gpio, 1);
> > > > +
> > > > if (ihid_elan->chip_data->post_gpio_reset_off_delay_ms)
> > > > msleep(ihid_elan->chip_data->post_gpio_reset_off_delay_ms);
> > >
> > > Shouldn't the above two lines be inside the "if
> > > (!ihid_elan->no_reset_on_power_off)" test? If you're not setting the
> > > reset GPIO then you don't need to do the delay, right?
> >
> > Yes, I guess you're right. The off-delay is weird and not normally used,
> > but apparently it is needed by some panel-follower use case. AFAICT it's
> > not even related to the reset line, just a hack to add a delay before
> > the panel is reset by some other driver (see f2f43bf15d7a ("HID:
> > i2c-hid: elan: Add ili9882t timing")).
> >
> > I think that's why I just looked the other way and left this little
> > oddity here unchanged.
>
> Hit send too soon.
>
> Since this hack does not appear to be related to the reset line, I think
> it's correct to not have it depend on whether the reset line is asserted
> or not (e.g. as there could be 'panel-followers' with
> 'no_reset_on_power_off'):
>
> The datasheet specifies there should be 60ms between touch SDA
> sleep and panel RESX. Doug's series[1] allows panels and
> touchscreens to power on/off together, so we can add the 65 ms
> delay in i2c_hid_core_suspend before panel_unprepare.
>
> The power-off delay variable should probably be renamed, but that's a
> separate change.
>
> So I think v2 of this series is good to go.

Sure. As I think we've seen in the past, my choice of bikeshed paint
color seems to be quite different than yours, but nothing here seems
like it needs to block landing, so:

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>