Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp511346rdb; Tue, 16 Jan 2024 07:19:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnmoPvN8T1HBovLLWnzVgYSigVPCoVChom7tdkmS3NX5sDJOki7QY4mp3B+lO7mNXBBCwJ X-Received: by 2002:a05:6359:3213:b0:175:9073:d6c with SMTP id rj19-20020a056359321300b0017590730d6cmr4304745rwb.20.1705418357323; Tue, 16 Jan 2024 07:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705418357; cv=none; d=google.com; s=arc-20160816; b=YFYQstS2p0D1ulTJwUCCNwgLT9xKArWnJrbSZnj+3ugwdQmBbueFICw/a/CFOQpL3X Ko6N0UqYw2AF5Gr9p4H8G6yQxBQ1wSX71S21wkggn+m6npkd9IXuzbzCDSzxG6N5bj5K drKL5GUnSDUNfSnBa80KzL7uPec+AU94qapyn3mfWiQVdNfargI0O9Ldl+454IJpu+PJ DUjVly3p9hrdN6qxaAGfWP7CuJ5bMqIFjghOb8j99XbF/aY3KVNBkSslAk1yy34nyfC6 hPHjkTxWGqU1spxNVHOBUblna6GVQahKr7st6dtg1YfgBoVgYPWW/6cBSo8sEb3yT/dB ZrDQ== ARC-Message-Signature: i=1; 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=FoyHuuu6JOkrgJmEO1WQrVNekwNO/GtnB/7ZC2zUcK8=; fh=D6kl0SHWW+WXCJDgw13GTngS26uxzD8e6enCJoJsTmQ=; b=AKrWlwO+Y9KRrh/x+hAu3Zij0GiSdeQqc7/z+8PdEFl5jPLS4VO/B/UE7iFLBFP49D bRxa5FO7hTHd+sw7b6BiSG8tvJkC3BaJ0/BeJxm/cU4er6kLabsTf2qJJmxGmWfPxId2 M5a4+h1xjzjl/TJgYbhGkl37sVFRNrCylihy2iti0xY+QPtSo0UNhMWA9Gs0A8ngnRRY hXkE1hK8wt9VQokV1I6L/tlxrfkO/vi0q6zgTQhlZFeymezZ+WupwtbVbNQwuKCsTcW/ PrESdaInEqmErVQoFsz6znsZ9iDVM6rNaIK5lFmqDeZQMVuaQhJMvV7JknEWqpbxAL3f oDBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27508-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c19-20020a637253000000b005cde387778esi11596581pgn.368.2024.01.16.07.19.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 07:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27508-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F0B2D285DF8 for ; Tue, 16 Jan 2024 15:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C16B51BF57; Tue, 16 Jan 2024 15:19:10 +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 019C91BF43 for ; Tue, 16 Jan 2024 15:19:08 +0000 (UTC) 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 1rPlD3-0000to-Uy; Tue, 16 Jan 2024 16:18:37 +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 1rPlD0-000Gxq-M0; Tue, 16 Jan 2024 16:18:34 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rPlD0-000D8R-1w; Tue, 16 Jan 2024 16:18:34 +0100 Message-ID: <800d202864c1730622a19998728c5a8b576d1931.camel@pengutronix.de> Subject: Re: [PATCH v3 5/5] i2c: muxes: pca954x: Allow sharing reset GPIO From: Philipp Zabel To: 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: Chris Packham , Bartosz Golaszewski , Sean Anderson Date: Tue, 16 Jan 2024 16:18:34 +0100 In-Reply-To: <20240112163608.528453-6-krzysztof.kozlowski@linaro.org> References: <20240112163608.528453-1-krzysztof.kozlowski@linaro.org> <20240112163608.528453-6-krzysztof.kozlowski@linaro.org> 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 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://lore.kernel.org/r/20240108041913.7078-1-chris.packham@allie= dtelesis.co.nz > Signed-off-by: Krzysztof Kozlowski >=20 > --- >=20 > If previous patches are fine, then this commit is independent and could > 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 abou= t */ > @@ -477,6 +481,35 @@ static int pca954x_init(struct i2c_client *client, s= truct pca954x *data) > return ret; > } > =20 > +static int pca954x_get_reset(struct device *dev, struct pca954x *data) > +{ > + data->reset_cont =3D devm_reset_control_get_optional_shared(dev, NULL); > + 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. > + data->reset_gpio =3D devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HI= GH); > + if (IS_ERR(data->reset_gpio)) { > + return dev_err_probe(dev, PTR_ERR(data->reset_gpio), > + "Failed to get reset gpio"); > + } > + > + return 0; > +} > + regards Philipp