Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2159460pxp; Mon, 7 Mar 2022 09:29:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqK1Wvy+9gKke7qhoQf620BSKr7np6P9VwlqRyEkRL09F6at8nlwLi8KEzmHyFTiIOPV23 X-Received: by 2002:a17:907:7b86:b0:6da:8a95:35bf with SMTP id ne6-20020a1709077b8600b006da8a9535bfmr9722747ejc.652.1646674146814; Mon, 07 Mar 2022 09:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646674146; cv=none; d=google.com; s=arc-20160816; b=zgM1AiZao8gPKUCnnf29K6+zitoyec5WOWVx3wERyA8rHerKkN/AcOlKDG90FjH21y 5qaGHTBANEgvB5TBRWwrhdAeF7s88zuuW4StZ8yHk9bBLpjpeEWSNaLrW26Zqd/RDHoM nJ9lJ6h2hd/mJ3Qt9ZskS9RXo4j/guNpIHsr01FoTlvNgwJ7NJFzChYScM357AlPcRBq iGX1yAZWQ7MsMq7Ev2VhcDebcATUnzoYXprWM9jzdwajhL/grZ1xM676nBWu2s2rgmEw 3oOMEnixjP1UUiVBfEB59XRYYBQ5ZCc37990IcL4h5+qmnYPPEHrxoa41JNlIA77rIgE //Kg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tLF7Vqm/MokjXYyJgUoQC6rHN9RDfGgaeSS+6MW4O9k=; b=ErSJlcUeodDvhGpqQ+4DYfyZcrytyZWuXlvkVdMZrqWG+N1GRtOuoxYQrLFdCoQtrz Vz+HsX3EzHfMjclIOpyrDbaF2iKugjOkj7dvVCQcMPzKo7IWlY2EZal0+pcSduB4kyq6 UWoQcv+3c5DsI6Ly4ld9Rvr90UQ2cCQ5vMUml2OZxtjJgEHC/nz/A7tLgp2Fxe+3odRK SYBwwV+laOX0i01h7mcS1Upbl166Fxz86gi5Keaw3MTsf0Tel3Kmvz6bNFTWaOfRNSXj h3pxoI/XgQdBW6gI+BhN6RMlN4ANV0u5GDLYRzSeWlruYZ/TPge+LhqWViJANZZlNB8j Cx+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=if8Ns1oV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a50d688000000b00410be8b4034si8924876edi.329.2022.03.07.09.28.44; Mon, 07 Mar 2022 09:29:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=if8Ns1oV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243487AbiCGOxn (ORCPT + 99 others); Mon, 7 Mar 2022 09:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243657AbiCGOww (ORCPT ); Mon, 7 Mar 2022 09:52:52 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E629026E for ; Mon, 7 Mar 2022 06:51:41 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id q14so8148953wrc.4 for ; Mon, 07 Mar 2022 06:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=tLF7Vqm/MokjXYyJgUoQC6rHN9RDfGgaeSS+6MW4O9k=; b=if8Ns1oVLlLSj8htpo7xBHeUDQbgcDkQ4JBdR7ySBz3R0u3lRdpO6o9WOVIHQkLqoP 60grUoSIbC4oeVFI/pmhh01pdjS1WNJKRiglOwRCVQ4yg+/jkpDZYueKeAPhfOg/2ipx YxepXgkTbnt9v8+5gMA/yIxLsvYsfZBxg/cio5R0e9bk4UHqS7RqJX2FTFMTb5GvV3j3 qo9j+Xjb7aWFhS4kqiMj7udB29lNN24u8gtC9plQok4UuYBOjLKKMF4awUY+1zHTTlIX lm0oJasrfU/20tGHkc9M7SY7/z5xcN3YEHrUDyEiF//LccelPaL5THDdulxw9JACGv6R 8RBA== 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:content-transfer-encoding :in-reply-to; bh=tLF7Vqm/MokjXYyJgUoQC6rHN9RDfGgaeSS+6MW4O9k=; b=b+Q8lLqnYPIwrHAXcoQM4VLfbIKuFs3SCg/sja3N6VnbFttx031Vvl7regXpfMkgDG kCteva491EL/2cWDWR+lAo800+D60fFW2qVvL1//samBqoaISZcFezvi5xZISbuqad65 YlWbZHigr9hvkU03KjLN/147ACeCO0MtS7R+oXttPa7V6fMqxFW2SKMNgimivse8G+72 NaNYl6MdRfpCJ+x6DCOuQeovm2LRwWLx7sU9By3j3xKpPaSn9UU4+5Z8ZT3yJyn1cUSO 8WHOmQmJYO8hAzdOY8FHZPAUCSibk470Bmz5avpRMbA9J8Ng54Vcd5Oy8sqKTThbOUdT BurQ== X-Gm-Message-State: AOAM532yXgAxDhzm4szKlTxzEnur2iLcqNpRvUHE0aUYQqVJm2zkDFwk sc5DaZwodaHgy8MArEsJb+rDBg== X-Received: by 2002:adf:d1cc:0:b0:1f0:4570:bf75 with SMTP id b12-20020adfd1cc000000b001f04570bf75mr8705611wrd.656.1646664698673; Mon, 07 Mar 2022 06:51:38 -0800 (PST) Received: from google.com (cpc155339-bagu17-2-0-cust87.1-3.cable.virginm.net. [86.27.177.88]) by smtp.gmail.com with ESMTPSA id g17-20020a5d4891000000b001e74e998bf9sm11502846wrq.33.2022.03.07.06.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 06:51:38 -0800 (PST) Date: Mon, 7 Mar 2022 14:51:36 +0000 From: Lee Jones To: Hans de Goede Cc: patches@opensource.cirrus.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mfd: arizona-spi: Add Android board ACPI table handling Message-ID: References: <20220223134222.730886-1-hdegoede@redhat.com> <20220223134222.730886-2-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220223134222.730886-2-hdegoede@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Feb 2022, Hans de Goede wrote: > x86/ACPI boards with an arizona WM5102 codec ship with either Windows or > Android as factory installed OS. > > The ACPI fwnode for the codec on Android boards misses 2 things compared > to the Windows boards (this is hardcoded in the Android board kernels): > > 1. There is no CLKE ACPI method to enabe the 32 KHz clock the codec needs > for jack-detection. > > 2. The GPIOs used by the codec are not listed in the fwnode for the codec. > > The ACPI tables on x86/ACPI boards shipped with Android being incomplete > happens a lot. The special drivers/platform/x86/x86-android-tablets.c > module contains DMI based per model handling to compensate for this. > > This module will enable the 32KHz clock through the pinctrl framework > to fix 1. and it will also register a gpio-lookup table for all GPIOs > needed by the codec + machine driver, including the GPIOs coming from > the codec itself. > > Add an arizona_spi_acpi_android_probe() function which waits for the > x86-android-tablets to have set things up before continue with probing > the arizona WM5102 codec. > > Signed-off-by: Hans de Goede > --- > drivers/mfd/arizona-spi.c | 34 +++++++++++++++++++++++++++++++++- > 1 file changed, 33 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c > index 238355542ab1..2c686e71db21 100644 > --- a/drivers/mfd/arizona-spi.c > +++ b/drivers/mfd/arizona-spi.c > @@ -81,6 +81,29 @@ static int arizona_spi_acpi_windows_probe(struct arizona *arizona) > return 0; > } > > +/* For ACPI tables from boards which ship with Android as factory OS */ > +static int arizona_spi_acpi_android_probe(struct arizona *arizona) > +{ > + int ret; > + > + /* > + * Get the reset GPIO, treating -ENOENT as -EPROBE_DEFER to wait for > + * the x86-android-tablets module to register the board specific GPIO > + * lookup table. > + */ > + arizona->pdata.reset = devm_gpiod_get(arizona->dev, "reset", GPIOD_OUT_LOW); > + if (IS_ERR(arizona->pdata.reset)) { > + ret = PTR_ERR(arizona->pdata.reset); > + if (ret == -ENOENT) { > + dev_info_once(arizona->dev, "Deferring probe till GPIO lookup is registered\n"); Nit: How many chars is this? I thought we were drawing the line at 100 these days? Does this patch pass checkpatch.pl? > + ret = -EPROBE_DEFER; > + } > + return dev_err_probe(arizona->dev, ret, "getting reset GPIO\n"); > + } > + > + return 0; > +} > + > /* > * The AOSP 3.5 mm Headset: Accessory Specification gives the following values: > * Function A Play/Pause: 0 ohm > @@ -102,9 +125,14 @@ static const struct arizona_micd_range arizona_micd_aosp_ranges[] = { > > static int arizona_spi_acpi_probe(struct arizona *arizona) > { > + struct acpi_device *adev = ACPI_COMPANION(arizona->dev); > int ret; > > - ret = arizona_spi_acpi_windows_probe(arizona); > + if (acpi_dev_hid_uid_match(adev, "10WM5102", NULL)) > + ret = arizona_spi_acpi_android_probe(arizona); > + else > + ret = arizona_spi_acpi_windows_probe(arizona); > + > if (ret) > return ret; > > @@ -142,6 +170,10 @@ static const struct acpi_device_id arizona_acpi_match[] = { > .id = "WM510205", > .driver_data = WM5102, > }, > + { > + .id = "10WM5102", > + .driver_data = WM5102, > + }, > { } > }; > MODULE_DEVICE_TABLE(acpi, arizona_acpi_match); -- Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog