From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: neil.armstrong@linaro.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Banajit Goswami <bgoswami@quicinc.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Frank Rowand <frowand.list@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Chris Packham <chris.packham@alliedtelesis.co.nz>,
Sean Anderson <sean.anderson@seco.com>
Subject: Re: [PATCH v5 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios
Date: Mon, 29 Jan 2024 09:46:13 +0100 [thread overview]
Message-ID: <63e9ab78-3e5a-4d2f-8a67-c002142ca852@linaro.org> (raw)
In-Reply-To: <91158620-775e-4db1-9b8e-7154c6d66cd6@linaro.org>
On 25/01/2024 09:27, neil.armstrong@linaro.org wrote:
> On 24/01/2024 08:45, Krzysztof Kozlowski wrote:
>> Devices sharing a reset GPIO could use the reset framework for
>> coordinated handling of that shared GPIO line. We have several cases of
>> such needs, at least for Devicetree-based platforms.
>>
>> If Devicetree-based device requests a reset line, while "resets"
>> Devicetree property is missing but there is a "reset-gpios" one,
>> instantiate a new "reset-gpio" platform device which will handle such
>> reset line. This allows seamless handling of such shared reset-gpios
>> without need of changing Devicetree binding [1].
>>
>> To avoid creating multiple "reset-gpio" platform devices, store the
>> Devicetree "reset-gpios" GPIO specifiers used for new devices on a
>> linked list. Later such Devicetree GPIO specifier (phandle to GPIO
>> controller, GPIO number and GPIO flags) is used to check if reset
>> controller for given GPIO was already registered.
>>
>> If two devices have conflicting "reset-gpios" property, e.g. with
>> different ACTIVE_xxx flags, this would allow to spawn two separate
>> "reset-gpio" devices, where the second would fail probing on busy GPIO
>> request.
>>
>> Link: https://lore.kernel.org/all/YXi5CUCEi7YmNxXM@robh.at.kernel.org/ [1]
>> Cc: Bartosz Golaszewski <brgl@bgdev.pl>
>> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> Cc: Sean Anderson <sean.anderson@seco.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Depends on previous of change.
>> ---
>> drivers/reset/core.c | 215 +++++++++++++++++++++++++++++--
>> include/linux/reset-controller.h | 4 +
>> 2 files changed, 206 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
>> index 4d5a78d3c085..60a8a33c4419 100644
>> --- a/drivers/reset/core.c
>> +++ b/drivers/reset/core.c
>
> <snip>
>
>> + }
>> +
>> + ret = __reset_add_reset_gpio_lookup(id, args->np, args->args[0],
>> + args->args[1]);
>
> What would happen with gpio controllers using #gpio-cells = <3> (or more) like allwinner,sun4i-a10-pinctrl.yaml ?
>
> On this example the flags are args->args[2] so this would probably fail.
>
> This would also fails badly with #gpio-cells = <1>, args->args[1] value would be undefined.
>
> You should probably limit to args->args_count == 2 for now.
Hm, good point. Both cells are actually possible, so I need to check it.
Thanks.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-01-29 8:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 7:45 [PATCH v5 0/6] reset: gpio: ASoC: shared GPIO resets Krzysztof Kozlowski
2024-01-24 7:45 ` [PATCH v5 1/6] of: Add of_phandle_args_equal() helper Krzysztof Kozlowski
2024-01-24 22:07 ` Rob Herring
2024-01-25 9:43 ` Philipp Zabel
2024-01-24 7:45 ` [PATCH v5 2/6] cpufreq: do not open-code of_phandle_args_equal() Krzysztof Kozlowski
2024-01-24 7:45 ` [PATCH v5 3/6] reset: gpio: Add GPIO-based reset controller Krzysztof Kozlowski
2024-01-25 9:43 ` Philipp Zabel
2024-01-24 7:45 ` [PATCH v5 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios Krzysztof Kozlowski
2024-01-25 8:02 ` Krzysztof Kozlowski
2024-01-25 8:49 ` Bartosz Golaszewski
2024-01-25 8:27 ` neil.armstrong
2024-01-29 8:46 ` Krzysztof Kozlowski [this message]
2024-01-25 9:43 ` Philipp Zabel
2024-01-24 7:45 ` [PATCH v5 5/6] ASoC: dt-bindings: qcom,wsa8840: Add reset-gpios for shared line Krzysztof Kozlowski
2024-01-24 7:45 ` [PATCH v5 6/6] ASoC: codecs: wsa884x: Allow sharing reset GPIO Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63e9ab78-3e5a-4d2f-8a67-c002142ca852@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=andersson@kernel.org \
--cc=bgoswami@quicinc.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=perex@perex.cz \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sean.anderson@seco.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).