Re: [PATCH V3] HID: HID-rmi - ignore to rmi_hid_read_block after system resumes.
From: Hans de Goede
Date: Thu Aug 11 2022 - 03:51:57 EST
Hi,
On 8/11/22 04:58, margeyang wrote:
> From: Marge Yang <marge.yang@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
>
> The interrupt GPIO will be pulled down once
> after RMI driver reads this command(Report ID:0x0A).
> It will cause "Dark resume test fail" for chromebook device.
> Hence, TP driver will ignore rmi_hid_read_block function once
> after system resumes.
>
> Signed-off-by: Marge Yang<marge.yang@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
Regards,
Hans
> ---
> drivers/hid/hid-rmi.c | 14 ++++++++++++--
> include/linux/rmi.h | 2 ++
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 311eee599ce9..fdaf2c4ce181 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -203,7 +203,13 @@ static int rmi_hid_read_block(struct rmi_transport_dev *xport, u16 addr,
> if (ret < 0)
> goto exit;
> }
> -
> + if (xport->ignoreonce == 1) {
> + dev_err(&hdev->dev,
> + "ignoreonce (%d)\n",
> + xport->ignoreonce);
> + xport->ignoreonce = 0;
> + goto exit;
> + }
> for (retries = 5; retries > 0; retries--) {
> data->writeReport[0] = RMI_READ_ADDR_REPORT_ID;
> data->writeReport[1] = 0; /* old 1 byte read count */
> @@ -468,8 +474,12 @@ static int rmi_post_resume(struct hid_device *hdev)
> ret = hid_hw_open(hdev);
> if (ret)
> return ret;
> -
> + // Avoid to read rmi_hid_read_block once after system resumes.
> + // The interrupt will be pulled down
> + // after RMI Read command(Report ID:0x0A).
> + data->xport.ignoreonce = 1;
> ret = rmi_reset_attn_mode(hdev);
> + data->xport.ignoreonce = 0;
> if (ret)
> goto out;
>
> diff --git a/include/linux/rmi.h b/include/linux/rmi.h
> index ab7eea01ab42..24f63ad00970 100644
> --- a/include/linux/rmi.h
> +++ b/include/linux/rmi.h
> @@ -270,6 +270,8 @@ struct rmi_transport_dev {
> struct rmi_device_platform_data pdata;
>
> struct input_dev *input;
> +
> + int ignoreonce;
> };
>
> /**