platform/x86: ideapad-laptop: Send KEY_TOUCHPAD_TOGGLE on some models
authorHans de Goede <hdegoede@redhat.com>
Thu, 17 Nov 2022 11:02:42 +0000 (12:02 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 21 Nov 2022 10:12:23 +0000 (11:12 +0100)
commit5829f8a897e4f030cd2d32a930eea8954ab5dcd3
tree637833e101f545eae523b305b3feec7ef41307b8
parentc69e7d843d2c34b80b8731a5dc57c34ea04a3edf
platform/x86: ideapad-laptop: Send KEY_TOUCHPAD_TOGGLE on some models

On recent Ideapad models the EC does not control the touchpad at all,
so instead of sending KEY_TOUCHPAD_ON/ _OFF on touchpad toggle hotkey
events, ideapad-laptop should send KEY_TOUCHPAD_TOGGLE and let userspace
handle the toggling.

Check for this by checking if the value read from VPCCMD_R_TOUCHPAD
actually changes when receiving a touchpad-toggle hotkey event; and
if it does not change send KEY_TOUCHPAD_TOGGLE to userspace to let
userspace enable/disable the touchpad in software.

Note this also drops the priv->features.touchpad_ctrl_via_ec check from
ideapad_sync_touchpad_state() so that KEY_TOUCHPAD_TOGGLE will be send
on laptops where this is not set too. This can be safely dropped now
because the i8042_command(I8042_CMD_AUX_ENABLE/_DISABLE) call is now
guarded by its own feature flag.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Link: https://lore.kernel.org/r/20221117110244.67811-5-hdegoede@redhat.com
drivers/platform/x86/ideapad-laptop.c