RE: [PATCH] Input: elan_i2c - Implement inhibit/uninhibit functions.

From: Jingle.Wu
Date: Thu Apr 27 2023 - 22:22:17 EST


Hi Dmitry:
During the initial process and when the users open/close device,
having the elan uninhibit/inhibit commands (low power mode) was not what
Elan expects to happen. Due to that touchpad would do the calibration in
uninhibit moment , we don't want the calibration to be affected by fingers
on the touchpad.
However, the LID inhibit/uninhibit functions in the Linux kernel
driver calls open/close(), so we need to separate the inhibit/uninhibit
behavior from open/close() function

https://elixir.bootlin.com/linux/latest/source/drivers/input/input.c#L1783

https://elixir.bootlin.com/linux/latest/source/drivers/input/input.c#L1813

THANKS
JINGLE

-----Original Message-----
From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@xxxxxxxxx]
Sent: Thursday, April 27, 2023 6:58 AM
To: Jingle.Wu <jingle.wu@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-input@xxxxxxxxxxxxxxx;
phoenix@xxxxxxxxxx; josh.chen@xxxxxxxxxx; dave.wang@xxxxxxxxxx
Subject: Re: [PATCH] Input: elan_i2c - Implement inhibit/uninhibit
functions.

Hi Jingle,

On Mon, Apr 10, 2023 at 09:26:04AM +0800, Jingle.Wu wrote:
> HI Dmitry:
>
> > +static void elan_close(struct input_dev *input_dev) {
> > + if ((input_dev->users) && (!input_dev->inhibited))
> > + elan_inhibit(input_dev);
>
> This check is for "only inhibit request", and elan_open() its check is
> for "only uninhibit request".
> Because input_dev-> open() close() will be executed 2-3 times when
initial.

I do not see why this would be an issue if what you are doing is putting the
device into a low power mode.

If this issue is about need to re-calibrate after opening the lid on certain
devices, then I think we need to do the same that we did for the I2C-HID
connected devices on Redrix and hook this functionality to a LID handler.

Thanks.

--
Dmitry