Lines Matching +full:mic +full:- +full:pos

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"
165 * Originally Matthew Garrett created this dell-wmi driver specially for
257 /* Fn-lock switched to function keys */
260 /* Fn-lock switched to multimedia keys */
282 /* Mic mute */
285 /* Fn-lock */
292 * Radio disable (notify only -- there is no model for which the
318 * Radio disable (notify only -- there is no model for which the
323 /* Fn-lock */
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()
551 int hotkey_num, i, pos = 0; in handle_dmi_entry() local
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()
605 keymap[pos].type = KE_IGNORE; in handle_dmi_entry()
607 keymap[pos].type = KE_KEY; in handle_dmi_entry()
608 keymap[pos].code = bios_entry->scancode; in handle_dmi_entry()
609 keymap[pos].keycode = keycode; in handle_dmi_entry()
611 pos++; 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()
623 int err, i, pos = 0; in dell_wmi_input_setup() local
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()
662 keymap[pos] = dmi_results.keymap[i]; in dell_wmi_input_setup()
663 keymap[pos].code |= (0x0010 << 16); in dell_wmi_input_setup()
664 pos++; in dell_wmi_input_setup()
679 have_scancode(entry->code | (0x0010 << 16), in dell_wmi_input_setup()
684 keymap[pos] = *entry; in dell_wmi_input_setup()
685 keymap[pos].code |= (0x0010 << 16); in dell_wmi_input_setup()
686 pos++; in dell_wmi_input_setup()
691 keymap[pos] = dell_wmi_keymap_type_0011[i]; in dell_wmi_input_setup()
692 keymap[pos].code |= (0x0011 << 16); in dell_wmi_input_setup()
693 pos++; in dell_wmi_input_setup()
698 keymap[pos] = dell_wmi_keymap_type_0012[i]; in dell_wmi_input_setup()
699 keymap[pos].code |= (0x0012 << 16); in dell_wmi_input_setup()
700 pos++; in dell_wmi_input_setup()
708 keymap[pos] = dell_wmi_keymap_type_0000[i]; in dell_wmi_input_setup()
709 pos++; in dell_wmi_input_setup()
712 keymap[pos].type = KE_END; 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",