Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp325046rdb; Wed, 17 Jan 2024 03:16:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHG9g6odTFV8CnKsv1RpUXXFAlNnahummTRH/ZmCwYLAno1QDpASei3GTCHyY3rx0IK0tiE X-Received: by 2002:a17:907:2d29:b0:a2b:a7e:3494 with SMTP id gs41-20020a1709072d2900b00a2b0a7e3494mr5253340ejc.10.1705490205346; Wed, 17 Jan 2024 03:16:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705490205; cv=pass; d=google.com; s=arc-20160816; b=TjQAwlSQWqMWl8mE+PblDzhNYSCSarmY6AI9QwsVOnOtzRuTuDdRJzJHQH7PU2ACaS MGr1tbdfc+NCapbtFQHBmHi0PSj6QfrfWsA6fvlPgJfA/sQZEY/aIz0DPep8PzKsDV8m y3hT9naRQWlxk15E0Ak8+/WxPC5uj+CCEKYsY17aHvcLlTBbtDbrFvUxLUpzZyMPLO4T YqVGSEJ2PP3bvOu/SpEnxlXV+Po6h1+A+G9NHhSZYxzMWPCyASqKMH3P4QG7lhyleR80 +yyXY/p082HyKC9OjmnWgyzs8MbI4f18/yGxptxga1uVlzcjYjtIHd9iJWa66tLPO57J KOGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=zaiHuW/mn5M1uhKnIvig8/IMRPhUjSl8fHFrRu7Pjbc=; fh=Vq6cJ28JYHRGij71USatXCjBV9cb4x8UK4TEDyLcncw=; b=NhXPVXeP3fmhBqgHlsYmJxKkcQSZ2ujlNveSgOlOdKOEcGx94LX6DzeOuAHKhbu029 uEPLxmnMsV6diFO3FQ8n78KjlYLDGxSc6uK8E5BYS1Dt6c12sNsNXpgBa2z/q8/MOVc/ b5tCcg/i6r0TNmCyWE10hWr5mx1N0eSlMCmtFVjNuhvY//2cofDmgkpcuQ4ac9Ucm/2a 7TZQ+rSl4cjjDhrhean6vuVHwVImAfrRMHjCpezd2kUu4sNXh897ALTEX8AT3qvxpWY3 Gse4TLDnROyNwkwJii9ElYClimcISwzY1G9yIB+unV6Fb8Z870bo93ZT4CUH+3pW2v+e P5Yw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-28900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28900-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hh11-20020a170906a94b00b00a26ae0332f6si5690315ejb.5.2024.01.17.03.16.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 03:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-28900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28900-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E24101F2486B for ; Wed, 17 Jan 2024 11:16:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8BE01DDE0; Wed, 17 Jan 2024 11:16:36 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1ACB1DDD0 for ; Wed, 17 Jan 2024 11:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705490196; cv=none; b=cQ96An9+3gGE3FD+A95ysUMrxvnVWmomYMLpqN6EedvzchOMvJzdBu2mEVLplJjB5dyCHE2pX7hA3Cr9AQB47FkrA/cIMiwkkiV8cTkplT1jxAeZctMuWxY388+IkC5AQmJBIy/o+mP39XZVBbl/zcNjLj8lQBA0wjoizIm63fI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705490196; c=relaxed/simple; bh=5qKlaLziljLZ5noa6CzlpJUbxw1PitV5B5D7RLl7cCY=; h=Received:Received:Received:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version:X-SA-Exim-Connect-IP:X-SA-Exim-Mail-From: X-SA-Exim-Scanned:X-PTX-Original-Recipient; b=PwMPQlkPgu820fjBYtD7xnDQ4s4Y9BgE5Ffogzl+Wq7rLcqWmlNnMvQ9eU3ZT55bh0sdf7IsHAgVdbPOpkLHu8uNYX9WYIGzVc+QcgAp5fiX3/EzthSWirInkZrD0PxBG+34HPgO0lX60xiD+fl+6Cvf8E4jbXlKvN9lUnT2TOU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rQ3tx-0002Yp-2t; Wed, 17 Jan 2024 12:16:09 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQ3tt-000S1i-0W; Wed, 17 Jan 2024 12:16:05 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rQ3ts-0004u3-31; Wed, 17 Jan 2024 12:16:04 +0100 Message-ID: <568f2bcb1bea01c36f59650d5cc5a84612197f8b.camel@pengutronix.de> Subject: Re: [PATCH v3 5/5] i2c: muxes: pca954x: Allow sharing reset GPIO From: Philipp Zabel To: Chris Packham , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Rosin , Jaroslav Kysela , Takashi Iwai , "linux-arm-msm@vger.kernel.org" , "alsa-devel@alsa-project.org" , "linux-sound@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-i2c@vger.kernel.org" Cc: Bartosz Golaszewski , Sean Anderson Date: Wed, 17 Jan 2024 12:16:04 +0100 In-Reply-To: <4c6c5d07-ac53-4da9-93e0-1286ca5eb44b@alliedtelesis.co.nz> References: <20240112163608.528453-1-krzysztof.kozlowski@linaro.org> <20240112163608.528453-6-krzysztof.kozlowski@linaro.org> <800d202864c1730622a19998728c5a8b576d1931.camel@pengutronix.de> <4c6c5d07-ac53-4da9-93e0-1286ca5eb44b@alliedtelesis.co.nz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Di, 2024-01-16 at 19:58 +0000, Chris Packham wrote: > On 17/01/24 04:18, Philipp Zabel wrote: > > On Fr, 2024-01-12 at 17:36 +0100, Krzysztof Kozlowski wrote: > > > From: Chris Packham > > >=20 > > > Some hardware designs with multiple PCA954x devices use a reset GPIO > > > connected to all the muxes. Support this configuration by making use = of > > > the reset controller framework which can deal with the shared reset > > > GPIOs. Fall back to the old GPIO descriptor method if the reset > > > controller framework is not enabled. > > >=20 > > > Signed-off-by: Chris Packham > > > Acked-by: Peter Rosin > > > Reviewed-by: Krzysztof Kozlowski > > > Link: https://scanmail.trustwave.com/?c=3D20988&d=3D8p6m5Tfi2yYJWYV9x= YGcYnz7UYxB6WTGTPkmGu7b8A&u=3Dhttps%3a%2f%2flore%2ekernel%2eorg%2fr%2f20240= 108041913%2e7078-1-chris%2epackham%40alliedtelesis%2eco%2enz > > > Signed-off-by: Krzysztof Kozlowski > > >=20 > > > --- > > >=20 > > > If previous patches are fine, then this commit is independent and cou= ld > > > be taken via I2C. > > >=20 > > > Cc: Chris Packham > > > Cc: Bartosz Golaszewski > > > Cc: Sean Anderson > > > --- > > > drivers/i2c/muxes/i2c-mux-pca954x.c | 46 ++++++++++++++++++++++++--= --- > > > 1 file changed, 38 insertions(+), 8 deletions(-) > > >=20 > > > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/= i2c-mux-pca954x.c > > > index 2219062104fb..1702e8d49b91 100644 > > > --- a/drivers/i2c/muxes/i2c-mux-pca954x.c > > > +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c > > > @@ -49,6 +49,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -102,6 +103,9 @@ struct pca954x { > > > unsigned int irq_mask; > > > raw_spinlock_t lock; > > > struct regulator *supply; > > > + > > > + struct gpio_desc *reset_gpio; > > > + struct reset_control *reset_cont; > > > }; > > > =20 > > > /* Provide specs for the MAX735x, PCA954x and PCA984x types we know= about */ > > > @@ -477,6 +481,35 @@ static int pca954x_init(struct i2c_client *clien= t, struct pca954x *data) > > > return ret; > > > } > > > =20 > > > +static int pca954x_get_reset(struct device *dev, struct pca954x *dat= a) > > > +{ > > > + data->reset_cont =3D devm_reset_control_get_optional_shared(dev, NU= LL); > > > + if (IS_ERR(data->reset_cont)) > > > + return dev_err_probe(dev, PTR_ERR(data->reset_cont), > > > + "Failed to get reset\n"); > > > + else if (data->reset_cont) > > > + return 0; > > > + > > > + /* > > > + * fallback to legacy reset-gpios > > > + */ > > devm_reset_control_get_optional_shared() won't return NULL if the > > "reset-gpios" property is found in the device tree, so the GPIO > > fallback is dead code. >=20 > Hmm, I was attempting to handle the case where CONFIG_RESET_GPIO wasn't= =20 > set [...] > [...] it looks like we'd get -EPROBE_DEFER. I could change to check > for that or just remove the GPIO fallback entirely. Any preference? I hadn't considered this. If CONFIG_RESET_GPIO=3Dn, devm_reset_control_get_optional_shared() probably shouldn't return -EPROBE_DEFER. If we change that, the GPIO fallback here can stay as is. The alternative would be to drop the fallback and select RESET_GPIO. Using -EPROBE_DEFER for fallback detection is no good, as there could be a valid probe deferral if reset-gpio is compiled as a module that will be loaded later. regards Philipp