[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec96c45c-4715-c605-a5d1-edfa5b498639@redhat.com>
Date: Tue, 16 Nov 2021 12:44:45 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Mark Gross <markgross@...nel.org>,
Andy Shevchenko <andy@...radead.org>,
Wolfram Sang <wsa@...-dreams.de>,
Sebastian Reichel <sre@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Ard Biesheuvel <ardb@...nel.org>, Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Yauhen Kharuzhy <jekhor@...il.com>,
Tsuchiya Yuto <kitakar@...il.com>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
linux-i2c <linux-i2c@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-efi <linux-efi@...r.kernel.org>
Subject: Re: [PATCH v2 15/20] i2c: cht-wc: Make charger i2c-client
instantiation board/device-model specific
Hi,
On 11/16/21 12:20, Andy Shevchenko wrote:
> On Sun, Nov 14, 2021 at 7:04 PM Hans de Goede <hdegoede@...hat.com> 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 this was hardcoded to instantiate an i2c-client for the
>> bq24292i, with all properties, etc. set to match how this charger
>> is used on the GPD win and GPD pcoket devices.
>
> "pocket" I believe?
>
>> There is a rudimentary check to make sure the ACPI tables are at least
>> somewhat as expected, but this is far from accurate, leading to
>> a wrong i2c-client being instantiated for the charger on some boards.
>>
>> Switch to the new DMI based intel_cht_wc_get_model() helper which is
>> exported by the MFD driver for the CHT Whiskey Cove PMIC to help PMIC
>> cell drivers like the i2c-cht-wc code reliably detect which board
>> they are running on.
>>
>> And add board_info for the charger ICs as found on the other 2 known
>> boards with a Whisky Cove PMIC.
>>
>> This has been tested on all 3 known boards.
>
> ...
>
>> +/********** Lenovo Yogabook YB1-X90F/-X91F/-X91L charger settings **********/
>> +static const char * const lenovo_yb1_bq25892_suppliers[] = {
>> + "cht_wcove_pwrsrc" };
>
> Something went wrong with indentation...
>
> ...
>
>> + /*
>> + * The firmware sets everything to the defaults, which leads to a
>> + * somewhat low charge-current of 2048mA and worse to a batter-voltage
>
> battery?
>
>> + * of 4.2V instead of 4.35V (when booted without a charger connected).
>> + * Use our own values instead of "linux,read-back-settings" to fix this.
>> + */
>
> ...
Ack to all of the above remarks.
>
>> + switch (intel_cht_wc_get_model()) {
>> + case INTEL_CHT_WC_GPD_WIN_POCKET:
>> + board_info = &gpd_win_board_info;
>> + break;
>> + case INTEL_CHT_WC_XIAOMI_MIPAD2:
>> + board_info = &xiaomi_mipad2_board_info;
>> + break;
>> + case INTEL_CHT_WC_LENOVO_YOGABOOK1:
>> + board_info = &lenovo_yogabook1_board_info;
>> + break;
>> + default:
>> + dev_warn(&pdev->dev, "Unknown model, not instantiating charger device\n");
>
> break;
Why ? Having a default without a break at the end of a switch-case
is quite a normal thing to do.
>
>> + }
>
Regards,
Hams
Powered by blists - more mailing lists