Lines Matching +full:long +full:- +full:press
1 // SPDX-License-Identifier: GPL-2.0+
12 #include <linux/input/sparse-keymap.h>
21 TABLET_SW_AUTO = -1,
31 "If you need this please report this to: platform-driver-x86@vger.kernel.org");
36 "Enable SW_TABLET_MODE reporting -1:auto 0:off 1:at-first-event 2:at-probe. "
37 "If you need this please report this to: platform-driver-x86@vger.kernel.org");
64 /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */
65 /* 2: Toggle SW_ROTATE_LOCK -- easy to implement if seen in wild */
74 /* 13 has two different meanings in the spec -- ignore it. */
82 /* 27: wake -- needs special handling */
88 { KE_KEY, 0xC2, { KEY_LEFTMETA } }, /* Press */
90 { KE_KEY, 0xC4, { KEY_VOLUMEUP } }, /* Press */
92 { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* Press */
94 { KE_KEY, 0xC8, { KEY_ROTATE_LOCK_TOGGLE } }, /* Press */
96 { KE_KEY, 0xCE, { KEY_POWER } }, /* Press */
155 * Some convertible use the intel-hid ACPI interface to report SW_TABLET_MODE,
164 DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible 15-df0xxx"),
207 #define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
236 static unsigned long long intel_hid_dsm_fn_mask;
241 unsigned long long arg) in intel_hid_execute_method()
282 unsigned long long *result) in intel_hid_evaluate_method()
301 *result = obj->integer.value; in intel_hid_evaluate_method()
326 switch (obj->buffer.length) { in intel_hid_init_dsm()
329 intel_hid_dsm_fn_mask = *(u16 *)obj->buffer.pointer; in intel_hid_init_dsm()
332 intel_hid_dsm_fn_mask = *obj->buffer.pointer; in intel_hid_init_dsm()
350 /* Enable|disable features - power button is always enabled */ in intel_hid_set_enable()
353 return -EIO; in intel_hid_set_enable()
363 unsigned long long button_cap; in intel_button_array_enable()
366 if (!priv->array) in intel_button_array_enable()
376 /* Enable|disable features - power button is always enabled */ in intel_button_array_enable()
387 priv->wakeup_mode = true; in intel_hid_pm_prepare()
396 priv->wakeup_mode = false; in intel_hid_pm_complete()
432 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_hid_input_setup()
435 priv->input_dev = devm_input_allocate_device(&device->dev); in intel_hid_input_setup()
436 if (!priv->input_dev) in intel_hid_input_setup()
437 return -ENOMEM; in intel_hid_input_setup()
439 ret = sparse_keymap_setup(priv->input_dev, intel_hid_keymap, NULL); in intel_hid_input_setup()
443 priv->input_dev->name = "Intel HID events"; in intel_hid_input_setup()
444 priv->input_dev->id.bustype = BUS_HOST; in intel_hid_input_setup()
446 return input_register_device(priv->input_dev); in intel_hid_input_setup()
451 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_button_array_input_setup()
455 priv->array = devm_input_allocate_device(&device->dev); in intel_button_array_input_setup()
456 if (!priv->array) in intel_button_array_input_setup()
457 return -ENOMEM; in intel_button_array_input_setup()
459 ret = sparse_keymap_setup(priv->array, intel_array_keymap, NULL); in intel_button_array_input_setup()
463 priv->array->name = "Intel HID 5 button array"; in intel_button_array_input_setup()
464 priv->array->id.bustype = BUS_HOST; in intel_button_array_input_setup()
466 return input_register_device(priv->array); in intel_button_array_input_setup()
471 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_hid_switches_setup()
474 priv->switches = devm_input_allocate_device(&device->dev); in intel_hid_switches_setup()
475 if (!priv->switches) in intel_hid_switches_setup()
476 return -ENOMEM; in intel_hid_switches_setup()
478 __set_bit(EV_SW, priv->switches->evbit); in intel_hid_switches_setup()
479 __set_bit(SW_TABLET_MODE, priv->switches->swbit); in intel_hid_switches_setup()
481 priv->switches->name = "Intel HID switches"; in intel_hid_switches_setup()
482 priv->switches->id.bustype = BUS_HOST; in intel_hid_switches_setup()
483 return input_register_device(priv->switches); in intel_hid_switches_setup()
488 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in report_tablet_mode_state()
489 acpi_handle handle = ACPI_HANDLE(&device->dev); in report_tablet_mode_state()
490 unsigned long long vgbs; in report_tablet_mode_state()
497 input_report_switch(priv->switches, SW_TABLET_MODE, m); in report_tablet_mode_state()
498 input_sync(priv->switches); in report_tablet_mode_state()
523 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in notify_handler()
524 unsigned long long ev_index; in notify_handler()
533 if (!priv->switches && enable_sw_tablet_mode == TABLET_SW_AT_EVENT && in notify_handler()
535 dev_info(&device->dev, "switch event received, enable switches supports\n"); in notify_handler()
541 if (priv->wakeup_mode) { in notify_handler()
543 * Needed for wakeup from suspend-to-idle to work on some in notify_handler()
544 * platforms that don't expose the 5-button array, but still in notify_handler()
552 * Some devices send (duplicate) tablet-mode events when moved in notify_handler()
559 report_tablet_mode_event(priv->switches, event); in notify_handler()
563 /* Wake up on 5-button array events only. */ in notify_handler()
564 if (event == 0xc0 || !priv->array) in notify_handler()
567 ke = sparse_keymap_entry_from_scancode(priv->array, event); in notify_handler()
569 dev_info(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
573 if (ke->type == KE_IGNORE) in notify_handler()
577 pm_wakeup_hard_event(&device->dev); in notify_handler()
584 * the 5-button array, but still send notifies with power button in notify_handler()
587 * Report the power button press and release. in notify_handler()
589 if (!priv->array) { in notify_handler()
591 input_report_key(priv->input_dev, KEY_POWER, 1); in notify_handler()
592 input_sync(priv->input_dev); in notify_handler()
597 input_report_key(priv->input_dev, KEY_POWER, 0); in notify_handler()
598 input_sync(priv->input_dev); in notify_handler()
603 if (report_tablet_mode_event(priv->switches, event)) in notify_handler()
608 if (!priv->array || in notify_handler()
609 !sparse_keymap_report_event(priv->array, event, 1, true)) in notify_handler()
610 dev_dbg(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
616 dev_warn(&device->dev, "failed to get event index\n"); in notify_handler()
620 if (!sparse_keymap_report_event(priv->input_dev, ev_index, 1, true)) in notify_handler()
621 dev_dbg(&device->dev, "unknown event index 0x%llx\n", in notify_handler()
627 acpi_handle handle = ACPI_HANDLE(&device->dev); in button_array_present()
628 unsigned long long event_cap; in button_array_present()
651 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_probe()
652 unsigned long long mode, dummy; in intel_hid_probe()
660 dev_warn(&device->dev, "failed to read mode\n"); in intel_hid_probe()
661 return -ENODEV; in intel_hid_probe()
670 dev_info(&device->dev, "platform is not in simple mode\n"); in intel_hid_probe()
671 return -ENODEV; in intel_hid_probe()
674 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); in intel_hid_probe()
676 return -ENOMEM; in intel_hid_probe()
677 dev_set_drvdata(&device->dev, priv); in intel_hid_probe()
697 dev_info(&device->dev, "platform supports 5 button array\n"); in intel_hid_probe()
705 dev_info(&device->dev, "platform supports switches\n"); in intel_hid_probe()
718 return -EBUSY; in intel_hid_probe()
720 err = intel_hid_set_enable(&device->dev, true); in intel_hid_probe()
724 intel_button_array_enable(&device->dev, true); in intel_hid_probe()
732 dev_warn(&device->dev, "failed to enable HID power button\n"); in intel_hid_probe()
734 device_init_wakeup(&device->dev, true); in intel_hid_probe()
751 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_remove()
753 device_init_wakeup(&device->dev, false); in intel_hid_remove()
755 intel_hid_set_enable(&device->dev, false); in intel_hid_remove()
756 intel_button_array_enable(&device->dev, false); in intel_hid_remove()
761 .name = "intel-hid",
788 dev_info(&dev->dev, in check_acpi_dev()
789 "intel-hid: created platform device\n"); in check_acpi_dev()