hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/input/misc/soc_button_array.c
....@@ -109,6 +109,27 @@
109109 };
110110
111111 /*
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
+
132
+/*
112133 * Get the Nth GPIO number from the ACPI object.
113134 */
114135 static int soc_button_lookup_gpio(struct device *dev, int acpi_index,
....@@ -137,6 +158,8 @@
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 @@
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 /*