From: Stefan Sichler <stsichler@web.de>
To: jorgealtxwork@gmail.com
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v5 2/4] Fix SW_TABLET_MODE detection method
Date: Thu, 8 Aug 2024 23:46:09 +0200 [thread overview]
Message-ID: <703cfb2e-6973-421a-9602-657e03ba6105@web.de> (raw)
In-Reply-To: <20220310210853.28367-3-jorge.lopez2@hp.com>
Hi,
this patch (which is now committed to the kernel as commit
520ee4ea1cc60251a6e3c911cf0336278aa52634 since v5.18-rc1) unfortunately
introduced a regression on my HP EliteBook 2760p Convertible:
Tablet mode is no longer detected.
It worked flawlessly before (when enable_tablet_mode_sw module param was
set to 1).
Debugging showed that on this device, two problems prevent the table
mode detection from working:
- Chassis Type is reported as 0x10 (= Lunch Box)
- the query of HPWMI_SYSTEM_DEVICE_MODE does not report tablet state
at all
Note that the chassis type of this device (switch to tablet mode by
screen *rotation*) actually differs from the newer HP models (switch to
tablet mode by screen *flipping*).
I suggest fixing this by re-adding the removed module parameter
"enable_tablet_mode_sw", but change its behavior to work in the
following way:
- when left at default -1 (auto): no change to current (new)
implementation
- when set to 0: unconditionally disable table mode reporting at all
- when set to 1: ignore Chassis type and use old-skool
hp_wmi_hw_state(HPWMI_TABLET_MASK) query method to determine tablet mode
in addition to new hp_wmi_perform_query(HPWMI_SYSTEM_DEVICE_MODE...) method
I prepared a patch based on commit
520ee4ea1cc60251a6e3c911cf0336278aa52634, and tested it successfully on
my device.
See below.
Regards,
Stefan
--- hp-wmi.c.orig 2024-03-10 21:38:09.000000000 +0100
+++ hp-wmi.c 2024-08-08 09:23:29.509113900 +0200
@@ -35,6 +35,10 @@
MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
+static int enable_tablet_mode_sw = -1;
+module_param(enable_tablet_mode_sw, int, 0444);
+MODULE_PARM_DESC(enable_tablet_mode_sw, "Enable SW_TABLET_MODE
reporting (-1=auto, 0=no, 1=yes)");
+
#define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
#define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
#define HP_OMEN_EC_THERMAL_PROFILE_OFFSET 0x95
@@ -428,6 +432,9 @@
bool tablet_found;
int ret;
+ if (!enable_tablet_mode_sw)
+ return -ENODEV;
+
chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
if (!chassis_type)
return -ENODEV;
@@ -435,16 +442,24 @@
tablet_found = match_string(tablet_chassis_types,
ARRAY_SIZE(tablet_chassis_types),
chassis_type) >= 0;
- if (!tablet_found)
+ if (!tablet_found && enable_tablet_mode_sw < 0 /*auto*/)
return -ENODEV;
ret = hp_wmi_perform_query(HPWMI_SYSTEM_DEVICE_MODE, HPWMI_READ,
system_device_mode, zero_if_sup(system_device_mode),
sizeof(system_device_mode));
- if (ret < 0)
- return ret;
+ if (ret >= 0)
+ ret = (system_device_mode[0] == DEVICE_MODE_TABLET);
+
+ /* workaround for older convertibles */
+ if (ret <= 0 && enable_tablet_mode_sw > 0)
+ {
+ ret = hp_wmi_read_int(HPWMI_HARDWARE_QUERY);
+ if (!(ret < 0))
+ ret = !!(ret & HPWMI_TABLET_MASK);
+ }
- return system_device_mode[0] == DEVICE_MODE_TABLET;
+ return ret;
}
static int omen_thermal_profile_set(int mode)
next prev parent reply other threads:[~2024-08-08 21:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 21:08 [PATCH v5 0/4] Fix SW_TABLET_MODE detection method Jorge Lopez
2022-03-10 21:08 ` [PATCH v5 1/4] Fix hp_wmi_read_int() reporting error (0x05) Jorge Lopez
2022-03-14 10:41 ` Hans de Goede
2022-03-10 21:08 ` [PATCH v5 2/4] Fix SW_TABLET_MODE detection method Jorge Lopez
2022-03-14 10:44 ` Hans de Goede
2024-08-08 21:46 ` Stefan Sichler [this message]
2024-08-13 14:34 ` Ilpo Järvinen
2024-08-19 16:41 ` Stefan Sichler
2022-03-10 21:08 ` [PATCH v5 3/4] Fix 0x05 error code reported by several WMI calls Jorge Lopez
2022-03-14 10:44 ` Hans de Goede
2022-03-10 21:08 ` [PATCH v5 4/4] Changing bios_args.data to be dynamically allocated Jorge Lopez
2022-03-14 10:51 ` Hans de Goede
2022-03-14 11:33 ` Hans de Goede
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=703cfb2e-6973-421a-9602-657e03ba6105@web.de \
--to=stsichler@web.de \
--cc=jorgealtxwork@gmail.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