platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
@ 2021-08-12 14:55 Hans de Goede
  2021-08-12 14:55 ` [PATCH 2/2] platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s Hans de Goede
  2021-08-12 14:56 ` [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2021-08-12 14:55 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

Unfortunately we have been unable to find a reliable way to detect if
and how SW_TABLET_MODE reporting is supported, so we are relying on
DMI quirks for this.

Add a module-option to specify the SW_TABLET_MODE method so that this can
be easily tested without needing to rebuild the kernel.

BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 0cb927f0f301..9929eedf7dd8 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -41,6 +41,10 @@ static int wapf = -1;
 module_param(wapf, uint, 0444);
 MODULE_PARM_DESC(wapf, "WAPF value");
 
+static int tablet_mode_sw = -1;
+module_param(tablet_mode_sw, uint, 0444);
+MODULE_PARM_DESC(tablet_mode_sw, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip");
+
 static struct quirk_entry *quirks;
 
 static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
@@ -477,6 +481,21 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
 	else
 		wapf = quirks->wapf;
 
+	switch (tablet_mode_sw) {
+	case 0:
+		quirks->use_kbd_dock_devid = false;
+		quirks->use_lid_flip_devid = false;
+		break;
+	case 1:
+		quirks->use_kbd_dock_devid = true;
+		quirks->use_lid_flip_devid = false;
+		break;
+	case 2:
+		quirks->use_kbd_dock_devid = false;
+		quirks->use_lid_flip_devid = true;
+		break;
+	}
+
 	if (quirks->i8042_filter) {
 		ret = i8042_install_filter(quirks->i8042_filter);
 		if (ret) {
-- 
2.31.1


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

* [PATCH 2/2] platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
  2021-08-12 14:55 [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede
@ 2021-08-12 14:55 ` Hans de Goede
  2021-08-12 14:56 ` [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-08-12 14:55 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

The Asus TP200s / E205SA 360 degree hinges 2-in-1 supports reporting
SW_TABLET_MODE info through the ASUS_WMI_DEVID_LID_FLIP WMI device-id.
Add a quirk to enable this.

BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 9929eedf7dd8..a81dc4b191b7 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -462,6 +462,15 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_use_lid_flip_devid,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS TP200s / E205SA",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "E205SA"),
+		},
+		.driver_data = &quirk_asus_use_lid_flip_devid,
+	},
 	{},
 };
 
-- 
2.31.1


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

* Re: [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
  2021-08-12 14:55 [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede
  2021-08-12 14:55 ` [PATCH 2/2] platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s Hans de Goede
@ 2021-08-12 14:56 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-08-12 14:56 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko; +Cc: platform-driver-x86

Hi All,

On 8/12/21 4:55 PM, Hans de Goede wrote:
> Unfortunately we have been unable to find a reliable way to detect if
> and how SW_TABLET_MODE reporting is supported, so we are relying on
> DMI quirks for this.
> 
> Add a module-option to specify the SW_TABLET_MODE method so that this can
> be easily tested without needing to rebuild the kernel.
> 
> BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I've added this series to my review-hans and the pdx86/fixes branches
now (the patches were already tested by the bug reporter before I posted
them).

Regards,

Hans


> ---
>  drivers/platform/x86/asus-nb-wmi.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
> index 0cb927f0f301..9929eedf7dd8 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -41,6 +41,10 @@ static int wapf = -1;
>  module_param(wapf, uint, 0444);
>  MODULE_PARM_DESC(wapf, "WAPF value");
>  
> +static int tablet_mode_sw = -1;
> +module_param(tablet_mode_sw, uint, 0444);
> +MODULE_PARM_DESC(tablet_mode_sw, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip");
> +
>  static struct quirk_entry *quirks;
>  
>  static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
> @@ -477,6 +481,21 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
>  	else
>  		wapf = quirks->wapf;
>  
> +	switch (tablet_mode_sw) {
> +	case 0:
> +		quirks->use_kbd_dock_devid = false;
> +		quirks->use_lid_flip_devid = false;
> +		break;
> +	case 1:
> +		quirks->use_kbd_dock_devid = true;
> +		quirks->use_lid_flip_devid = false;
> +		break;
> +	case 2:
> +		quirks->use_kbd_dock_devid = false;
> +		quirks->use_lid_flip_devid = true;
> +		break;
> +	}
> +
>  	if (quirks->i8042_filter) {
>  		ret = i8042_install_filter(quirks->i8042_filter);
>  		if (ret) {
> 


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

end of thread, other threads:[~2021-08-12 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 14:55 [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede
2021-08-12 14:55 ` [PATCH 2/2] platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s Hans de Goede
2021-08-12 14:56 ` [PATCH 1/2] platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option Hans de Goede

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).