public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code
@ 2022-11-27 18:22 Hans de Goede
  2022-11-27 18:22 ` [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models Hans de Goede
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Hans de Goede @ 2022-11-27 18:22 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones, MyungJoo Ham, Chanwoo Choi
  Cc: Hans de Goede, linux-i2c, linux-kernel

Hi All,

These 3 patches add support for the Lenovo Yoga Tab 3 Pro (YT3-X90F) tablet
to the Intel Cherry Trail Whiskey Cove PMIC code.

Patches 2-3 depend on patch 1. Since the modified files almost never see
any changes it is probably best / easiest if the entire series get merged
through the MFD tree.

Wolfgang and MyungJoo or Chanwoo, can you please give your Ack for merging
these through the MFD tree?

Regards,

Hans


Hans de Goede (3):
  mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to
    intel_cht_wc_models
  i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F
  extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F

 drivers/extcon/extcon-intel-cht-wc.c |  1 +
 drivers/i2c/busses/i2c-cht-wc.c      | 46 ++++++++++++++++++++++++++++
 drivers/mfd/intel_soc_pmic_chtwc.c   |  8 +++++
 include/linux/mfd/intel_soc_pmic.h   |  1 +
 4 files changed, 56 insertions(+)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models
  2022-11-27 18:22 [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Hans de Goede
@ 2022-11-27 18:22 ` Hans de Goede
  2022-11-27 18:22 ` [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Hans de Goede
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2022-11-27 18:22 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones, MyungJoo Ham, Chanwoo Choi
  Cc: Hans de Goede, linux-i2c, linux-kernel

The drivers for various CHT Whiskey Cove PMIC child-devices need to know
the model, since they have model specific behavior. The DMI match table
for this is shared between the child-device-drivers inside the MFD driver.

Add the Lenovo Yoga Tab 3 X90F, which is a previously unknown tablet
model with a CHT Whiskey Cove PMIC, to the intel_cht_wc_models enum and
to the DMI match table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mfd/intel_soc_pmic_chtwc.c | 8 ++++++++
 include/linux/mfd/intel_soc_pmic.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
index 9216f0d34206..d53dae255490 100644
--- a/drivers/mfd/intel_soc_pmic_chtwc.c
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
@@ -165,6 +165,14 @@ static const struct dmi_system_id cht_wc_model_dmi_ids[] = {
 			/* Non exact match to match all versions */
 			DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"),
 		},
+	}, {
+		/* Lenovo Yoga Tab 3 Pro YT3-X90F */
+		.driver_data = (void *)(long)INTEL_CHT_WC_LENOVO_YT3_X90,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
+		},
 	},
 	{ }
 };
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
index 945bde1fe55c..9ba2c1a8d836 100644
--- a/include/linux/mfd/intel_soc_pmic.h
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -18,6 +18,7 @@ enum intel_cht_wc_models {
 	INTEL_CHT_WC_GPD_WIN_POCKET,
 	INTEL_CHT_WC_XIAOMI_MIPAD2,
 	INTEL_CHT_WC_LENOVO_YOGABOOK1,
+	INTEL_CHT_WC_LENOVO_YT3_X90,
 };
 
 /**
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F
  2022-11-27 18:22 [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Hans de Goede
  2022-11-27 18:22 ` [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models Hans de Goede
@ 2022-11-27 18:22 ` Hans de Goede
  2022-12-01 22:59   ` Wolfram Sang
  2022-11-27 18:22 ` [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F Hans de Goede
  2022-12-01 22:59 ` [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Wolfram Sang
  3 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-11-27 18:22 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones, MyungJoo Ham, Chanwoo Choi
  Cc: Hans de Goede, linux-i2c, linux-kernel

On x86 devices with a CHT Whiskey Cove PMIC the driver for
the I2C bus coming from the PMIC is responsible for instantiating
the i2c_client for the charger chip.

Add the necessary i2c_board_info for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/i2c/busses/i2c-cht-wc.c | 46 +++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 190abdc46dd3..2b2c3d090089 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -380,6 +380,49 @@ static struct i2c_board_info lenovo_yogabook1_board_info = {
 	.platform_data = &bq2589x_pdata,
 };
 
+/********** Lenovo Yogabook YT3-X90F charger settings **********/
+static const char * const lenovo_yt3_bq25892_1_suppliers[] = { "cht_wcove_pwrsrc" };
+
+/*
+ * bq25892 charger settings for the round li-ion cells in the hinge,
+ * this is the main / biggest battery.
+ */
+static const struct property_entry lenovo_yt3_bq25892_1_props[] = {
+	PROPERTY_ENTRY_STRING_ARRAY("supplied-from", lenovo_yt3_bq25892_1_suppliers),
+	PROPERTY_ENTRY_STRING("linux,secondary-charger-name", "bq25890-charger-0"),
+	PROPERTY_ENTRY_U32("linux,iinlim-percentage", 60),
+	PROPERTY_ENTRY_U32("linux,pump-express-vbus-max", 12000000),
+	PROPERTY_ENTRY_BOOL("linux,skip-reset"),
+	/*
+	 * The firmware sets everything to the defaults, leading to a low(ish)
+	 * charge-current and battery-voltage of 2048mA resp 4.2V. Use the
+	 * Android values instead of "linux,read-back-settings" to fix this.
+	 */
+	PROPERTY_ENTRY_U32("ti,charge-current", 3072000),
+	PROPERTY_ENTRY_U32("ti,battery-regulation-voltage", 4352000),
+	PROPERTY_ENTRY_U32("ti,termination-current", 128000),
+	PROPERTY_ENTRY_U32("ti,precharge-current", 128000),
+	PROPERTY_ENTRY_U32("ti,minimum-sys-voltage", 3700000),
+	PROPERTY_ENTRY_BOOL("ti,use-ilim-pin"),
+	/* Set 5V boost current-limit to 1.2A (MAX/POR values are 2.45A/1.4A) */
+	PROPERTY_ENTRY_U32("ti,boost-voltage", 4998000),
+	PROPERTY_ENTRY_U32("ti,boost-max-current", 1200000),
+	{ }
+};
+
+static const struct software_node lenovo_yt3_bq25892_1_node = {
+	.properties = lenovo_yt3_bq25892_1_props,
+};
+
+/* bq25892 charger for the round li-ion cells in the hinge */
+static struct i2c_board_info lenovo_yoga_tab3_board_info = {
+	.type = "bq25892",
+	.addr = 0x6b,
+	.dev_name = "bq25892_1",
+	.swnode = &lenovo_yt3_bq25892_1_node,
+	.platform_data = &bq2589x_pdata,
+};
+
 static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
 {
 	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
@@ -459,6 +502,9 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
 	case INTEL_CHT_WC_LENOVO_YOGABOOK1:
 		board_info = &lenovo_yogabook1_board_info;
 		break;
+	case INTEL_CHT_WC_LENOVO_YT3_X90:
+		board_info = &lenovo_yoga_tab3_board_info;
+		break;
 	default:
 		dev_warn(&pdev->dev, "Unknown model, not instantiating charger device\n");
 		break;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F
  2022-11-27 18:22 [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Hans de Goede
  2022-11-27 18:22 ` [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models Hans de Goede
  2022-11-27 18:22 ` [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Hans de Goede
@ 2022-11-27 18:22 ` Hans de Goede
  2022-12-02 22:52   ` Chanwoo Choi
  2022-12-01 22:59 ` [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Wolfram Sang
  3 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-11-27 18:22 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones, MyungJoo Ham, Chanwoo Choi
  Cc: Hans de Goede, linux-i2c, linux-kernel

The Lenovo Yoga Tab 3 Pro YT3-X90F needs the same handling as
the Lenovo Yogabook models. That is it needs the extcon code to:

1. Control the Vbus regulator and USB-role-switch for the micro-USB
   port's host/device mode switching.
2. Register a power_supply device so that the charger-chip driver can
   see what sort of charger (SDP/CDP/DCP) is connected.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/extcon/extcon-intel-cht-wc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
index c45d7ff6cc61..323ab8731284 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -539,6 +539,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
 		cht_wc_extcon_set_gpio(ext, CHT_WC_VBUS_GPIO_CTLO, false);
 		break;
 	case INTEL_CHT_WC_LENOVO_YOGABOOK1:
+	case INTEL_CHT_WC_LENOVO_YT3_X90:
 		/* Do this first, as it may very well return -EPROBE_DEFER. */
 		ret = cht_wc_extcon_get_role_sw_and_regulator(ext);
 		if (ret)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code
  2022-11-27 18:22 [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Hans de Goede
                   ` (2 preceding siblings ...)
  2022-11-27 18:22 ` [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F Hans de Goede
@ 2022-12-01 22:59 ` Wolfram Sang
  3 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2022-12-01 22:59 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, MyungJoo Ham, Chanwoo Choi, linux-i2c, linux-kernel

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


> Wolfgang and MyungJoo or Chanwoo, can you please give your Ack for merging
> these through the MFD tree?

"Wolfram", please. Will do!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F
  2022-11-27 18:22 ` [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Hans de Goede
@ 2022-12-01 22:59   ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2022-12-01 22:59 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, MyungJoo Ham, Chanwoo Choi, linux-i2c, linux-kernel

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

On Sun, Nov 27, 2022 at 07:22:56PM +0100, Hans de Goede wrote:
> On x86 devices with a CHT Whiskey Cove PMIC the driver for
> the I2C bus coming from the PMIC is responsible for instantiating
> the i2c_client for the charger chip.
> 
> Add the necessary i2c_board_info for this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Wolfram Sang <wsa@kernel.org>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F
  2022-11-27 18:22 ` [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F Hans de Goede
@ 2022-12-02 22:52   ` Chanwoo Choi
  0 siblings, 0 replies; 7+ messages in thread
From: Chanwoo Choi @ 2022-12-02 22:52 UTC (permalink / raw)
  To: Hans de Goede, Wolfram Sang, Lee Jones, MyungJoo Ham,
	Chanwoo Choi
  Cc: linux-i2c, linux-kernel

On 22. 11. 28. 03:22, Hans de Goede wrote:
> The Lenovo Yoga Tab 3 Pro YT3-X90F needs the same handling as
> the Lenovo Yogabook models. That is it needs the extcon code to:
> 
> 1. Control the Vbus regulator and USB-role-switch for the micro-USB
>    port's host/device mode switching.
> 2. Register a power_supply device so that the charger-chip driver can
>    see what sort of charger (SDP/CDP/DCP) is connected.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/extcon/extcon-intel-cht-wc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
> index c45d7ff6cc61..323ab8731284 100644
> --- a/drivers/extcon/extcon-intel-cht-wc.c
> +++ b/drivers/extcon/extcon-intel-cht-wc.c
> @@ -539,6 +539,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>  		cht_wc_extcon_set_gpio(ext, CHT_WC_VBUS_GPIO_CTLO, false);
>  		break;
>  	case INTEL_CHT_WC_LENOVO_YOGABOOK1:
> +	case INTEL_CHT_WC_LENOVO_YT3_X90:
>  		/* Do this first, as it may very well return -EPROBE_DEFER. */
>  		ret = cht_wc_extcon_get_role_sw_and_regulator(ext);
>  		if (ret)

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

Thanks.

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-02 22:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-27 18:22 [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Hans de Goede
2022-11-27 18:22 ` [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models Hans de Goede
2022-11-27 18:22 ` [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Hans de Goede
2022-12-01 22:59   ` Wolfram Sang
2022-11-27 18:22 ` [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F Hans de Goede
2022-12-02 22:52   ` Chanwoo Choi
2022-12-01 22:59 ` [PATCH 0/3] mfd/i2c/extcon: Add Lenovo Yoga Tab 3 support to cht-wc PMIC code Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox