From nobody Fri Dec 19 02:50:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FE09C47088 for ; Sun, 27 Nov 2022 18:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbiK0SYQ (ORCPT ); Sun, 27 Nov 2022 13:24:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiK0SYN (ORCPT ); Sun, 27 Nov 2022 13:24:13 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6250B636B for ; Sun, 27 Nov 2022 10:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669573394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SspE+TBwWSr9TCW1N3as9/TtY9hK2M85GwILDRXgC3E=; b=WPREulSUC4V4eX+VQN4oLftMzYoWF+jFEZ89HUFygCrFvLg1R+/lV5jipgmhMu890iAno0 zmh6DxVMC0rMYLCa/aHU/19sDDMmnK3WYmJTjuwWr3YjZQfPIuHNm1OqFWAqEjajzyOKr3 VwlU0XcW4F+wB2khHBZfWOl1jdoynuc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-375-NPVO82XUNsek8f9bZ6Bryw-1; Sun, 27 Nov 2022 13:23:11 -0500 X-MC-Unique: NPVO82XUNsek8f9bZ6Bryw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8201D185A78F; Sun, 27 Nov 2022 18:23:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BDF849BB61; Sun, 27 Nov 2022 18:23:09 +0000 (UTC) From: Hans de Goede To: Wolfram Sang , Lee Jones , MyungJoo Ham , Chanwoo Choi Cc: Hans de Goede , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Tab 3 X90F to intel_cht_wc_models Date: Sun, 27 Nov 2022 19:22:55 +0100 Message-Id: <20221127182257.104410-2-hdegoede@redhat.com> In-Reply-To: <20221127182257.104410-1-hdegoede@redhat.com> References: <20221127182257.104410-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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_pmi= c_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= [] =3D { /* Non exact match to match all versions */ DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), }, + }, { + /* Lenovo Yoga Tab 3 Pro YT3-X90F */ + .driver_data =3D (void *)(long)INTEL_CHT_WC_LENOVO_YT3_X90, + .matches =3D { + 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_s= oc_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, }; =20 /** --=20 2.38.1 From nobody Fri Dec 19 02:50:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED5E6C46467 for ; Sun, 27 Nov 2022 18:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229662AbiK0SY2 (ORCPT ); Sun, 27 Nov 2022 13:24:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiK0SYS (ORCPT ); Sun, 27 Nov 2022 13:24:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B396364 for ; Sun, 27 Nov 2022 10:23:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669573398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SXx0cfDGf4zqnICsNky1w2M79w0a2NmEGAvIq2j1/rc=; b=UPvEvWlCjWDSXLBXr66FFzaNz7r3vaKeJRHzhEXKed6XHrQF702G0bzejShIImUSGZ1P15 kW+wnoQmp5feC8ZSjC8Yy15h1e8HEa4kMw1d2018YCLd/nY1vz2yuaUiaDQBUxGydDWABN zJ1xJ+18CETE9s59+CWrfbnBerdOJ30= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-389-0vOp5uyqNIKVlk_6Fu1Avg-1; Sun, 27 Nov 2022 13:23:12 -0500 X-MC-Unique: 0vOp5uyqNIKVlk_6Fu1Avg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BADAE811E67; Sun, 27 Nov 2022 18:23:11 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7ACC49BB61; Sun, 27 Nov 2022 18:23:10 +0000 (UTC) From: Hans de Goede To: Wolfram Sang , Lee Jones , MyungJoo Ham , Chanwoo Choi Cc: Hans de Goede , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Date: Sun, 27 Nov 2022 19:22:56 +0100 Message-Id: <20221127182257.104410-3-hdegoede@redhat.com> In-Reply-To: <20221127182257.104410-1-hdegoede@redhat.com> References: <20221127182257.104410-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Acked-by: Wolfram Sang --- 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-w= c.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_in= fo =3D { .platform_data =3D &bq2589x_pdata, }; =20 +/********** Lenovo Yogabook YT3-X90F charger settings **********/ +static const char * const lenovo_yt3_bq25892_1_suppliers[] =3D { "cht_wcov= e_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[] =3D { + PROPERTY_ENTRY_STRING_ARRAY("supplied-from", lenovo_yt3_bq25892_1_supplie= rs), + 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 =3D { + .properties =3D 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 =3D { + .type =3D "bq25892", + .addr =3D 0x6b, + .dev_name =3D "bq25892_1", + .swnode =3D &lenovo_yt3_bq25892_1_node, + .platform_data =3D &bq2589x_pdata, +}; + static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) { struct intel_soc_pmic *pmic =3D dev_get_drvdata(pdev->dev.parent); @@ -459,6 +502,9 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_de= vice *pdev) case INTEL_CHT_WC_LENOVO_YOGABOOK1: board_info =3D &lenovo_yogabook1_board_info; break; + case INTEL_CHT_WC_LENOVO_YT3_X90: + board_info =3D &lenovo_yoga_tab3_board_info; + break; default: dev_warn(&pdev->dev, "Unknown model, not instantiating charger device\n"= ); break; --=20 2.38.1 From nobody Fri Dec 19 02:50:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC7CAC43217 for ; Sun, 27 Nov 2022 18:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiK0SYW (ORCPT ); Sun, 27 Nov 2022 13:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiK0SYS (ORCPT ); Sun, 27 Nov 2022 13:24:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B097C2BC9 for ; Sun, 27 Nov 2022 10:23:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669573397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oUUOOM+io2yL6/ixiTAeA+s/v26tWSqdvBE3wNHNXLY=; b=f485tosK/kPgrIAaq0LTKPrZBtgC2ABzT+IwA2Dj1wtHV9QC5d5vA0CqXt8Cl7OEaXRkEo DjdwH1lBp6yErPWmxXN34Jamy8P7xRaWJydB3QFpszGHGq+wTo3CHz9MPpKxKWbvnMFRUj 67SgmppS69Fhi29OPLZAMWVPGLzQCsU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-575-awcEhEt8N0W9NCSnDDNNQg-1; Sun, 27 Nov 2022 13:23:13 -0500 X-MC-Unique: awcEhEt8N0W9NCSnDDNNQg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F061D185A78F; Sun, 27 Nov 2022 18:23:12 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE99349BB61; Sun, 27 Nov 2022 18:23:11 +0000 (UTC) From: Hans de Goede To: Wolfram Sang , Lee Jones , MyungJoo Ham , Chanwoo Choi Cc: Hans de Goede , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] extcon: intel-cht-wc: Add support for Lenovo Yoga Tab 3 Pro YT3-X90F Date: Sun, 27 Nov 2022 19:22:57 +0100 Message-Id: <20221127182257.104410-4-hdegoede@redhat.com> In-Reply-To: <20221127182257.104410-1-hdegoede@redhat.com> References: <20221127182257.104410-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Acked-by: Chanwoo Choi --- 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-i= ntel-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 =3D cht_wc_extcon_get_role_sw_and_regulator(ext); if (ret) --=20 2.38.1