From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1FB4371 for ; Thu, 9 Feb 2023 09:02:36 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id bg26so970636wmb.0 for ; Thu, 09 Feb 2023 01:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=FC97GopJvrXLbn2PKKUSbpHzg6otGN8/TmQ45fLzCwg=; b=LGXbmHpD82SwO7t5GHJRbL9D9tnGJBSbJlXfWcp/0FH9N84f2Sa13M0Re9YHbDoyhg YPINzA85tPnpsiS45W+IRgN8BP7ND5XOFV8iri4ZAyz9uDeaK4qQbL1BXngATrjsua5i NSKPbaEH9+rAVkrRRMGb9fTB3PUUPutZBWzYztXMlo0eInA0cWi8U4Q7mgEmhUivgjpO ehJiOPvzW7Fa0H0YsS+0gNjEF3MciPQ2ZY1wcuDxBQznbhm1iVtNn0uAt0dqryAGpE0C rkkJahjNJOR82mfmYbg2jDdpktGf+ifYLxNksidRLVjKl98KZU0nmFBFxb8Dlecb8nzu oJ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FC97GopJvrXLbn2PKKUSbpHzg6otGN8/TmQ45fLzCwg=; b=YngvvVyAIACFkGpdWwEhAaUIeY6GGXCtAZWaKalZh5/Xz3FdsKyHNZH0lw67tqN1Z4 4nDU+RraN4zieh508c3kVHqfeoA54Ok8fEZhI5AqHn6pIP8h6RnSuaCwPIUOU53y+CiF IwTNa8+ck9fISkoBSWM21F62YTouvlre8pQ/7uuJPj4Sm0ERcrbjIQc1xt7J4q8dE4Ni B82D7Ks5A3bkLkGctqAiinJ3flDm9h6zqd03mBiq5S6Hk3U38+nS1M6mPlYMkf9PZMii rGXVwqk39PyrEfq1UEasj31vFeO71n6L48lHT7A+XFOETZy2ZMv/JfjipJ5LidRN/iHA yjrw== X-Gm-Message-State: AO0yUKV9NUWlO9hSfd/5wh3mSTaZ9AMPAjwm7TNAQ1Ry2dBNtZj3XLJw Um3GMT5f+Ve1pIgwJakpigw= X-Google-Smtp-Source: AK7set/OIOma0JSIKRu7iGW0p18KEvtZnF5RX5xn4Okviz+X/IXGT3ecqTS1iIBjUDnxtjjbArLbzA== X-Received: by 2002:a05:600c:4f85:b0:3df:f127:efa7 with SMTP id n5-20020a05600c4f8500b003dff127efa7mr3746626wmq.22.1675933354740; Thu, 09 Feb 2023 01:02:34 -0800 (PST) Received: from orome (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id m1-20020a7bce01000000b003e0010a9f67sm4394680wmc.44.2023.02.09.01.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 01:02:34 -0800 (PST) Date: Thu, 9 Feb 2023 10:02:32 +0100 From: Thierry Reding To: Dipen Patel Cc: jonathanh@nvidia.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-gpio@vger.kernel.org, linus.walleij@linaro.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, robh+dt@kernel.org, timestamp@lists.linux.dev Subject: Re: [PATCH 2/7] hte: Add Tegra234 provider Message-ID: References: <20221103174523.29592-1-dipenp@nvidia.com> <20221103174523.29592-3-dipenp@nvidia.com> <1a186be2-498a-a63b-a383-c165a9f8e732@nvidia.com> <2cc8378a-3f74-d4b5-613d-f9112806ec92@nvidia.com> Precedence: bulk X-Mailing-List: timestamp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3s7xSXdBBpM6Hx5L" Content-Disposition: inline In-Reply-To: <2cc8378a-3f74-d4b5-613d-f9112806ec92@nvidia.com> User-Agent: Mutt/2.2.9 (2022-11-12) --3s7xSXdBBpM6Hx5L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 27, 2022 at 04:43:48PM -0800, Dipen Patel wrote: > On 11/29/22 7:00 PM, Dipen Patel wrote: > > On 11/11/22 8:01 AM, Thierry Reding wrote: > >> On Thu, Nov 03, 2022 at 10:45:18AM -0700, Dipen Patel wrote: > >>> The Tegra234 AON GPIO instance and LIC IRQ support HTE. For the GPIO > >>> HTE support, it requires to add mapping between GPIO and HTE framewor= k. > >>> > >>> Signed-off-by: Dipen Patel > >>> --- > >>> drivers/hte/hte-tegra194-test.c | 2 +- > >>> drivers/hte/hte-tegra194.c | 124 ++++++++++++++++++++++++++++++= -- > >>> 2 files changed, 121 insertions(+), 5 deletions(-) > >>> > >>> diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra1= 94-test.c > >>> index 5d776a185bd6..d79c28a80517 100644 > >>> --- a/drivers/hte/hte-tegra194-test.c > >>> +++ b/drivers/hte/hte-tegra194-test.c > >>> @@ -16,7 +16,7 @@ > >>> #include > >>> =20 > > >>> MODULE_DEVICE_TABLE(of, tegra_hte_of_match); > >>> @@ -635,8 +742,17 @@ static int tegra_hte_probe(struct platform_devic= e *pdev) > >>> =20 > >>> gc->match_from_linedata =3D tegra_hte_match_from_linedata; > >>> =20 > >>> - hte_dev->c =3D gpiochip_find("tegra194-gpio-aon", > >>> - tegra_get_gpiochip_from_name); > >>> + if (of_device_is_compatible(dev->of_node, > >>> + "nvidia,tegra194-gte-aon")) > >>> + hte_dev->c =3D gpiochip_find("tegra194-gpio-aon", > >>> + tegra_get_gpiochip_from_name); > >>> + else if (of_device_is_compatible(dev->of_node, > >>> + "nvidia,tegra234-gte-aon")) > >>> + hte_dev->c =3D gpiochip_find("tegra234-gpio-aon", > >>> + tegra_get_gpiochip_from_name); > >>> + else > >>> + return -ENODEV; > >> > >> I'm wondering: instead of doing this cumbersome lookup, perhaps it wou= ld > >> be easier to create a direct link to the right GPIO controller with a > >> phandle? > > Possible, need to see if gpiod framework has API exposed to get the gpi= ochip from > > the phandle. >=20 > Thierry, I can not find any API which can help retrieve gpio_chip from th= e GPIO controller > phandle. I need gpio_chip->base to map GPIO line to GTE mapping. gpiochip_find() should allow you to implement that. So instead of tegra_get_gpiochip_from_name() you could implement a function that matches on the phandle that you've read from the HTE node. You could probably add such a helper to the GPIO core, since it seems to me like it would be universally helpful. Actually there's of_find_gpiochip_by_node() in gpiolib-of.c already, so you could propose to export it for external users. Thierry --3s7xSXdBBpM6Hx5L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmPktqgACgkQ3SOs138+ s6EpbxAAk28C3+2tpKxyVTrcXW2ws04VXUjVf2QP535J0kRWuq9f9bo81P0Fd4XZ gQocbe5T1MRIePkqRYvZcXE5omLA7ATUVOxZHSiBOUkM0QtHe14WAN7xQ3AFeK5b 2R9Tx3HNmj2BOE666UCflda/OqkOOCqSf8R1Y0JL+efzK+80ve4nutR1ycJTJG7R IWYwKTAraLvlUKmDhMtTerojVM7tknVKI1vYjeZKaXKfcDCgbUmgd3AkP4Bvu5HZ bx/pBuscvukEcoTR7hofMnaHrBSSFeWIiNga6GgiWqdbubHathCVRZWFqvMifD1k j5Cxi1LPUa4sNBBCiD+kt2lmlO2QAD2vL3ra9KHKhQ4G0fO1OTfMnd1f+ZBKP6u2 BQ7U3CrmF+v8DkDxCENIjMPzbwu5HlNKKfROEXBjGx5zwqdzjkoO6pOSUliOGJAH jaormuuNAt+meL+o6SxpxHkHhwFdN+zv2cTU2SLM5s0ju7JwGriRyB5MbqhTQNoA iAL8DW0pLxbr5fdJZMj9YBScq29eLfm62CDRn8l3mUOteDbGF0eDUquaKLDZFo0f iPcQW5Z6ujzjue/95CiqnXDAgCZ/NNOlrVBc+HiWr7WxVP3vIrfzEsz/g6Dx4LTf EO/ZwokCmEMsfY7OsWX6ZNyVERbLLpsfznAzMAVKg0p+FwjZ4FU= =RZDR -----END PGP SIGNATURE----- --3s7xSXdBBpM6Hx5L--