platform/x86: Add lenovo-yoga-tab2-pro-1380-fastcharger driver
PATCH v2 1/1 platform/x86: Add lenovo-yoga-tab2-pro-1380-fastcharger driver
Add a new driver for the custom fast charging protocol found on Lenovo Yoga Tablet 2 1380F / 1380L models.
---
Changes in v2 (from review by Andy):
- Add a couple of missing includes
- Couple of small coding style fixes
--- drivers/platform/x86/Kconfig | 11 + drivers/platform/x86/Makefile | 1 + .../lenovo-yoga-tab2-pro-1380-fastcharger.c | 337 ++++++++++++++++++ 3 files changed, 349 insertions(+) create mode 100644 drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c
drivers/platform/x86/Kconfig +11 -0
@@ -133,6 +133,17 @@ config YOGABOOK To compile this driver as a module, choose M here: the module will be called lenovo-yogabook. +config YT2_1380 + tristate "Lenovo Yoga Tablet 2 1380 fast charge driver" + depends on SERIAL_DEV_BUS + depends on ACPI + help + Say Y here to enable support for the custom fast charging protocol + found on the Lenovo Yoga Tablet 2 1380F / 1380L models. + + To compile this driver as a module, choose M here: the module will + be called lenovo-yogabook. + config ACERHDF tristate "Acer Aspire One temperature and fan driver" depends on ACPI && THERMAL
drivers/platform/x86/Makefile +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o obj-$(CONFIG_THINKPAD_LMI) += think-lmi.o obj-$(CONFIG_YOGABOOK) += lenovo-yogabook.o +obj-$(CONFIG_YT2_1380) += lenovo-yoga-tab2-pro-1380-fastcharger.o obj-$(CONFIG_LENOVO_WMI_CAMERA) += lenovo-wmi-camera.o # Intel
drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c new file +337 -0
337 lines not on this page · raw message
Signature · 1 line
2.44.0
Quoted 78 lines · Hans de Goede
Add a new driver for the custom fast charging protocol found on Lenovo Yoga Tablet 2 1380F / 1380L models.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2 (from review by Andy):
- Add a couple of missing includes
- Couple of small coding style fixes--- drivers/platform/x86/Kconfig | 11 + drivers/platform/x86/Makefile | 1 + .../lenovo-yoga-tab2-pro-1380-fastcharger.c | 337 ++++++++++++++++++ 3 files changed, 349 insertions(+) create mode 100644 drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.cdrivers/platform/x86/Kconfig +11
-0@@ -133,6 +133,17 @@ config YOGABOOK To compile this driver as a module, choose M here: the module will be called lenovo-yogabook. +config YT2_1380 + tristate "Lenovo Yoga Tablet 2 1380 fast charge driver" + depends on SERIAL_DEV_BUS + depends on ACPI + help + Say Y here to enable support for the custom fast charging protocol + found on the Lenovo Yoga Tablet 2 1380F / 1380L models. + + To compile this driver as a module, choose M here: the module will + be called lenovo-yogabook. + config ACERHDF tristate "Acer Aspire One temperature and fan driver" depends on ACPI && THERMALdrivers/platform/x86/Makefile +1
-0@@ -66,6 +66,7 @@ obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o obj-$(CONFIG_THINKPAD_LMI) += think-lmi.o obj-$(CONFIG_YOGABOOK) += lenovo-yogabook.o +obj-$(CONFIG_YT2_1380) += lenovo-yoga-tab2-pro-1380-fastcharger.o obj-$(CONFIG_LENOVO_WMI_CAMERA) += lenovo-wmi-camera.o # Inteldrivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c new file +23
-0@@ -0,0 +1,337 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Support for the custom fast charging protocol found on the Lenovo Yoga +* Tablet 2 1380F / 1380L models. +* +* Copyright (C) 2024 Hans de Goede <[email protected]> +*/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/errno.h> +#include <linux/extcon.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/notifier.h> +#include <linux/pinctrl/consumer.h> +#include <linux/pinctrl/machine.h> +#include <linux/platform_device.h> +#include <linux/serdev.h> +#include <linux/types.h> +#include <linux/workqueue.h> +#include "serdev_helpers.h"
drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c line 33
Quoted 10 lines
drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c new file +10
-0+ +#define YT2_1380_FC_PDEV_NAME "lenovo-yoga-tab2-pro-1380-fastcharger" +#define YT2_1380_FC_SERDEV_CTRL "serial0" +#define YT2_1380_FC_SERDEV_NAME "serial0-0" +#define YT2_1380_FC_EXTCON_NAME "i2c-lc824206xa" + +#define YT2_1380_FC_MAX_TRIES 5 +#define YT2_1380_FC_PIN_SW_DELAY_US (10 * USEC_PER_MSEC) +#define YT2_1380_FC_UART_DRAIN_DELAY_US (50 * USEC_PER_MSEC) +#define YT2_1380_FC_VOLT_SW_DELAY_US (1000 * USEC_PER_MSEC)
Add include for *SEC_PER_*SEC.
Once that's taken care of,
Signature · 1 line
i.
Hi,
Quoted 93 lines · Ilpo Järvinen
Quoted 78 lines · Hans de Goede
Add a new driver for the custom fast charging protocol found on Lenovo Yoga Tablet 2 1380F / 1380L models.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2 (from review by Andy):
- Add a couple of missing includes
- Couple of small coding style fixes--- drivers/platform/x86/Kconfig | 11 + drivers/platform/x86/Makefile | 1 + .../lenovo-yoga-tab2-pro-1380-fastcharger.c | 337 ++++++++++++++++++ 3 files changed, 349 insertions(+) create mode 100644 drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.cdrivers/platform/x86/Kconfig +11
-0@@ -133,6 +133,17 @@ config YOGABOOK To compile this driver as a module, choose M here: the module will be called lenovo-yogabook. +config YT2_1380 + tristate "Lenovo Yoga Tablet 2 1380 fast charge driver" + depends on SERIAL_DEV_BUS + depends on ACPI + help + Say Y here to enable support for the custom fast charging protocol + found on the Lenovo Yoga Tablet 2 1380F / 1380L models. + + To compile this driver as a module, choose M here: the module will + be called lenovo-yogabook. + config ACERHDF tristate "Acer Aspire One temperature and fan driver" depends on ACPI && THERMALdrivers/platform/x86/Makefile +1
-0@@ -66,6 +66,7 @@ obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o obj-$(CONFIG_THINKPAD_LMI) += think-lmi.o obj-$(CONFIG_YOGABOOK) += lenovo-yogabook.o +obj-$(CONFIG_YT2_1380) += lenovo-yoga-tab2-pro-1380-fastcharger.o obj-$(CONFIG_LENOVO_WMI_CAMERA) += lenovo-wmi-camera.o # Inteldrivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c new file +23
-0@@ -0,0 +1,337 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Support for the custom fast charging protocol found on the Lenovo Yoga +* Tablet 2 1380F / 1380L models. +* +* Copyright (C) 2024 Hans de Goede <[email protected]> +*/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/errno.h> +#include <linux/extcon.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/notifier.h> +#include <linux/pinctrl/consumer.h> +#include <linux/pinctrl/machine.h> +#include <linux/platform_device.h> +#include <linux/serdev.h> +#include <linux/types.h> +#include <linux/workqueue.h> +#include "serdev_helpers.h" drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c line 33
Quoted 10 lines
drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c new file +10
-0+ +#define YT2_1380_FC_PDEV_NAME "lenovo-yoga-tab2-pro-1380-fastcharger" +#define YT2_1380_FC_SERDEV_CTRL "serial0" +#define YT2_1380_FC_SERDEV_NAME "serial0-0" +#define YT2_1380_FC_EXTCON_NAME "i2c-lc824206xa" + +#define YT2_1380_FC_MAX_TRIES 5 +#define YT2_1380_FC_PIN_SW_DELAY_US (10 * USEC_PER_MSEC) +#define YT2_1380_FC_UART_DRAIN_DELAY_US (50 * USEC_PER_MSEC) +#define YT2_1380_FC_VOLT_SW_DELAY_US (1000 * USEC_PER_MSEC)Add include for *SEC_PER_*SEC.
Quoted 3 lines
Once that's taken care of,
Reviewed-by Ilpo Järvinen <[email protected]>
Thank you. I've added the include while added this to my review-hans (soon to be for-next) branch.
Regards,
Hans