From: Philipp Zabel <p.zabel@pengutronix.de>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Banajit Goswami <bgoswami@quicinc.com>,
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>,
"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>,
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-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 v4 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios
Date: Tue, 23 Jan 2024 16:06:47 +0100 [thread overview]
Message-ID: <b9d2e1e5fd8b5022890e05fcc33410360e0d11d7.camel@pengutronix.de> (raw)
In-Reply-To: <20240123141311.220505-5-krzysztof.kozlowski@linaro.org>
On Di, 2024-01-23 at 15:13 +0100, 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>
I'm nearly out of complaints, two tiny cosmetic issues remaining:
[...]
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 4d5a78d3c085..6e81b8d35055 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
[...]
> @@ -813,12 +838,161 @@ static void __reset_control_put_internal(struct reset_control *rstc)
> kref_put(&rstc->refcnt, __reset_control_release);
> }
>
> +static int __reset_add_reset_gpio_lookup(int id, struct device_node *np,
> + unsigned int gpio,
> + unsigned int of_flags)
> +{
> + unsigned int lookup_flags;
> + const char *label_tmp;
> +
> + /*
> + * Later we map GPIO flags between OF and Linux, however not all
> + * constants from include/dt-bindings/gpio/gpio.h and
> + * include/linux/gpio/machine.h match each other.
> + */
> + if (of_flags > GPIO_ACTIVE_LOW) {
> + pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n",
> + of_flags, gpio);
Alignment to parenthesis is slightly off.
> + return -EINVAL;
> + }
> +
> + struct gpio_device *gdev __free(gpio_device_put) = gpio_device_find_by_fwnode(of_fwnode_handle(np));
Adding a local fwnode variable would make this fit in the 100 character
limit again.
regards
Philipp
next prev parent reply other threads:[~2024-01-23 15:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 14:13 [PATCH v4 0/6] reset: gpio: ASoC: shared GPIO resets Krzysztof Kozlowski
2024-01-23 14:13 ` [PATCH v4 1/6] of: Add of_phandle_args_equal() helper Krzysztof Kozlowski
2024-01-23 14:54 ` Philipp Zabel
2024-01-23 14:13 ` [PATCH v4 2/6] cpufreq: do not open-code of_phandle_args_equal() Krzysztof Kozlowski
2024-01-23 14:55 ` Philipp Zabel
2024-01-24 5:56 ` Viresh Kumar
2024-01-23 14:13 ` [PATCH v4 3/6] reset: gpio: Add GPIO-based reset controller Krzysztof Kozlowski
2024-01-23 14:13 ` [PATCH v4 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios Krzysztof Kozlowski
2024-01-23 15:06 ` Philipp Zabel [this message]
2024-01-24 7:28 ` Krzysztof Kozlowski
2024-01-23 15:58 ` Philipp Zabel
2024-01-24 7:29 ` Krzysztof Kozlowski
2024-01-23 14:13 ` [PATCH v4 5/6] ASoC: dt-bindings: qcom,wsa8840: Add reset-gpios for shared line Krzysztof Kozlowski
2024-01-23 14:13 ` [PATCH v4 6/6] ASoC: codecs: wsa884x: Allow sharing reset GPIO Krzysztof Kozlowski
2024-01-23 15:07 ` Philipp Zabel
2024-01-23 19:28 ` [PATCH v4 0/6] reset: gpio: ASoC: shared GPIO resets Chris Packham
2024-01-24 7:25 ` 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=b9d2e1e5fd8b5022890e05fcc33410360e0d11d7.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--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=krzysztof.kozlowski@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=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
all inboxes | Powered by JetHome®