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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA81C433F5 for ; Tue, 16 Nov 2021 11:46:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D580E61041 for ; Tue, 16 Nov 2021 11:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235251AbhKPLsJ (ORCPT ); Tue, 16 Nov 2021 06:48:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35372 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235177AbhKPLrq (ORCPT ); Tue, 16 Nov 2021 06:47:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637063089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sn/p/hpi6MBsSZpydt8wXcnaOACVPYaQAYfUrhLjl0U=; b=fcBY/L1jkS2zZTjwL+2ISOBeeHnuoDzjGEY59NnARAx6QwbDZqU0MhGcr3Zix7y9EUAQYC K41uUwFRoB2GZRKthRulfV9RIFsP9T0IHE5ZCaHggHYxhnIeg7nLnULU+Xe5NtRndabOf3 I0qHKhk13gEWera3JvtVtMfy6pHI+Lk= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-eN1oT_dYMcuoKfnXHmqGXQ-1; Tue, 16 Nov 2021 06:44:48 -0500 X-MC-Unique: eN1oT_dYMcuoKfnXHmqGXQ-1 Received: by mail-ed1-f69.google.com with SMTP id a3-20020a05640213c300b003e7d12bb925so4504291edx.9 for ; Tue, 16 Nov 2021 03:44:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=sn/p/hpi6MBsSZpydt8wXcnaOACVPYaQAYfUrhLjl0U=; b=p7pKZ2NmKDjtmP63StctTDVpjs8OkqnXdDThb81Pm5PxEm+ZnGP0yIdziHK8ACczSE ERzonGsF29xpaFMUF7HrB7eeUw3I0GBCkT9Aa1jgU9PQMsrpnPwaWnHQo5n8yuwagGoG DdGfL+x/bWpko8oavb6Gadg2j/fx2r3/XK4c0eDuZ/GVmGerxzP5/pcmJUnbx0oUaVlF Ols7kz02BxR4KXcncl23LRQKgxaPBMNqOb3F89KUjOgPxaFct4tiajt+9iVXa67vh5bC oMYXaPH3fbnE20li9txs6u8knJnxVNRQgJkghfHe1z8c71GGUtLLVMaNnjL3ydlJkXwy 4RGg== X-Gm-Message-State: AOAM532YU2vr1AhG4DRDFBeHMlHkIsFZl0ZQqxgvBCtyJ27aAn7NxKQJ +xPDDOKyRJJfWCjgtAI3HW7jDWnz/6U2j3+6m8E8N5WHhq6mEnMjedlLzJiJtwjyF65x5/9okFA uLfOPZbWIyCjnkSLEsNn6v5JU X-Received: by 2002:a05:6402:2067:: with SMTP id bd7mr9550767edb.240.1637063086380; Tue, 16 Nov 2021 03:44:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzl+WYnI6oc2LxPoz+q8exWpOVk572rEKUnSYZcWrd7WcpL0tMOeQOrW251/QM6n9GAYMBdXg== X-Received: by 2002:a05:6402:2067:: with SMTP id bd7mr9550745edb.240.1637063086237; Tue, 16 Nov 2021 03:44:46 -0800 (PST) Received: from ?IPV6:2001:1c00:c1e:bf00:1054:9d19:e0f0:8214? (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id hv17sm8328203ejc.66.2021.11.16.03.44.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Nov 2021 03:44:45 -0800 (PST) Message-ID: Date: Tue, 16 Nov 2021 12:44:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2 15/20] i2c: cht-wc: Make charger i2c-client instantiation board/device-model specific Content-Language: en-US To: Andy Shevchenko Cc: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Len Brown , ACPI Devel Maling List , Yauhen Kharuzhy , Tsuchiya Yuto , Platform Driver , linux-i2c , Linux PM , Linux Kernel Mailing List , linux-efi References: <20211114170335.66994-1-hdegoede@redhat.com> <20211114170335.66994-16-hdegoede@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/16/21 12:20, Andy Shevchenko wrote: > On Sun, Nov 14, 2021 at 7:04 PM 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 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