Lines Matching +full:fn +full:- +full:keymap
1 // SPDX-License-Identifier: GPL-2.0+
12 #include <linux/input/sparse-keymap.h>
36 /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */
37 /* 2: Toggle SW_ROTATE_LOCK -- easy to implement if seen in wild */
46 /* 13 has two different meanings in the spec -- ignore it. */
54 /* 27: wake -- needs special handling */
106 * Some convertible use the intel-hid ACPI interface to report SW_TABLET_MODE,
115 DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible 15-df0xxx"),
147 #define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
206 acpi_handle_debug(handle, "Exec DSM Fn code: %d[%s] success\n", in intel_hid_execute_method()
241 *result = obj->integer.value; in intel_hid_evaluate_method()
243 "Eval DSM Fn code: %d[%s] results: 0x%llx\n", in intel_hid_evaluate_method()
266 switch (obj->buffer.length) { in intel_hid_init_dsm()
269 intel_hid_dsm_fn_mask = *(u16 *)obj->buffer.pointer; in intel_hid_init_dsm()
272 intel_hid_dsm_fn_mask = *obj->buffer.pointer; in intel_hid_init_dsm()
290 /* Enable|disable features - power button is always enabled */ in intel_hid_set_enable()
295 return -EIO; in intel_hid_set_enable()
308 if (!priv->array) in intel_button_array_enable()
318 /* Enable|disable features - power button is always enabled */ in intel_button_array_enable()
329 priv->wakeup_mode = true; in intel_hid_pm_prepare()
338 priv->wakeup_mode = false; in intel_hid_pm_complete()
374 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_hid_input_setup()
377 priv->input_dev = devm_input_allocate_device(&device->dev); in intel_hid_input_setup()
378 if (!priv->input_dev) in intel_hid_input_setup()
379 return -ENOMEM; in intel_hid_input_setup()
381 ret = sparse_keymap_setup(priv->input_dev, intel_hid_keymap, NULL); in intel_hid_input_setup()
385 priv->input_dev->name = "Intel HID events"; in intel_hid_input_setup()
386 priv->input_dev->id.bustype = BUS_HOST; in intel_hid_input_setup()
388 return input_register_device(priv->input_dev); in intel_hid_input_setup()
393 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_button_array_input_setup()
397 priv->array = devm_input_allocate_device(&device->dev); in intel_button_array_input_setup()
398 if (!priv->array) in intel_button_array_input_setup()
399 return -ENOMEM; in intel_button_array_input_setup()
401 ret = sparse_keymap_setup(priv->array, intel_array_keymap, NULL); in intel_button_array_input_setup()
405 priv->array->name = "Intel HID 5 button array"; in intel_button_array_input_setup()
406 priv->array->id.bustype = BUS_HOST; in intel_button_array_input_setup()
408 return input_register_device(priv->array); in intel_button_array_input_setup()
413 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in intel_hid_switches_setup()
416 priv->switches = devm_input_allocate_device(&device->dev); in intel_hid_switches_setup()
417 if (!priv->switches) in intel_hid_switches_setup()
418 return -ENOMEM; in intel_hid_switches_setup()
420 __set_bit(EV_SW, priv->switches->evbit); in intel_hid_switches_setup()
421 __set_bit(SW_TABLET_MODE, priv->switches->swbit); in intel_hid_switches_setup()
423 priv->switches->name = "Intel HID switches"; in intel_hid_switches_setup()
424 priv->switches->id.bustype = BUS_HOST; in intel_hid_switches_setup()
425 return input_register_device(priv->switches); in intel_hid_switches_setup()
430 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in report_tablet_mode_state()
431 acpi_handle handle = ACPI_HANDLE(&device->dev); in report_tablet_mode_state()
439 input_report_switch(priv->switches, SW_TABLET_MODE, m); in report_tablet_mode_state()
440 input_sync(priv->switches); in report_tablet_mode_state()
465 struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); in notify_handler()
474 if (!priv->switches && priv->auto_add_switch && (event == 0xcc || event == 0xcd)) { in notify_handler()
475 dev_info(&device->dev, "switch event received, enable switches supports\n"); in notify_handler()
481 if (priv->wakeup_mode) { in notify_handler()
483 * Needed for wakeup from suspend-to-idle to work on some in notify_handler()
484 * platforms that don't expose the 5-button array, but still in notify_handler()
492 * Some devices send (duplicate) tablet-mode events when moved in notify_handler()
499 report_tablet_mode_event(priv->switches, event); in notify_handler()
503 /* Wake up on 5-button array events only. */ in notify_handler()
504 if (event == 0xc0 || !priv->array) in notify_handler()
507 if (!sparse_keymap_entry_from_scancode(priv->array, event)) { in notify_handler()
508 dev_info(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
513 pm_wakeup_hard_event(&device->dev); in notify_handler()
520 * the 5-button array, but still send notifies with power button in notify_handler()
525 if (!priv->array) { in notify_handler()
527 input_report_key(priv->input_dev, KEY_POWER, 1); in notify_handler()
528 input_sync(priv->input_dev); in notify_handler()
533 input_report_key(priv->input_dev, KEY_POWER, 0); in notify_handler()
534 input_sync(priv->input_dev); in notify_handler()
539 if (report_tablet_mode_event(priv->switches, event)) in notify_handler()
544 if (!priv->array || in notify_handler()
545 !sparse_keymap_report_event(priv->array, event, 1, true)) in notify_handler()
546 dev_dbg(&device->dev, "unknown event 0x%x\n", event); in notify_handler()
552 dev_warn(&device->dev, "failed to get event index\n"); in notify_handler()
556 if (!sparse_keymap_report_event(priv->input_dev, ev_index, 1, true)) in notify_handler()
557 dev_dbg(&device->dev, "unknown event index 0x%llx\n", in notify_handler()
563 acpi_handle handle = ACPI_HANDLE(&device->dev); in button_array_present()
587 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_probe()
596 dev_warn(&device->dev, "failed to read mode\n"); in intel_hid_probe()
597 return -ENODEV; in intel_hid_probe()
606 dev_info(&device->dev, "platform is not in simple mode\n"); in intel_hid_probe()
607 return -ENODEV; in intel_hid_probe()
610 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); in intel_hid_probe()
612 return -ENOMEM; in intel_hid_probe()
613 dev_set_drvdata(&device->dev, priv); in intel_hid_probe()
616 priv->auto_add_switch = dmi_check_system(dmi_auto_add_switch) && !dual_accel_detect(); in intel_hid_probe()
626 dev_info(&device->dev, "platform supports 5 button array\n"); in intel_hid_probe()
634 dev_info(&device->dev, "platform supports switches\n"); in intel_hid_probe()
647 return -EBUSY; in intel_hid_probe()
649 err = intel_hid_set_enable(&device->dev, true); in intel_hid_probe()
653 if (priv->array) { in intel_hid_probe()
656 intel_button_array_enable(&device->dev, true); in intel_hid_probe()
661 dev_warn(&device->dev, in intel_hid_probe()
666 device_init_wakeup(&device->dev, true); in intel_hid_probe()
683 acpi_handle handle = ACPI_HANDLE(&device->dev); in intel_hid_remove()
685 device_init_wakeup(&device->dev, false); in intel_hid_remove()
687 intel_hid_set_enable(&device->dev, false); in intel_hid_remove()
688 intel_button_array_enable(&device->dev, false); in intel_hid_remove()
699 .name = "intel-hid",
729 dev_info(&dev->dev, in check_acpi_dev()
730 "intel-hid: created platform device\n"); in check_acpi_dev()