Lines Matching +full:input +full:- +full:no +full:- +full:autorepeat

1 // SPDX-License-Identifier: GPL-2.0-only
10 #include <linux/input.h>
23 MODULE_PARM_DESC(use_low_level_irq, "Use low-level triggered IRQ instead of edge triggered");
30 bool autorepeat; member
52 * Some 2-in-1s which use the soc_button_array driver have this ugly issue in
53 * their DSDT where the _LID method modifies the irq-type settings of the GPIOs
57 * problematic because when re-enabling the irq, which happens whenever _LID
59 * irq-type to IRQ_TYPE_LEVEL_LOW. Where as the gpio-keys driver programs the
61 * To work around this we don't set gpio_keys_button.gpio on these 2-in-1s,
69 * Acer Switch 10 SW5-012. _LID method messes with home- and
70 * power-button GPIO IRQ settings. When (re-)enabling the irq
72 * ones, leading to an irq-type of IRQ_TYPE_LEVEL_LOW |
77 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
81 /* Acer Switch V 10 SW5-017, same issue as Acer Switch 10 SW5-012. */
84 DMI_MATCH(DMI_PRODUCT_NAME, "SW5-017"),
89 * Acer One S1003. _LID method messes with power-button GPIO
90 * IRQ settings, leading to a non working power-button.
99 * Lenovo Yoga Tab2 1051F/1051L, something messes with the home-button
100 * IRQ settings, leading to a non working home-button.
120 * required by the lenovo-yogabook driver.
125 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
155 bool autorepeat) in soc_button_device_create() argument
162 int invalid_acpi_index = -1; in soc_button_device_create()
166 for (info = button_info; info->name; info++) in soc_button_device_create()
167 if (info->autorepeat == autorepeat) in soc_button_device_create()
170 gpio_keys_pdata = devm_kzalloc(&pdev->dev, in soc_button_device_create()
175 return ERR_PTR(-ENOMEM); in soc_button_device_create()
182 invalid_acpi_index = (long)dmi_id->driver_data; in soc_button_device_create()
184 for (info = button_info; info->name; info++) { in soc_button_device_create()
185 if (info->autorepeat != autorepeat) in soc_button_device_create()
188 if (info->acpi_index == invalid_acpi_index) in soc_button_device_create()
191 error = soc_button_lookup_gpio(&pdev->dev, info->acpi_index, &gpio, &irq); in soc_button_device_create()
195 * ignore -EPROBE_DEFER errors here. On some devices in soc_button_device_create()
202 * show up, therefore we ignore -EPROBE_DEFER. in soc_button_device_create()
208 if (!autorepeat && (use_low_level_irq || in soc_button_device_create()
212 gpio_keys[n_buttons].gpio = -ENOENT; in soc_button_device_create()
217 gpio_keys[n_buttons].type = info->event_type; in soc_button_device_create()
218 gpio_keys[n_buttons].code = info->event_code; in soc_button_device_create()
219 gpio_keys[n_buttons].active_low = info->active_low; in soc_button_device_create()
220 gpio_keys[n_buttons].desc = info->name; in soc_button_device_create()
221 gpio_keys[n_buttons].wakeup = info->wakeup; in soc_button_device_create()
228 error = -ENODEV; in soc_button_device_create()
232 gpio_keys_pdata->buttons = gpio_keys; in soc_button_device_create()
233 gpio_keys_pdata->nbuttons = n_buttons; in soc_button_device_create()
234 gpio_keys_pdata->rep = autorepeat; in soc_button_device_create()
236 pd = platform_device_register_resndata(&pdev->dev, "gpio-keys", in soc_button_device_create()
242 dev_err(&pdev->dev, in soc_button_device_create()
243 "failed registering gpio-keys: %d\n", error); in soc_button_device_create()
250 devm_kfree(&pdev->dev, gpio_keys_pdata); in soc_button_device_create()
256 if (obj->type != ACPI_TYPE_INTEGER) in soc_button_get_acpi_object_int()
257 return -1; in soc_button_get_acpi_object_int()
259 return obj->integer.value; in soc_button_get_acpi_object_int()
270 if (desc->type != ACPI_TYPE_PACKAGE || in soc_button_parse_btn_desc()
271 desc->package.count != 5 || in soc_button_parse_btn_desc()
273 soc_button_get_acpi_object_int(&desc->package.elements[0]) != 1 || in soc_button_parse_btn_desc()
275 soc_button_get_acpi_object_int(&desc->package.elements[2]) != in soc_button_parse_btn_desc()
278 return -ENODEV; in soc_button_parse_btn_desc()
281 info->event_type = EV_KEY; in soc_button_parse_btn_desc()
282 info->active_low = true; in soc_button_parse_btn_desc()
283 info->acpi_index = in soc_button_parse_btn_desc()
284 soc_button_get_acpi_object_int(&desc->package.elements[1]); in soc_button_parse_btn_desc()
285 upage = soc_button_get_acpi_object_int(&desc->package.elements[3]); in soc_button_parse_btn_desc()
286 usage = soc_button_get_acpi_object_int(&desc->package.elements[4]); in soc_button_parse_btn_desc()
289 * The UUID: fa6bd625-9ce8-470d-a2c7-b3ca36c4282e descriptors use HID in soc_button_parse_btn_desc()
292 * input reports and some buttons should generate wakeups where as in soc_button_parse_btn_desc()
299 info->name = "power"; in soc_button_parse_btn_desc()
300 info->event_code = KEY_POWER; in soc_button_parse_btn_desc()
301 info->wakeup = true; in soc_button_parse_btn_desc()
303 info->name = "airplane mode switch"; in soc_button_parse_btn_desc()
304 info->event_type = EV_SW; in soc_button_parse_btn_desc()
305 info->event_code = SW_RFKILL_ALL; in soc_button_parse_btn_desc()
306 info->active_low = false; in soc_button_parse_btn_desc()
308 info->name = "rotation lock switch"; in soc_button_parse_btn_desc()
309 info->event_type = EV_SW; in soc_button_parse_btn_desc()
310 info->event_code = SW_ROTATE_LOCK; in soc_button_parse_btn_desc()
312 info->name = "home"; in soc_button_parse_btn_desc()
313 info->event_code = KEY_LEFTMETA; in soc_button_parse_btn_desc()
314 info->wakeup = true; in soc_button_parse_btn_desc()
316 info->name = "volume_up"; in soc_button_parse_btn_desc()
317 info->event_code = KEY_VOLUMEUP; in soc_button_parse_btn_desc()
318 info->autorepeat = true; in soc_button_parse_btn_desc()
320 info->name = "volume_down"; in soc_button_parse_btn_desc()
321 info->event_code = KEY_VOLUMEDOWN; in soc_button_parse_btn_desc()
322 info->autorepeat = true; in soc_button_parse_btn_desc()
325 info->acpi_index, upage, usage); in soc_button_parse_btn_desc()
326 info->name = "unknown"; in soc_button_parse_btn_desc()
327 info->event_code = KEY_RESERVED; in soc_button_parse_btn_desc()
333 /* ACPI0011 _DSD btns descriptors UUID: fa6bd625-9ce8-470d-a2c7-b3ca36c4282e */
346 int i, btn, collection_uid = -1; in soc_button_get_button_info()
352 return ERR_PTR(-ENODEV); in soc_button_get_button_info()
357 for (i = 0; (i + 1) < desc->package.count; i += 2) { in soc_button_get_button_info()
358 uuid = &desc->package.elements[i]; in soc_button_get_button_info()
360 if (uuid->type != ACPI_TYPE_BUFFER || in soc_button_get_button_info()
361 uuid->buffer.length != 16 || in soc_button_get_button_info()
362 desc->package.elements[i + 1].type != ACPI_TYPE_PACKAGE) { in soc_button_get_button_info()
366 if (memcmp(uuid->buffer.pointer, btns_desc_uuid, 16) == 0) { in soc_button_get_button_info()
367 btns_desc = &desc->package.elements[i + 1]; in soc_button_get_button_info()
374 button_info = ERR_PTR(-ENODEV); in soc_button_get_button_info()
379 el0 = &btns_desc->package.elements[0]; in soc_button_get_button_info()
380 if (el0->type == ACPI_TYPE_PACKAGE && in soc_button_get_button_info()
381 el0->package.count == 5 && in soc_button_get_button_info()
383 soc_button_get_acpi_object_int(&el0->package.elements[0]) == 0 && in soc_button_get_button_info()
385 soc_button_get_acpi_object_int(&el0->package.elements[2]) == 0) { in soc_button_get_button_info()
387 &el0->package.elements[1]); in soc_button_get_button_info()
389 if (collection_uid == -1) { in soc_button_get_button_info()
391 button_info = ERR_PTR(-ENODEV); in soc_button_get_button_info()
395 /* There are package.count - 1 buttons + 1 terminating empty entry */ in soc_button_get_button_info()
396 button_info = devm_kcalloc(dev, btns_desc->package.count, in soc_button_get_button_info()
399 button_info = ERR_PTR(-ENOMEM); in soc_button_get_button_info()
404 for (i = 1, btn = 0; i < btns_desc->package.count; i++, btn++) { in soc_button_get_button_info()
406 &btns_desc->package.elements[i], in soc_button_get_button_info()
409 button_info = ERR_PTR(-ENODEV); in soc_button_get_button_info()
426 if (priv->children[i]) in soc_button_remove()
427 platform_device_unregister(priv->children[i]); in soc_button_remove()
432 struct device *dev = &pdev->dev; in soc_button_probe()
441 if (device_data && device_data->check) { in soc_button_probe()
442 error = device_data->check(dev); in soc_button_probe()
447 if (device_data && device_data->button_info) { in soc_button_probe()
448 button_info = device_data->button_info; in soc_button_probe()
457 dev_dbg(dev, "no GPIO attached, ignoring...\n"); in soc_button_probe()
458 return -ENODEV; in soc_button_probe()
463 return -ENOMEM; in soc_button_probe()
471 if (error != -ENODEV) { in soc_button_probe()
478 priv->children[i] = pd; in soc_button_probe()
481 if (!priv->children[0] && !priv->children[1]) in soc_button_probe()
482 return -ENODEV; in soc_button_probe()
484 if (!device_data || !device_data->button_info) in soc_button_probe()
519 * the PNP0C40 info except that the home button is active-high.
565 oem_platform_rev = result->integer.value; in soc_device_check_MSHW0040()
575 return -ENODEV; in soc_device_check_MSHW0040()
623 MODULE_DESCRIPTION("Windows-compatible SoC Button Array driver");