Skip to content

Commit cfae58e

Browse files
jwrdegoedeandy-shev
authored andcommitted
platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type
The HP Stream x360 11-p000nd no longer report SW_TABLET_MODE state / events with recent kernels. This model reports a chassis-type of 10 / "Notebook" which is not on the recently introduced chassis-type whitelist Commit de9647e ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a chassis-type whitelist and only listed 31 / "Convertible" as being capable of generating valid SW_TABLET_MOD events. Commit 1fac39f ("platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types") extended the whitelist with chassis-types 8 / "Portable" and 32 / "Detachable". And now we need to exten the whitelist again with 10 / "Notebook"... The issue original fixed by the whitelist is really a ACPI DSDT bug on the Dell XPS 9360 where it has a VGBS which reports it is in tablet mode even though it is not a 2-in-1 at all, but a regular laptop. So since this is a workaround for a DSDT issue on that specific model, instead of extending the whitelist over and over again, lets switch to a blacklist and only blacklist the chassis-type of the model for which the chassis-type check was added. Note this also fixes the current version of the code no longer checking if dmi_get_system_info(DMI_CHASSIS_TYPE) returns NULL. Fixes: 1fac39f ("platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types") Cc: Mario Limonciello <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 8fe63eb commit cfae58e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

drivers/platform/x86/intel-vbtn.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,18 @@ static bool intel_vbtn_has_buttons(acpi_handle handle)
170170
static bool intel_vbtn_has_switches(acpi_handle handle)
171171
{
172172
const char *chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
173-
unsigned long chassis_type_int;
174173
unsigned long long vgbs;
175174
acpi_status status;
176175

177-
if (kstrtoul(chassis_type, 10, &chassis_type_int))
178-
return false;
179-
180-
switch (chassis_type_int) {
181-
case 8: /* Portable */
182-
case 31: /* Convertible */
183-
case 32: /* Detachable */
184-
break;
185-
default:
176+
/*
177+
* Some normal laptops have a VGBS method despite being non-convertible
178+
* and their VGBS method always returns 0, causing detect_tablet_mode()
179+
* to report SW_TABLET_MODE=1 to userspace, which causes issues.
180+
* These laptops have a DMI chassis_type of 9 ("Laptop"), do not report
181+
* switches on any devices with a DMI chassis_type of 9.
182+
*/
183+
if (chassis_type && strcmp(chassis_type, "9") == 0)
186184
return false;
187-
}
188185

189186
status = acpi_evaluate_integer(handle, "VGBS", NULL, &vgbs);
190187
return ACPI_SUCCESS(status);

0 commit comments

Comments
 (0)