Skip to content

Commit 20a99a2

Browse files
jwrdegoededtor
authored andcommitted
Input: soc_button_array - add invalid acpi_index DMI quirk handling
Some devices have a wrong entry in their button array which points to a GPIO which is required in another driver, so soc_button_array must not claim it. A specific example of this is the Lenovo Yoga Book X90F / X90L, where the PNP0C40 home button entry points to a GPIO which is not a home button and which is required by the lenovo-yogabook driver. Add a DMI quirk table which can specify an ACPI GPIO resource index which should be skipped; and add an entry for the Lenovo Yoga Book X90F / X90L to this new DMI quirk table. Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 978134c commit 20a99a2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/input/misc/soc_button_array.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,27 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = {
108108
{} /* Terminating entry */
109109
};
110110

111+
/*
112+
* Some devices have a wrong entry which points to a GPIO which is
113+
* required in another driver, so this driver must not claim it.
114+
*/
115+
static const struct dmi_system_id dmi_invalid_acpi_index[] = {
116+
{
117+
/*
118+
* Lenovo Yoga Book X90F / X90L, the PNP0C40 home button entry
119+
* points to a GPIO which is not a home button and which is
120+
* required by the lenovo-yogabook driver.
121+
*/
122+
.matches = {
123+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
124+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
125+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
126+
},
127+
.driver_data = (void *)1l,
128+
},
129+
{} /* Terminating entry */
130+
};
131+
111132
/*
112133
* Get the Nth GPIO number from the ACPI object.
113134
*/
@@ -137,6 +158,8 @@ soc_button_device_create(struct platform_device *pdev,
137158
struct platform_device *pd;
138159
struct gpio_keys_button *gpio_keys;
139160
struct gpio_keys_platform_data *gpio_keys_pdata;
161+
const struct dmi_system_id *dmi_id;
162+
int invalid_acpi_index = -1;
140163
int error, gpio, irq;
141164
int n_buttons = 0;
142165

@@ -154,10 +177,17 @@ soc_button_device_create(struct platform_device *pdev,
154177
gpio_keys = (void *)(gpio_keys_pdata + 1);
155178
n_buttons = 0;
156179

180+
dmi_id = dmi_first_match(dmi_invalid_acpi_index);
181+
if (dmi_id)
182+
invalid_acpi_index = (long)dmi_id->driver_data;
183+
157184
for (info = button_info; info->name; info++) {
158185
if (info->autorepeat != autorepeat)
159186
continue;
160187

188+
if (info->acpi_index == invalid_acpi_index)
189+
continue;
190+
161191
error = soc_button_lookup_gpio(&pdev->dev, info->acpi_index, &gpio, &irq);
162192
if (error || irq < 0) {
163193
/*

0 commit comments

Comments
 (0)