linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
To: Jiri Kosina <jikos@kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Benjamin Tissoires <bentiss@kernel.org>,
	Bryan.Kemp@dell.com, laurentiu.tudor1@dell.com,
	Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
Subject: [PATCH v2 1/2] HID: i2c-hid: introduce re-power-on quirk
Date: Thu, 31 Oct 2024 08:31:41 +0100	[thread overview]
Message-ID: <20241031073419.9189-2-alex.vinarskis@gmail.com> (raw)
In-Reply-To: <20241031073419.9189-1-alex.vinarskis@gmail.com>

It appears some keyboards from vendor 'QTEC' will not work properly until
suspend & resume.

Empirically narrowed down to solution of re-sending power on command
_after_ initialization was completed before the end of initial probing.

Signed-off-by: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 43664a24176f..ad386ae878ef 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -51,6 +51,7 @@
 #define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET	BIT(4)
 #define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND	BIT(5)
 #define I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME BIT(6)
+#define I2C_HID_QUIRK_RE_POWER_ON		BIT(7)
 
 /* Command opcodes */
 #define I2C_HID_OPCODE_RESET			0x01
@@ -1069,7 +1070,11 @@ static int i2c_hid_core_register_hid(struct i2c_hid *ihid)
 		return ret;
 	}
 
-	return 0;
+	/* At least some QTEC devices need this after initialization */
+	if (ihid->quirks & I2C_HID_QUIRK_RE_POWER_ON)
+		ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON);
+
+	return ret;
 }
 
 static int i2c_hid_core_probe_panel_follower(struct i2c_hid *ihid)
-- 
2.45.2


  reply	other threads:[~2024-10-31  7:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  7:31 [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Aleksandrs Vinarskis
2024-10-31  7:31 ` Aleksandrs Vinarskis [this message]
2024-10-31  7:31 ` [PATCH v2 2/2] HID: i2c-hid: introduce qtec vendor, enable re-power-on quirk Aleksandrs Vinarskis
2024-10-31 16:26 ` [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Tudor, Laurentiu
2024-12-11 14:06 ` Jiri Kosina

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=20241031073419.9189-2-alex.vinarskis@gmail.com \
    --to=alex.vinarskis@gmail.com \
    --cc=Bryan.Kemp@dell.com \
    --cc=bentiss@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=jikos@kernel.org \
    --cc=laurentiu.tudor1@dell.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).