2023-01-26 15:39:23

by Hans de Goede

[permalink] [raw]
Subject: [PATCH v2 resend 0/3] mfd: intel_soc_pmic_chtwc + cell drivers Lenovo Yoga Tab 3 YT3-X90F support

Hi Lee, et. al.

Here is a resend of my patch series to add support for
the Lenovo Yoga Tab 3 YT3-X90F tablet to the intel_soc_pmic_chtwc
driver + 2 of the drivers for instantiated mfd-cells.

This is unmodified from the previous version except for
having acks from the i2c, resp. extcon subsys maintainers
for routing the entire series through the MFD tree.

Still I have marked this as v2, to distuingish this from the resend
of patches 2-3 yesterday, which I did because I was under the wrong
impression that patch 1/3 was already merged.

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.39.0



2023-01-26 15:39:31

by Hans de Goede

[permalink] [raw]
Subject: [PATCH v2 resend 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F

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.

Acked-by: Wolfram Sang <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
---
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.39.0


2023-01-26 15:39:33

by Hans de Goede

[permalink] [raw]
Subject: [PATCH v2 resend 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F

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.

Acked-by: Chanwoo Choi <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
---
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 89a6449e3f4a..2c55f06ba699 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -537,6 +537,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
cht_wc_extcon_set_5v_boost(ext, 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.39.0


2023-02-04 13:05:40

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v2 resend 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F

On Thu, 26 Jan 2023, 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.
>
> Acked-by: Wolfram Sang <[email protected]>
> Signed-off-by: Hans de Goede <[email protected]>
> ---
> drivers/i2c/busses/i2c-cht-wc.c | 46 +++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)

Applied, thanks

--
Lee Jones [李琼斯]

2023-02-04 13:07:13

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v2 resend 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F

On Thu, 26 Jan 2023, 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.
>
> Acked-by: Chanwoo Choi <[email protected]>
> Signed-off-by: Hans de Goede <[email protected]>
> ---
> drivers/extcon/extcon-intel-cht-wc.c | 1 +
> 1 file changed, 1 insertion(+)

Applied, thanks

--
Lee Jones [李琼斯]

2023-02-04 13:19:44

by Lee Jones

[permalink] [raw]
Subject: [GIT PULL] Immutable branch between MFD, Extcon and I2C due for the v6.3 merge window

Enjoy!

The following changes since commit 1b929c02afd37871d5afb9d498426f83432e71c2:

Linux 6.2-rc1 (2022-12-25 13:41:39 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-extcon-i2c-v6.3

for you to fetch changes up to 783422d00d7d8f7725dc781fcd3cfcaae13595e5:

extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F (2023-02-04 13:05:42 +0000)

----------------------------------------------------------------
Immutable branch between MFD, Extcon and I2C due for the v6.3 merge window

----------------------------------------------------------------
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(+)

--
Lee Jones [李琼斯]