Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5550189pxb; Sun, 7 Nov 2021 14:59:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwnzslcuMHIPm/FPLn+QO+YuuRjlp5DHifqQigSwSmQRM3dBt0AW9P9dumsy0/iga13v9Jo X-Received: by 2002:a05:6638:2512:: with SMTP id v18mr8791102jat.22.1636325985717; Sun, 07 Nov 2021 14:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636325985; cv=none; d=google.com; s=arc-20160816; b=NXtw3IfmPVmzrBVcUj05kX0VgVgGHi5IKKsMGzGmN//fsQKJ8y0/qXGUgXZsKhbSkp AwNcGhmBj2drwuBUzYh7vDnvLT0hzOgCQz7nbn2zIfY7fTPRr3gnsCjhRuQFYvUjxg2R KOFRGtmOJiBQXo0ROGGjjQtjsmEuqFO+d/Zkg+eMzniVvjfztdL1RhZoauHsxMOPbPoL i86eAhyJ9hixXtZhO+izmBFMsflStYA+zRCclMDcblHrYxnPSOrW8oL3MxGcPikt+M+I SuVezAUhhyyFW0wv34nvprGpUNbl1H4vRJD4eKoIKktyukq8uSNOHDmH3w9W45nrNmE3 f0fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AMhYT7f4HHOrvM2BB+7ftAJk6+0NTI3CufI8tmE9/eE=; b=f05QmsJKrC3iIgCBXE/Kk+bCLPfE4gxj/KscT4T3aF/7wRJ3sZI28dk4u29NJrSNeb Kb3JpLCL/a/yjMNJg7gtkUqYf2Hqpu7ELv0RuRYc3156q1d8pV/YpiaXahZ8HPL/zQ6g GGp1K2qLP60LB6q/BSXDk/mWvoXm2k4dVBRSs88flgc4qjdkwOACDrPg98XLXSLc814g WGOnk6RtU1lcYwRR20CVVutGb8GvMlU8dQxy0izBMURwBT0wTcBTJWISjkEjx2clMAq6 43HfeaZ6D5a+y6CGevdaJhRwP8LFq6+N/FaODtlb/Jb1VCnWkUcTlQlBNCTftK1eWfgp qYxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="L/a0tecF"; 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 f18si19303271ils.25.2021.11.07.14.59.33; Sun, 07 Nov 2021 14:59:45 -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="L/a0tecF"; 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 S236049AbhKGSUa (ORCPT + 99 others); Sun, 7 Nov 2021 13:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235313AbhKGSUa (ORCPT ); Sun, 7 Nov 2021 13:20:30 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 002D0C061570 for ; Sun, 7 Nov 2021 10:17:46 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id f4so53232552edx.12 for ; Sun, 07 Nov 2021 10:17:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AMhYT7f4HHOrvM2BB+7ftAJk6+0NTI3CufI8tmE9/eE=; b=L/a0tecF+6Csq7xpUisZ2Ayxbv6Q/1vCBWRxzrADHJC10FTqlunqo9gT7RtjH0U4Br 6JsPpuzaeDPfSSe6NmibLkB0oAxF6dWefjlFyhtPJUkaH16Z3U7/RLtIoR/J5BuYIDsq NxzYEYG8ujHGAmWSx8QzivLTCqsWfjUI92lhJpVY8yCsMXCodnadqZfeF9v01kT4B8G0 fMvCUFbssSSMTG5BFPbL2QIN7WcJ615kIChatrlOeRQan27sCeLBqUjTMfROOfj+1LjA rECagCLphAb7xKjKVabu05Sq9U+GaqbaUudA45IBdp/DYj7O68mO79b2an1MPTlklzzc HtWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AMhYT7f4HHOrvM2BB+7ftAJk6+0NTI3CufI8tmE9/eE=; b=artxFBX8h6aC1kPjM6k6lu88Arjk7Ibk3o9chTB8PM8faGiPvkcUu7DyqccfDuC0K3 B1G1PhVg/qryEX9kcqObq8iK6Ropbrv+rw33nlwBUuIHDip8u0mJ58CPXtDm7NcJtD2C UVf6HQ1QZlg2MTRb4V9VfEM+HUdF+oA4+0HERE/stqejyW/BHD4ynWXhLzuEqa3Ck8H/ hOcQtTLQtrf1ARIlZCZZtcvQN9FAeYp8Ky5wVCeBaoYF9i4LFOG4rOV4s/9f5iySZ0GE LVW8e9WO6heW61uolMNM5yJA5BGNkMupDrqCPVuxy7Y1ULi97Qc+3CG8+ZO9jEWHNUlP YHiQ== X-Gm-Message-State: AOAM530IFndV87KGmf9TdXBcMYZ5qLQlbTHlK3od5Ka8x1x8JtURHmir p4Z8otaF/v9ZNjNTCbleyOoXE36d2/TUcEi0f74= X-Received: by 2002:a17:906:2887:: with SMTP id o7mr88058024ejd.425.1636309064681; Sun, 07 Nov 2021 10:17:44 -0800 (PST) MIME-Version: 1.0 References: <20211107172641.288491-1-hdegoede@redhat.com> In-Reply-To: <20211107172641.288491-1-hdegoede@redhat.com> From: Andy Shevchenko Date: Sun, 7 Nov 2021 20:17:08 +0200 Message-ID: Subject: Re: [PATCH] mfd: intel_soc_pmic: Use CPU-id check instead of _HRV check to differentiate variants To: Hans de Goede Cc: Andy Shevchenko , Lee Jones , Linux Kernel Mailing List , Tsuchiya Yuto Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 7, 2021 at 7:26 PM Hans de Goede wrote: > > The Intel Crystal Cove PMIC has 2 different variants, one for use with > Bay Trail (BYT) SoCs and one for use with Cherry Trail (CHT) SoCs. > > So far we have been using an ACPI _HRV check to differentiate between > the 2, but at least on the Microsoft Surface 3, which is a CHT device, > the wrong _HRV value is reported by ACPI. > > So instead switch to a CPU-ID check which avoids us relying on the > possibly wrong ACPI _HRV value. Thanks, I hope Tsuchiya will test this soon, from code perspective it looks good to me, Reviewed-by: Andy Shevchenko > Reported-by: Tsuchiya Yuto > Signed-off-by: Hans de Goede > --- > drivers/mfd/intel_soc_pmic_core.c | 28 +++------------------------- > 1 file changed, 3 insertions(+), 25 deletions(-) > > diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c > index ddd64f9e3341..47cb7f00dfcf 100644 > --- a/drivers/mfd/intel_soc_pmic_core.c > +++ b/drivers/mfd/intel_soc_pmic_core.c > @@ -14,15 +14,12 @@ > #include > #include > #include > +#include > #include > #include > > #include "intel_soc_pmic_core.h" > > -/* Crystal Cove PMIC shares same ACPI ID between different platforms */ > -#define BYT_CRC_HRV 2 > -#define CHT_CRC_HRV 3 > - > /* PWM consumed by the Intel GFX */ > static struct pwm_lookup crc_pwm_lookup[] = { > PWM_LOOKUP("crystal_cove_pwm", 0, "0000:00:02.0", "pwm_pmic_backlight", 0, PWM_POLARITY_NORMAL), > @@ -34,31 +31,12 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, > struct device *dev = &i2c->dev; > struct intel_soc_pmic_config *config; > struct intel_soc_pmic *pmic; > - unsigned long long hrv; > - acpi_status status; > int ret; > > - /* > - * There are 2 different Crystal Cove PMICs a Bay Trail and Cherry > - * Trail version, use _HRV to differentiate between the 2. > - */ > - status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_HRV", NULL, &hrv); > - if (ACPI_FAILURE(status)) { > - dev_err(dev, "Failed to get PMIC hardware revision\n"); > - return -ENODEV; > - } > - > - switch (hrv) { > - case BYT_CRC_HRV: > + if (soc_intel_is_byt()) > config = &intel_soc_pmic_config_byt_crc; > - break; > - case CHT_CRC_HRV: > + else > config = &intel_soc_pmic_config_cht_crc; > - break; > - default: > - dev_warn(dev, "Unknown hardware rev %llu, assuming BYT\n", hrv); > - config = &intel_soc_pmic_config_byt_crc; > - } > > pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); > if (!pmic) > -- > 2.31.1 > -- With Best Regards, Andy Shevchenko