Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5700466pxb; Sun, 7 Nov 2021 18:17:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVexYXVCfNyLSXR9BMQmpag1aBkJCOpKTMliA3rB0VE1Zvd4n9q91E+e/y0ja5Zs7bGEJC X-Received: by 2002:a05:6602:2f04:: with SMTP id q4mr10914857iow.123.1636337876486; Sun, 07 Nov 2021 18:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636337876; cv=none; d=google.com; s=arc-20160816; b=kFdI/WpwdHsU7JDj43VVPOM4AIu6TqvmsV1snxxPUJJ9PXF3t+L5adLJxbaxLziSYO 9eUaseXIN7mFwAfoR90Lr3oQ1+7TYMQdAMkwUnQZKhDaOuih4n3fYfG4vUC4znHEozIV 2AyswncbZLsdNPz0EcU/sRMnNoxbZmrewrehmkrOA5s8Cbxo338hJ1N8jYnQwAjwluoZ IitzJRfP3Yq7Hc9LAv6IxLfvOSw9gA3wC5Zhu3SwapU0APy2L01nPkBLYtUIdPrINTwU 3aT2Je8ZZ6NR62wT7h6hPB4UhrGfuyJMqbjzoUyybr/pplOduApPS9Z2P6+oZWa6Eevc 3RWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JQSgFGKQfcK4tDVKYXGmiQZ5K9YhZUxXc1mNLrrVvWk=; b=Y0YXKGuA0O88FMq4v+NI0TLpUb6X18ivGgpeknfBkR8wf5vipFwzyn3mdodLCm4PnE 3akEuWIwbSKFPx792NnMQtAKGKVVtBixjPELKuw//uc5AgXbFNPPBRkUSIOjG2fOPy1i cin5vKc15lX0NLh3wzsCyaYETUl8eQasTCprPgVED1QcTpJJsAL+cCfpFIsMkgi14e1R Bgsi+J8E9Lcm3z/UYBxrTgK9AbWElQihFRzHtPPhQA1Eh38IlTPmhyfcE4Z9t7v139Nu ywGNX2A+9uy1LkRRI3crRyMHS6qg+dnn17BWTSsdP9pcl/PrCYb+WxeIlLlpNaJGBaOn Z4HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kcTtXUXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si34023442iov.75.2021.11.07.18.17.44; Sun, 07 Nov 2021 18:17:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kcTtXUXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233418AbhKGTiK (ORCPT + 99 others); Sun, 7 Nov 2021 14:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhKGTiI (ORCPT ); Sun, 7 Nov 2021 14:38:08 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1E08C061570; Sun, 7 Nov 2021 11:35:24 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id l22so4591294lfg.7; Sun, 07 Nov 2021 11:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JQSgFGKQfcK4tDVKYXGmiQZ5K9YhZUxXc1mNLrrVvWk=; b=kcTtXUXmbCdeYgb87QlO1BWDCIQOqE49CRoRq4Q8QvNaBJ90jzYSvKGMTYAMplrTEE c9YwvCzXXJgzpGcgyIF5jokl3v14nXyH2nE/ev/DfD0gHVQ4bcmZarBGe1OJSdPoYD6Y VVwkz8vPL3dn2qpRY6Os7fLCwj+qCnQAmgSx045KxyGHT3kjYB8YxvBeFIX7a74LHz72 FVAHfCzrZc97cEg0/aNx9IaOrAduXUsg24XWjO3cJLCY9bkuTzTyQ+Xbw/PgQknws21H 48SEc9OciTYsTtyTs65zDvFDyPAYAm50d12vfHXr9aZH5gT7EHlGNU3GVKf9qM5Rf+2Q 4ueQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JQSgFGKQfcK4tDVKYXGmiQZ5K9YhZUxXc1mNLrrVvWk=; b=hdgT/zsyGC/EJK1Q9fnyTeXYSOIKlA+YTjSfqDea7K/onqCMDOpdigPyk9WbFmQnit teN1WDIcDrOitoaen6t8n+kM7C8zf/WGoRGI7W4Jqkpxel5G0MiDd3HGkFUa9ivjQQ5Q qt2cnIOVs+px1pznxhlc1cS36SP0jN6M3MAOIU1rxbdSRb01HFbaHnFGqyq2av3kLJA9 WkUdfnNP4dZAe+ulU4gpt6W8x5Ct3F93pR4Si5huwVKj3DigW7B2xuYXx2Uf07I6FWEJ o8zCxmhJEg6A+AlDh3Xh30l3zJhd7yw5Kxr0fRHFU0Orf/l81fAj/75suHA/MjH+W/4d ICUg== X-Gm-Message-State: AOAM532jeznmUTvfeNzbVdqYje/N2VABCCMsbs1iwohGC1bGyrxAdbSw jlrp6n5JDqxZXVH5P9nFO5E= X-Received: by 2002:a05:6512:3501:: with SMTP id h1mr69003798lfs.235.1636313723048; Sun, 07 Nov 2021 11:35:23 -0800 (PST) Received: from localhost.localdomain ([37.45.143.17]) by smtp.gmail.com with ESMTPSA id f6sm1482828ljk.45.2021.11.07.11.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 11:35:22 -0800 (PST) Received: from jek by localhost.localdomain with local (Exim 4.95) (envelope-from ) id 1mjnwn-000DvT-6W; Sun, 07 Nov 2021 22:35:21 +0300 Date: Sun, 7 Nov 2021 22:35:21 +0300 From: Yauhen Kharuzhy To: Hans de Goede Cc: Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Tsuchiya Yuto , platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH 11/13] i2c: cht-wc: Add support for devices using a bq25890 charger Message-ID: References: <20211030182813.116672-1-hdegoede@redhat.com> <20211030182813.116672-12-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 07, 2021 at 10:07:27PM +0300, Yauhen Kharuzhy wrote: > On Sat, Oct 30, 2021 at 08:28:11PM +0200, Hans de Goede wrote: > > The i2c-controller on the Cherry Trail - Whiskey Cove PMIC is special > > in that it is always connected to the I2C charger IC of the board on > > which the PMIC is used; and the charger IC is not described in ACPI, > > so the i2c-cht-wc code needs to instantiate an i2c-client for it itself. > > > > So far there has been a rudimentary check to make sure the ACPI tables > > are at least somewhat as expected by checking for the presence of an > > INT33FE device and sofar the code has assumed that if this INT33FE > > device is present that the used charger then is a bq24290i. > > > > But some boards with an INT33FE device in their ACPI tables use a > > different charger IC and some boards don't have an INT33FE device at all. > > > > Since the information about the used charger + fuel-gauge + other chips is > > necessary in other places too, the kernel now adds a "intel,cht-wc-setup" > > string property to the Whiskey Cove PMIC i2c-client based on DMI matching, > > which reliably describes the board's setup of the PMIC. > > > > Switch to using the "intel,cht-wc-setup" property and add support for > > instantiating an i2c-client for either a bq24292i or a bq25890 charger. > > > > This has been tested on a GPD pocket (which uses the old bq24292i setup) > > and on a Xiaomi Mi Pad 2 with a bq25890 charger. > > > > Signed-off-by: Hans de Goede > > --- > > drivers/i2c/busses/i2c-cht-wc.c | 77 +++++++++++++++++++++++++-------- > > 1 file changed, 59 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c > > index 1cf68f85b2e1..e7d62af6c39d 100644 > > --- a/drivers/i2c/busses/i2c-cht-wc.c > > +++ b/drivers/i2c/busses/i2c-cht-wc.c > > @@ -18,6 +18,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > #define CHT_WC_I2C_CTRL 0x5e24 > > @@ -304,18 +305,55 @@ static struct bq24190_platform_data bq24190_pdata = { > > .regulator_init_data = &bq24190_vbus_init_data, > > }; > > > > +static struct i2c_board_info bq24190_board_info = { > > + .type = "bq24190", > > + .addr = 0x6b, > > + .dev_name = "bq24190", > > + .swnode = &bq24190_node, > > + .platform_data = &bq24190_pdata, > > +}; > > + > > +static struct regulator_consumer_supply bq25890_vbus_consumer = { > > + .supply = "vbus", > > + .dev_name = "cht_wcove_pwrsrc", > > +}; > > + > > +static const struct regulator_init_data bq25890_vbus_init_data = { > > + .constraints = { > > + .valid_ops_mask = REGULATOR_CHANGE_STATUS, > > + }, > > + .consumer_supplies = &bq25890_vbus_consumer, > > + .num_consumer_supplies = 1, > > +}; > > + > > +static struct bq25890_platform_data bq25890_pdata = { > > + .regulator_init_data = &bq25890_vbus_init_data, > > +}; > > + > > +static const struct property_entry bq25890_props[] = { > > + PROPERTY_ENTRY_BOOL("ti,skip-init"), > > + { } > > +}; > > The Lenovo Yoga Book firmware set the IINLIM field to 500 mA at > initialization, we need a way to pass maximum allowed current in the fast > charging mode to driver. I have added 'ti,input-max-current' in my port, for > example. ICHG (charging current limit) is too low also (2A versus 4A in Android sources for this device), so it should be set by properties. -- Yauhen Kharuzhy