Lines Matching +full:button +full:-
1 // SPDX-License-Identifier: GPL-2.0+
3 * Intel HID event & 5 button array driver
12 #include <linux/input/sparse-keymap.h>
30 /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */
31 /* 2: Toggle SW_ROTATE_LOCK -- easy to implement if seen in wild */
40 /* 13 has two different meanings in the spec -- ignore it. */
48 /* 27: wake -- needs special handling */
52 /* 5 button array notification value. */
98 #define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
192 *result = obj->integer.value; in intel_hid_evaluate_method()
217 intel_hid_dsm_fn_mask = *obj->buffer.pointer; in intel_hid_init_dsm()
229 /* Enable|disable features - power button is always enabled */ in intel_hid_set_enable()
234 return -EIO; in intel_hid_set_enable()
247 if (!priv->array) in intel_button_array_enable()
253 dev_warn(device, "failed to get button capability\n"); in intel_button_array_enable()
257 /* Enable|disable features - power button is always enabled */ in intel_button_array_enable()
260 dev_warn(device, "failed to set button capability\n"); in intel_button_array_enable()
268 priv->wakeup_mode = true; in intel_hid_pm_prepare()
277 priv->wakeup_mode = false; in intel_hid_pm_complete()
313 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_hid_input_setup()
316 priv->input_dev = devm_input_allocate_device(&device->dev); in intel_hid_input_setup()
317 if (!priv->input_dev) in intel_hid_input_setup()
318 return -ENOMEM; in intel_hid_input_setup()
320 ret = sparse_keymap_setup(priv->input_dev, intel_hid_keymap, NULL); in intel_hid_input_setup()
324 priv->input_dev->name = "Intel HID events"; in intel_hid_input_setup()
325 priv->input_dev->id.bustype = BUS_HOST; in intel_hid_input_setup()
327 return input_register_device(priv->input_dev); in intel_hid_input_setup()
332 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_button_array_input_setup()
335 /* Setup input device for 5 button array */ in intel_button_array_input_setup()
336 priv->array = devm_input_allocate_device(&device->dev); in intel_button_array_input_setup()
337 if (!priv->array) in intel_button_array_input_setup()
338 return -ENOMEM; in intel_button_array_input_setup()
340 ret = sparse_keymap_setup(priv->array, intel_array_keymap, NULL); in intel_button_array_input_setup()
344 priv->array->name = "Intel HID 5 button array"; in intel_button_array_input_setup()
345 priv->array->id.bustype = BUS_HOST; in intel_button_array_input_setup()
347 return input_register_device(priv->array); in intel_button_array_input_setup()
353 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in notify_handler()
356 if (priv->wakeup_mode) { in notify_handler()
358 * Needed for wakeup from suspend-to-idle to work on some in notify_handler()
359 * platforms that don't expose the 5-button array, but still in notify_handler()
360 * send notifies with the power button event code to this in notify_handler()
361 * device object on power button actions while suspended. in notify_handler()
366 /* Wake up on 5-button array events only. */ in notify_handler()
367 if (event == 0xc0 || !priv->array) in notify_handler()
370 if (!sparse_keymap_entry_from_scancode(priv->array, event)) { in notify_handler()
371 dev_info(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
376 pm_wakeup_hard_event(&device->dev); in notify_handler()
382 * the 5-button array, but still send notifies with power button in notify_handler()
383 * event code to this device object on power button actions. in notify_handler()
385 * Report the power button press and release. in notify_handler()
387 if (!priv->array) { in notify_handler()
389 input_report_key(priv->input_dev, KEY_POWER, 1); in notify_handler()
390 input_sync(priv->input_dev); in notify_handler()
395 input_report_key(priv->input_dev, KEY_POWER, 0); in notify_handler()
396 input_sync(priv->input_dev); in notify_handler()
401 /* 0xC0 is for HID events, other values are for 5 button array */ in notify_handler()
403 if (!priv->array || in notify_handler()
404 !sparse_keymap_report_event(priv->array, event, 1, true)) in notify_handler()
405 dev_dbg(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
411 dev_warn(&device->dev, "failed to get event index\n"); in notify_handler()
415 if (!sparse_keymap_report_event(priv->input_dev, ev_index, 1, true)) in notify_handler()
416 dev_dbg(&device->dev, "unknown event index 0x%llx\n", in notify_handler()
422 acpi_handle handle = ACPI_HANDLE(&device->dev); in button_array_present()
427 /* Check presence of 5 button array or v2 power button */ in button_array_present()
446 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_probe()
455 dev_warn(&device->dev, "failed to read mode\n"); in intel_hid_probe()
456 return -ENODEV; in intel_hid_probe()
465 dev_info(&device->dev, "platform is not in simple mode\n"); in intel_hid_probe()
466 return -ENODEV; in intel_hid_probe()
469 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); in intel_hid_probe()
471 return -ENOMEM; in intel_hid_probe()
472 dev_set_drvdata(&device->dev, priv); in intel_hid_probe()
480 /* Setup 5 button array */ in intel_hid_probe()
482 dev_info(&device->dev, "platform supports 5 button array\n"); in intel_hid_probe()
485 pr_err("Failed to setup Intel 5 button array hotkeys\n"); in intel_hid_probe()
493 return -EBUSY; in intel_hid_probe()
495 err = intel_hid_set_enable(&device->dev, true); in intel_hid_probe()
499 if (priv->array) { in intel_hid_probe()
502 intel_button_array_enable(&device->dev, true); in intel_hid_probe()
504 /* Call button load method to enable HID power button */ in intel_hid_probe()
507 dev_warn(&device->dev, in intel_hid_probe()
508 "failed to enable HID power button\n"); in intel_hid_probe()
512 device_init_wakeup(&device->dev, true); in intel_hid_probe()
529 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_remove()
531 device_init_wakeup(&device->dev, false); in intel_hid_remove()
533 intel_hid_set_enable(&device->dev, false); in intel_hid_remove()
534 intel_button_array_enable(&device->dev, false); in intel_hid_remove()
545 .name = "intel-hid",
575 dev_info(&dev->dev, in check_acpi_dev()
576 "intel-hid: created platform device\n"); in check_acpi_dev()