All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] HID: i2c-hid: Add I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON to optimize timing
@ 2021-05-18  1:37 Johnny Chuang
  2021-05-18 18:31 ` Harry Cutts
  0 siblings, 1 reply; 2+ messages in thread
From: Johnny Chuang @ 2021-05-18  1:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Benjamin Tissoires, Peter Hutterer,
	linux-kernel, linux-input, Harry Cutts, Johnny Chuang
  Cc: James Chen, Jennifer Tsai, Paul Liang, Jeff Chuang,
	Douglas Anderson, Jingle, Paris Yeh, sukumar . ghorai

There is a hard coding 60ms delay after I2C_HID_PWR_ON commadn.
Elan didn't need the delay, so we add a quirk to reduce boot time and resume time.

Fixed: eef4016243e9("HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands")

Signed-off-by: Johnny Chuang <johnny.chuang.emc@gmail.com>
---
Change in v2:
    - Modify Optimized tag to Fixed tag
    - Modify comment for i2c_hid_quirks
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 9993133..f4ee690 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -45,6 +45,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME		BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE		BIT(6)
+#define I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON	BIT(8)
 
 
 /* flags */
@@ -178,6 +179,11 @@ static const struct i2c_hid_quirks {
 		 I2C_HID_QUIRK_RESET_ON_RESUME },
 	{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
 		I2C_HID_QUIRK_BAD_INPUT_SIZE },
+	/*
+	 * Elan devices don't need delay after I2C_HID_PWR_ON
+	 */
+	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
+		 I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON },
 	{ 0, 0 }
 };
 
@@ -427,7 +433,8 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
 	 * PWR_ON requests. Testing has confirmed that several devices
 	 * will not work properly without a delay after a PWR_ON request.
 	 */
-	if (!ret && power_state == I2C_HID_PWR_ON)
+	if (!ret && power_state == I2C_HID_PWR_ON &&
+	    !(ihid->quirks & I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON))
 		msleep(60);
 
 	return ret;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] HID: i2c-hid: Add I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON to optimize timing
  2021-05-18  1:37 [PATCH v2] HID: i2c-hid: Add I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON to optimize timing Johnny Chuang
@ 2021-05-18 18:31 ` Harry Cutts
  0 siblings, 0 replies; 2+ messages in thread
From: Harry Cutts @ 2021-05-18 18:31 UTC (permalink / raw)
  To: Johnny Chuang
  Cc: Dmitry Torokhov, Benjamin Tissoires, Peter Hutterer, lkml,
	linux-input, Johnny Chuang, James Chen, Jennifer Tsai,
	Paul Liang, Jeff Chuang, Douglas Anderson, Jingle, Paris Yeh,
	sukumar . ghorai

On Mon, 17 May 2021 at 18:37, Johnny Chuang <johnny.chuang.emc@gmail.com> wrote:
>
> There is a hard coding 60ms delay after I2C_HID_PWR_ON commadn.
> Elan didn't need the delay, so we add a quirk to reduce boot time and resume time.
>
> Fixed: eef4016243e9("HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands")
>
> Signed-off-by: Johnny Chuang <johnny.chuang.emc@gmail.com>

Reviewed-by: Harry Cutts <hcutts@chromium.org>

> ---
> Change in v2:
>     - Modify Optimized tag to Fixed tag
>     - Modify comment for i2c_hid_quirks
> ---
>  drivers/hid/i2c-hid/i2c-hid-core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
> index 9993133..f4ee690 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-core.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-core.c
> @@ -45,6 +45,7 @@
>  #define I2C_HID_QUIRK_BOGUS_IRQ                        BIT(4)
>  #define I2C_HID_QUIRK_RESET_ON_RESUME          BIT(5)
>  #define I2C_HID_QUIRK_BAD_INPUT_SIZE           BIT(6)
> +#define I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON    BIT(8)
>
>
>  /* flags */
> @@ -178,6 +179,11 @@ static const struct i2c_hid_quirks {
>                  I2C_HID_QUIRK_RESET_ON_RESUME },
>         { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
>                 I2C_HID_QUIRK_BAD_INPUT_SIZE },
> +       /*
> +        * Elan devices don't need delay after I2C_HID_PWR_ON
> +        */
> +       { USB_VENDOR_ID_ELAN, HID_ANY_ID,
> +                I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON },
>         { 0, 0 }
>  };
>
> @@ -427,7 +433,8 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
>          * PWR_ON requests. Testing has confirmed that several devices
>          * will not work properly without a delay after a PWR_ON request.
>          */
> -       if (!ret && power_state == I2C_HID_PWR_ON)
> +       if (!ret && power_state == I2C_HID_PWR_ON &&
> +           !(ihid->quirks & I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON))
>                 msleep(60);
>
>         return ret;
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-18 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18  1:37 [PATCH v2] HID: i2c-hid: Add I2C_HID_QUIRK_NO_DELAY_AFTER_PWR_ON to optimize timing Johnny Chuang
2021-05-18 18:31 ` Harry Cutts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.