Commit 95f38fd4 authored by Stefan Brüns's avatar Stefan Brüns Committed by Darren Hart (VMware)

platform/x86: intel-vbtn: Support separate press/release events

Currently all key events use autorelease, but this forbids use as a
modifier key.

As all event codes come in even/odd pairs, we can lookup the key type
(KE_KEY/KE_IGNORE) for the key up event corresponding to the currently
handled key down event. If the key up is ignored, we keep setting the
autorelease flag for the key down.
Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent 1c828496
...@@ -76,13 +76,26 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) ...@@ -76,13 +76,26 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
{ {
struct platform_device *device = context; struct platform_device *device = context;
struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev); struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
const struct key_entry *ke_rel;
bool autorelease;
if (priv->wakeup_mode) { if (priv->wakeup_mode) {
if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) { if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) {
pm_wakeup_hard_event(&device->dev); pm_wakeup_hard_event(&device->dev);
return; return;
} }
} else if (sparse_keymap_report_event(priv->input_dev, event, 1, true)) { } else {
/* Use the fact press/release come in even/odd pairs */
if ((event & 1) && sparse_keymap_report_event(priv->input_dev,
event, 0, false))
return;
ke_rel = sparse_keymap_entry_from_scancode(priv->input_dev,
event | 1);
autorelease = !ke_rel || ke_rel->type == KE_IGNORE;
if (sparse_keymap_report_event(priv->input_dev, event, 1,
autorelease))
return; return;
} }
dev_dbg(&device->dev, "unknown event index 0x%x\n", event); dev_dbg(&device->dev, "unknown event index 0x%x\n", event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment