Linux Input/HID development
 help / color / mirror / Atom feed
From: margeyang <marge.yang@synaptics.corp-partner.google.com>
To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: marge.yang@tw.synaptics.com, derek.chegn@tw.synaptcs.com,
	vincent.huang@tw.synaptics.com,
	Marge Yang <marge.yang@synaptics.corp-partner.google.com>
Subject: [PATCH] Input: HID-rmi - ignore to rmi_hid_read_block after system resumes.
Date: Mon,  1 Aug 2022 14:46:43 +0800	[thread overview]
Message-ID: <1659336403-2546-1-git-send-email-marge.yang@synaptics.corp-partner.google.com> (raw)

From: Marge Yang <marge.yang@synaptics.corp-partner.google.com>

ignore to rmi_hid_read_block function once after system resumes.
Because

Signed-off-by: Marge Yang<marge.yang@synaptics.corp-partner.google.com>
---
 drivers/hid/hid-rmi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 311eee599ce9..1b038f3db0f1 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -101,7 +101,7 @@ struct rmi_data {
 };
 
 #define RMI_PAGE(addr) (((addr) >> 8) & 0xff)
-
+int ignoreonce;
 static int rmi_write_report(struct hid_device *hdev, u8 *report, int len);
 
 /**
@@ -203,7 +203,13 @@ static int rmi_hid_read_block(struct rmi_transport_dev *xport, u16 addr,
 		if (ret < 0)
 			goto exit;
 	}
-
+	if (ignoreonce == 1) {
+		dev_err(&hdev->dev,
+			"ignoreonce (%d)\n",
+			ignoreonce);
+		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,7 +474,10 @@ 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).
+	ignoreonce = 1;
 	ret = rmi_reset_attn_mode(hdev);
 	if (ret)
 		goto out;
-- 
2.22.0.windows.1


             reply	other threads:[~2022-08-01  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  6:46 margeyang [this message]
2022-08-15  8:16 ` [PATCH] Input: HID-rmi - ignore to rmi_hid_read_block after system resumes Dan Carpenter
2022-08-15 10:24   ` Marge Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1659336403-2546-1-git-send-email-marge.yang@synaptics.corp-partner.google.com \
    --to=marge.yang@synaptics.corp-partner.google.com \
    --cc=derek.chegn@tw.synaptcs.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marge.yang@tw.synaptics.com \
    --cc=vincent.huang@tw.synaptics.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox