linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elia Devito <eliadevito@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Elia Devito <eliadevito@gmail.com>,
	Alex Hung <alex.hung@canonical.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <mgross@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/2] intel-hid: add alternative method to enable switches
Date: Fri,  4 Dec 2020 17:02:35 +0100	[thread overview]
Message-ID: <20201204160234.36832-1-elia@xvalue.it> (raw)
In-Reply-To: <20201203212000.35898-1-eliadevito@gmail.com>

From: Elia Devito <eliadevito@gmail.com>

Some convertible have unreliable VGBS return, in these cases we enable
support when receiving the first event.

Signed-off-by: Elia Devito <eliadevito@gmail.com>
---
 drivers/platform/x86/intel-hid.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index d2f892665ec6..054bc37da2cf 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -423,6 +423,19 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
 	struct platform_device *device = context;
 	struct intel_hid_priv *priv = dev_get_drvdata(&device->dev);
 	unsigned long long ev_index;
+	int err;
+
+	/*
+	 * Some convertible have unreliable VGBS return which could cause incorrect
+	 * SW_TABLET_MODE report, in these cases we enable support when receiving
+	 * the first event instead of during driver setup.
+	 */
+	if (!priv->switches && (event == 0xcc || event == 0xcd)) {
+		dev_info(&device->dev, "switch event received, enable switches supports\n");
+		err = intel_hid_switches_setup(device);
+		if (err)
+			pr_err("Failed to setup Intel HID switches\n");
+	}
 
 	if (priv->wakeup_mode) {
 		/*
-- 
2.28.0


  parent reply	other threads:[~2020-12-04 16:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 19:55 [PATCH 1/3] intel-hid: add support for SW_TABLET_MODE Elia Devito
2020-12-01 21:23 ` Hans de Goede
2020-12-03 21:20   ` [PATCH v2 1/2] " Elia Devito
2020-12-04 16:01     ` [PATCH v3 " Elia Devito
2020-12-07 16:49       ` Hans de Goede
2020-12-04 16:02     ` Elia Devito [this message]
2020-12-03 21:21   ` [PATCH v2 2/2] intel-hid: add alternative method to enable switches Elia Devito
2020-12-03 23:45     ` Barnabás Pőcze
2020-12-03 23:52       ` Barnabás Pőcze
2020-12-04 15:22       ` Elia Devito

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=20201204160234.36832-1-elia@xvalue.it \
    --to=eliadevito@gmail.com \
    --cc=alex.hung@canonical.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@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).