X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy@kernel.org>, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v2] platform/x86: Add lenovo-yoga-tab2-pro-1380-fastcharger driver
Date: Mon, 22 Apr 2024 16:36:57 +0300 (EEST)	[thread overview]
Message-ID: <f6260783-5ff9-2ab4-81bc-9d3ad8d363b2@linux.intel.com> (raw)
In-Reply-To: <20240422131649.46002-1-hdegoede@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3737 bytes --]

On Mon, 22 Apr 2024, Hans de Goede wrote:

> 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 <hdegoede@redhat.com>
> ---
> 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
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index cd0ec10240b6..318f2f77c97a 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index 5521a87f0718..2640475a9f97 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -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
> diff --git a/drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c b/drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c
> new file mode 100644
> index 000000000000..035d8cc86079
> --- /dev/null
> +++ b/drivers/platform/x86/lenovo-yoga-tab2-pro-1380-fastcharger.c
> @@ -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 <hansg@kernel.org>
> + */
> +#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"
> +
> +#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,

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

  reply	other threads:[~2024-04-22 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 13:16 [PATCH v2] platform/x86: Add lenovo-yoga-tab2-pro-1380-fastcharger driver Hans de Goede
2024-04-22 13:36 ` Ilpo Järvinen [this message]
2024-04-29 10:47   ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6260783-5ff9-2ab4-81bc-9d3ad8d363b2@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox