platform/x86: Add driver for Yoga Tablet mode switch
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 4 repliesIn review
- v22 patches 6 repliesSuperseded
- v12 patches 20 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | platform/x86: Move ideapad ACPI helpers to a new headerdrivers/ drivers/ | +152 | 0 replies | |
| 2/2 | platform/x86: Add driver for Yoga Tablet Mode switchdrivers/ drivers/ drivers/ +1 more | +198 | 2 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by.
| Patch | André Apitzsch |
|---|---|
| Series | T-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] platform/x86: Add driver for Yoga Tablet mode switch
This driver maps the Lenovo Yoga tablet mode switch to a SW_TABLET_MODE input device. This will make the tablet status available to desktop environments.
This patch series is the result of the discussion at
https://lore.kernel.org/r/CAG4kvq9US=-NjyXFMzJYu2zCJryJWtOc7FGZbrewpgCDjdAkbg@mail.gmail.com/
I decided to follow-up on the patch Gergo wrote and respond to the review comments to get it merged and available for everyone.
Gergo and I have tested this on the Yoga 7 14ARB7, and the Yoga 7 14AIL7 respectively. Additionally, according to reports at
https://github.com/lukas-w/yoga-usage-mode, which uses the same WMI devices, this driver should work with:
Yoga C940, Ideapad flex 14API, Yoga 9 14IAP7, Yoga 7 14ARB7, etc.
v1: https://lore.kernel.org/r/[email protected]/
v2: https://lore.kernel.org/r/[email protected]/
The diff since v2 is as follows:
drivers/platform/x86/lenovo-ymc.c +12 -13
@@ -21,8 +21,8 @@#define LENOVO_YMC_QUERY_METHOD 0x01static bool ec_trigger__read_mostly ; -module_param (ec_trigger, bool,0644 ); -MODULE_PARM_DESC (ec_trigger,"Enable EC triggering to emit YMC events" ); +module_param (ec_trigger, bool,0444 ); +MODULE_PARM_DESC (ec_trigger,"Enable EC triggering work-around to force emitting tablet mode events" );static const struct dmi_system_id ec_trigger_quirk_dmi_table[] = { {
@@ -43,8 +43,7 @@ struct lenovo_ymc_private {static void lenovo_ymc_trigger_ec (struct wmi_device *wdev,struct lenovo_ymc_private *priv) {int err; - -if (!ec_trigger || !priv || !priv->ec_acpi_dev) +if (!priv->ec_acpi_dev)return ; err =write_ec_cmd (priv->ec_acpi_dev->handle,VPCCMD_W_YMC ,1 );if (err)
@@ -103,11 +102,7 @@ static void lenovo_ymc_notify(struct wmi_device *wdev, union acpi_object *data)lenovo_ymc_trigger_ec (wdev, priv); } -static void lenovo_ymc_remove (struct wmi_device *wdev) -{ -struct lenovo_ymc_private *priv =dev_get_drvdata (&wdev->dev); -acpi_dev_put (priv->ec_acpi_dev); -} +static void acpi_dev_put_helper (void *p) {acpi_dev_put (p); }static int lenovo_ymc_probe (struct wmi_device *wdev,const void *ctx) {
@@ -124,10 +119,18 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx)if (ec_trigger) {pr_debug ("Lenovo YMC enable EC triggering.\n" ); priv->ec_acpi_dev =acpi_dev_get_first_match_dev ("VPC2004" ,NULL ,-1 ); +if (!priv->ec_acpi_dev) {dev_err (&wdev->dev,"Could not find EC ACPI device.\n" );return -ENODEV ; } + err =devm_add_action_or_reset (&wdev->dev, + acpi_dev_put_helper, priv->ec_acpi_dev); +if (err) { +dev_err (&wdev->dev, +"Could not clean up EC ACPI device: %d\n" , err); +return err; + } } input_dev =devm_input_allocate_device (&wdev->dev);
@@ -138,9 +141,6 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx) input_dev->phys =LENOVO_YMC_EVENT_GUID "/input0" ; input_dev->id.bustype =BUS_HOST ; input_dev->dev.parent = &wdev->dev; - -input_set_capability (input_dev,EV_SW ,SW_TABLET_MODE ); - err =sparse_keymap_setup (input_dev, lenovo_ymc_keymap,NULL );if (err) { dev_err(&wdev->dev,
@@ -177,7 +177,6 @@ static struct wmi_driver lenovo_ymc_driver = { .id_table = lenovo_ymc_wmi_id_table, .probe = lenovo_ymc_probe, .notify = lenovo_ymc_notify, - .remove = lenovo_ymc_remove, };module_wmi_driver (lenovo_ymc_driver);
Andrew Kallmeyer (1):
platform/x86: Move ideapad ACPI helpers to a new header
Gergo Koteles (1):
platform/x86: Add driver for Yoga Tablet Mode switch
drivers/platform/x86/Kconfig | 10 ++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/ideapad-laptop.c | 135 +------------------ drivers/platform/x86/ideapad-laptop.h | 152 +++++++++++++++++++++ drivers/platform/x86/lenovo-ymc.c | 185 ++++++++++++++++++++++++++ 5 files changed, 349 insertions(+), 134 deletions(-) create mode 100644 drivers/platform/x86/ideapad-laptop.h create mode 100644 drivers/platform/x86/lenovo-ymc.c
Signature · 1 line
2.40.0