linux/drivers/platform/x86/lenovo-yogabook.c

// SPDX-License-Identifier: GPL-2.0
/*
 * 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 capacitive
 * touch 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 <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/wmi.h>
#include <linux/workqueue.h>

#define YB_MBTN_EVENT_GUID

#define YB_KBD_BL_DEFAULT
#define YB_KBD_BL_MAX
#define YB_KBD_BL_PWM_PERIOD

#define YB_PDEV_NAME

/* flags */
enum {};

struct yogabook_data {};

static void yogabook_work(struct work_struct *work)
{}

static void yogabook_toggle_digitizer_mode(struct yogabook_data *data)
{}

static irqreturn_t yogabook_backside_hall_irq(int irq, void *_data)
{}

#define kbd_led_to_yogabook(cdev)

static enum led_brightness kbd_brightness_get(struct led_classdev *cdev)
{}

static int kbd_brightness_set(struct led_classdev *cdev,
			      enum led_brightness value)
{}

static struct gpiod_lookup_table yogabook_gpios =;

static struct led_lookup_data yogabook_pen_led =;

static int yogabook_probe(struct device *dev, struct yogabook_data *data,
			  const char *kbd_bl_led_name)
{}

static void yogabook_remove(struct yogabook_data *data)
{}

static int yogabook_suspend(struct device *dev)
{}

static int yogabook_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(yogabook_pm_ops, yogabook_suspend, yogabook_resume);

/********** WMI driver code **********/

/*
 * To control keyboard backlight, call the method KBLC() of the TCS1 ACPI
 * device (Goodix touchpad acts as virtual sensor keyboard).
 */
static int yogabook_wmi_set_kbd_backlight(struct yogabook_data *data,
					  uint8_t level)
{}

static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
{}

static void yogabook_wmi_remove(struct wmi_device *wdev)
{}

static void yogabook_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)
{}

static const struct wmi_device_id yogabook_wmi_id_table[] =;
MODULE_DEVICE_TABLE(wmi, yogabook_wmi_id_table);

static struct wmi_driver yogabook_wmi_driver =;

/********** platform driver code **********/

static struct gpiod_lookup_table yogabook_pdev_gpios =;

static int yogabook_pdev_set_kbd_backlight(struct yogabook_data *data, u8 level)
{}

static irqreturn_t yogabook_pen_touch_irq(int irq, void *data)
{}

static int yogabook_pdev_probe(struct platform_device *pdev)
{}

static void yogabook_pdev_remove(struct platform_device *pdev)
{}

static struct platform_driver yogabook_pdev_driver =;

static int __init yogabook_module_init(void)
{}

static void __exit yogabook_module_exit(void)
{}

module_init();
module_exit(yogabook_module_exit);

MODULE_ALIAS();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();