mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
platform/x86/intel: hid: Add DMI switches allow list
Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE reports. Add an allow list and accept such reports only from devices in it. Bug reported for Dell XPS 17 9710 on: https://gitlab.freedesktop.org/libinput/libinput/-/issues/662 Reported-by: Tobias Gurtzick <magic@wizardtales.com> Suggested-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Tobias Gurtzick <magic@wizardtales.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://lore.kernel.org/r/20210920160312.9787-1-jose.exposito89@gmail.com [hdegoede@redhat.com: Check dmi_switches_auto_add_allow_list only once] Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
5b72dafaca
commit
b201cb0ebe
@ -118,12 +118,30 @@ static const struct dmi_system_id dmi_vgbs_allow_list[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
/*
|
||||
* Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE
|
||||
* reports. Accept such reports only from devices in this list.
|
||||
*/
|
||||
static const struct dmi_system_id dmi_auto_add_switch[] = {
|
||||
{
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */),
|
||||
},
|
||||
},
|
||||
{
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */),
|
||||
},
|
||||
},
|
||||
{} /* Array terminator */
|
||||
};
|
||||
|
||||
struct intel_hid_priv {
|
||||
struct input_dev *input_dev;
|
||||
struct input_dev *array;
|
||||
struct input_dev *switches;
|
||||
bool wakeup_mode;
|
||||
bool dual_accel;
|
||||
bool auto_add_switch;
|
||||
};
|
||||
|
||||
#define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
|
||||
@ -452,10 +470,8 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
|
||||
* 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.
|
||||
*
|
||||
* See dual_accel_detect.h for more info on the dual_accel check.
|
||||
*/
|
||||
if (!priv->switches && !priv->dual_accel && (event == 0xcc || event == 0xcd)) {
|
||||
if (!priv->switches && priv->auto_add_switch && (event == 0xcc || event == 0xcd)) {
|
||||
dev_info(&device->dev, "switch event received, enable switches supports\n");
|
||||
err = intel_hid_switches_setup(device);
|
||||
if (err)
|
||||
@ -596,7 +612,8 @@ static int intel_hid_probe(struct platform_device *device)
|
||||
return -ENOMEM;
|
||||
dev_set_drvdata(&device->dev, priv);
|
||||
|
||||
priv->dual_accel = dual_accel_detect();
|
||||
/* See dual_accel_detect.h for more info on the dual_accel check. */
|
||||
priv->auto_add_switch = dmi_check_system(dmi_auto_add_switch) && !dual_accel_detect();
|
||||
|
||||
err = intel_hid_input_setup(device);
|
||||
if (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user