Re: [PATCH 17/19] platform/x86: lenovo-yogabook: Add platform driver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 29, 2023 at 9:16 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> The Lenovo Yoga Book 1 comes in 2 versions.
>
> Version 1: The yb1-x91f/l currently supported by lenovo-yogabook-wmi, which
> has a WMI interface to deal with toggling the keyboard half between
> touch-keyboard and wacom-digitizer mode.
>
> Version 2: The yb1-x90f/l which is the same hardware shipping with Android
> as factory OS. This version has a very different BIOS and ACPI tables which
> lack the WMI interface.
>
> Instead the x86-android-tablets.ko code which does devices instantiation
> for devices missing from ACPI on various x86 Android tablets will
> instantiate a platform device for the keyboard half touch-kbd/digitizer
> toggle functionality.
>
> This patch adds a platform driver to the lenovo-yogabook code which binds
> to the platform device instantiated by x86-android-tablets.ko offering
> touch-kbd/digitizer toggle functionality on the Android model.

...

> +/*
> + * Platform driver for Lenovo Yoga Book YB1-X90F/L tablets (Android model)
> + * WMI driver for Lenovo Yoga Book YB1-X91F/L tablets (Windows model)
> + *
> + * The keyboard half of the YB1 models can function as both a capactive touch

capacitive ?

> + * keyboard or as a Wacom digitizer, but not at the same time.
> + *
> + * This driver takes care of switching between the 2 functions.
> + *
> + * Copyright 2023 Hans de Goede <hansg@xxxxxxxxxx>
> + */

...

>  #include <linux/devm-helpers.h>

Hmm.. TIL!

...

> +       if (IS_ERR(data->pen_touch_event)) {
> +               r = PTR_ERR(data->pen_touch_event);
> +               dev_err_probe(dev, r, "Getting pen_touch_event GPIO\n");

Combine them

  r = dev_err_probe(...);

> +               goto error_put_devs;
> +       }
> +
> +       if (IS_ERR(data->kbd_bl_led_enable)) {
> +               r = PTR_ERR(data->kbd_bl_led_enable);
> +               dev_err_probe(dev, r, "Getting enable_keyboard_led GPIO\n");

Ditto.

> +               goto error_put_devs;
> +       }

...

> +       r = gpiod_to_irq(data->pen_touch_event);
> +       if (r < 0) {
> +               dev_err_probe(dev, r, "Getting pen_touch_event IRQ\n");
> +               return r;

return dev_err_probe();

> +       }
> +       data->pen_touch_irq = r;
> +
> +       r = request_irq(data->pen_touch_irq, yogabook_pen_touch_irq, IRQF_TRIGGER_FALLING,
> +                       "pen_touch_event", data);
> +       if (r) {
> +               dev_err_probe(dev, r, "Requesting backside_hall_sw IRQ\n");
> +               return r;

Ditto.

> +       }

...

> +MODULE_ALIAS("platform:" YB_PDEV_NAME);

Hmm... Do we need this?


-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux