Lines Matching +full:keyboard +full:- +full:controller +full:- +full:style

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 2014-2015 Pali Rohár <pali@kernel.org>
22 #include <linux/input/sparse-keymap.h>
28 #include "dell-smbios.h"
29 #include "dell-wmi-descriptor.h"
30 #include "dell-wmi-privacy.h"
37 #define DELL_EVENT_GUID "9DBB5994-A997-11DA-B012-B622A1EF5492"
78 * via the keyboard controller so should not be sent again.
104 /* Key code is followed by keyboard illumination level */
165 * Originally Matthew Garrett created this dell-wmi driver specially for
169 * by keyboard controller.
257 /* Fn-lock switched to function keys */
260 /* Fn-lock switched to multimedia keys */
263 /* Keyboard backlight change notification */
285 /* Fn-lock */
288 /* Change keyboard illumination */
292 * Radio disable (notify only -- there is no model for which the
297 /* RGB keyboard backlight control */
318 * Radio disable (notify only -- there is no model for which the
323 /* Fn-lock */
331 /* Reflex keyboard switch on 2n1 devices */
341 * Detachable keyboard detached / undocked
347 /* Detachable keyboard attached / docked */
350 /* Keyboard backlight level changed */
368 /* Ultra-performance mode switch request */
371 /* Fn-lock button pressed */
387 __set_bit(EV_SW, (dev)->evbit); in dell_wmi_switch_event()
388 __set_bit(switchid, (dev)->swbit); in dell_wmi_switch_event()
390 (dev)->name = devname; in dell_wmi_switch_event()
391 (dev)->id.bustype = BUS_HOST; in dell_wmi_switch_event()
406 struct dell_wmi_priv *priv = dev_get_drvdata(&wdev->dev); in dell_wmi_process_key()
411 key = sparse_keymap_entry_from_scancode(priv->input_dev, in dell_wmi_process_key()
422 if ((key->keycode == KEY_BRIGHTNESSUP || in dell_wmi_process_key()
423 key->keycode == KEY_BRIGHTNESSDOWN) && in dell_wmi_process_key()
430 if (key->keycode == KEY_KBDILLUMTOGGLE) { in dell_wmi_process_key()
434 dell_wmi_switch_event(&priv->tabletswitch_dev, in dell_wmi_process_key()
443 sparse_keymap_report_entry(priv->input_dev, key, value, true); in dell_wmi_process_key()
451 struct dell_wmi_priv *priv = dev_get_drvdata(&wdev->dev); in dell_wmi_notify()
456 if (obj->type != ACPI_TYPE_BUFFER) { in dell_wmi_notify()
457 pr_warn("bad response type %x\n", obj->type); in dell_wmi_notify()
462 obj->buffer.length, obj->buffer.pointer); in dell_wmi_notify()
464 buffer_entry = (u16 *)obj->buffer.pointer; in dell_wmi_notify()
465 buffer_size = obj->buffer.length/2; in dell_wmi_notify()
480 if (priv->interface_version == 0 && buffer_entry < buffer_end) in dell_wmi_notify()
505 len - 3); in dell_wmi_notify()
514 len - i - 1); in dell_wmi_notify()
522 buffer_entry + 3, len - 3); in dell_wmi_notify()
554 if (results->err || results->keymap) in handle_dmi_entry()
558 if (dm->type != 0xb2) in handle_dmi_entry()
563 hotkey_num = (table->header.length - in handle_dmi_entry()
568 * Historically, dell-wmi would ignore a DMI entry of in handle_dmi_entry()
579 results->err = -ENOMEM; in handle_dmi_entry()
585 &table->keymap[i]; in handle_dmi_entry()
588 u16 keycode = (bios_entry->keycode < in handle_dmi_entry()
590 bios_to_linux_keycode[bios_entry->keycode] : in handle_dmi_entry()
591 (bios_entry->keycode == 0xffff ? KEY_UNKNOWN : KEY_RESERVED); in handle_dmi_entry()
600 bios_entry->scancode, bios_entry->keycode); in handle_dmi_entry()
608 keymap[pos].code = bios_entry->scancode; in handle_dmi_entry()
614 results->keymap = keymap; in handle_dmi_entry()
615 results->keymap_size = pos; in handle_dmi_entry()
620 struct dell_wmi_priv *priv = dev_get_drvdata(&wdev->dev); in dell_wmi_input_setup()
625 priv->input_dev = input_allocate_device(); in dell_wmi_input_setup()
626 if (!priv->input_dev) in dell_wmi_input_setup()
627 return -ENOMEM; in dell_wmi_input_setup()
629 priv->input_dev->name = "Dell WMI hotkeys"; in dell_wmi_input_setup()
630 priv->input_dev->id.bustype = BUS_HOST; in dell_wmi_input_setup()
631 priv->input_dev->dev.parent = &wdev->dev; in dell_wmi_input_setup()
635 * Historically, dell-wmi ignored dmi_walk errors. A failure in dell_wmi_input_setup()
639 pr_warn("no DMI; using the old-style hotkey interface\n"); in dell_wmi_input_setup()
656 err = -ENOMEM; in dell_wmi_input_setup()
679 have_scancode(entry->code | (0x0010 << 16), in dell_wmi_input_setup()
714 err = sparse_keymap_setup(priv->input_dev, keymap, NULL); in dell_wmi_input_setup()
723 err = input_register_device(priv->input_dev); in dell_wmi_input_setup()
730 input_free_device(priv->input_dev); in dell_wmi_input_setup()
736 struct dell_wmi_priv *priv = dev_get_drvdata(&wdev->dev); in dell_wmi_input_destroy()
738 input_unregister_device(priv->input_dev); in dell_wmi_input_destroy()
739 if (priv->tabletswitch_dev) in dell_wmi_input_destroy()
740 input_unregister_device(priv->tabletswitch_dev); in dell_wmi_input_destroy()
756 * cbRes1 Standard return codes (0, -1, -2)
766 return -ENOMEM; in dell_wmi_events_set_enabled()
767 buffer->cmd_class = CLASS_INFO; in dell_wmi_events_set_enabled()
768 buffer->cmd_select = SELECT_APP_REGISTRATION; in dell_wmi_events_set_enabled()
769 buffer->input[0] = 0x10000; in dell_wmi_events_set_enabled()
770 buffer->input[1] = 0x51534554; in dell_wmi_events_set_enabled()
771 buffer->input[3] = enable; in dell_wmi_events_set_enabled()
774 ret = buffer->output[0]; in dell_wmi_events_set_enabled()
790 &wdev->dev, sizeof(struct dell_wmi_priv), GFP_KERNEL); in dell_wmi_probe()
792 return -ENOMEM; in dell_wmi_probe()
793 dev_set_drvdata(&wdev->dev, priv); in dell_wmi_probe()
795 if (!dell_wmi_get_interface_version(&priv->interface_version)) in dell_wmi_probe()
796 return -EPROBE_DEFER; in dell_wmi_probe()
812 .name = "dell-wmi",