From: Cristian Marussi <cristian.marussi@arm.com>
To: "Clément Le Goffic" <clegoffic@baylibre.com>
Cc: Sudeep Holla <sudeep.holla@kernel.org>,
Cristian Marussi <cristian.marussi@arm.com>,
Linus Walleij <linusw@kernel.org>, Peng Fan <peng.fan@nxp.com>,
Oleksii Moisieiev <oleksii_moisieiev@epam.com>,
Andy Shevchenko <andy@kernel.org>, Dhruva Gole <d-gole@ti.com>,
Bartosz Golaszewski <brgl@kernel.org>,
arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/11] pinctrl: scmi: select the GPIO function on GPIO requests
Date: Tue, 10 Nov 2026 13:49:25 +0000 [thread overview]
Message-ID: <avMg5XmU8uSzPR4s@pluto> (raw)
In-Reply-To: <20261030-clegoffic-pinctrl-scmi-gpio-v1-11-52d92843ad97@baylibre.com>
On Fri, Oct 30, 2026 at 04:58:42PM +0100, Clément Le Goffic wrote:
> On a GPIO request, select the GPIO function of the pin, on the pin for a
> pin-only function or on its single-pin group. Without a GPIO function the
> mux is left as it is.
>
> Signed-off-by: Clément Le Goffic <clegoffic@baylibre.com>
> ---
> drivers/pinctrl/pinctrl-scmi.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c
> index 6f44e8c0fee6..ba649304638e 100644
> --- a/drivers/pinctrl/pinctrl-scmi.c
> +++ b/drivers/pinctrl/pinctrl-scmi.c
> @@ -74,6 +74,69 @@ static int pinctrl_scmi_free(struct pinctrl_dev *pctldev, unsigned int offset)
> return pinctrl_ops->pin_free(pmx->ph, offset);
> }
>
> +static int pinctrl_scmi_gpio_mux_set(struct scmi_pinctrl *pmx, unsigned int pin)
> +{
> + const unsigned int *elems, *pins;
> + unsigned int nr_elems, nr_pins, i;
> + bool pin_only, gpio;
> + int nr_functions, func, ret;
Beside nr_functions, cannot all of these variable definitions be moved
inside the scope in which they are exclusively used, i.e. down inside
the for-loop ?
> +
> + nr_functions = pinctrl_ops->count_get(pmx->ph, FUNCTION_TYPE);
> + for (func = 0; func < nr_functions; func++) {
> + ret = pinctrl_ops->function_flags_get(pmx->ph, func, &pin_only,
> + &gpio);
> + if (ret)
> + return ret;
> +
> + if (!gpio)
> + continue;
> +
> + ret = pinctrl_ops->function_groups_get(pmx->ph, func, &nr_elems,
> + &elems);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < nr_elems; i++) {
> + if (pin_only) {
> + if (elems[i] != pin)
> + continue;
> +
> + return pinctrl_ops->pin_mux_set(pmx->ph, func,
> + pin);
> + }
> +
> + ret = pinctrl_ops->group_pins_get(pmx->ph, elems[i],
> + &pins, &nr_pins);
> + if (ret)
> + return ret;
> +
> + if (nr_pins == 1 && pins[0] == pin)
> + return pinctrl_ops->mux_set(pmx->ph, func,
> + elems[i]);
> + }
So it is a possibility that in the above loops nothing is set..and it is
fine should AFAIU...but should we log/debug something in both cases to ease
troubleshooting ? (maybe just a stupid question ...)
Thanks,
Cristian
next prev parent reply other threads:[~2026-11-10 13:49 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 15:58 [PATCH 00/11] pinctrl: scmi: fixes and GPIO function support Clément Le Goffic
2026-10-30 15:58 ` [PATCH 01/11] pinctrl: scmi: send the drive strength in microamperes Clément Le Goffic
2026-11-10 11:01 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 02/11] pinctrl: scmi: map the schmitt trigger enable to its SCMI type Clément Le Goffic
2026-11-10 11:04 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 03/11] pinctrl: scmi: send the settings without argument as enabled Clément Le Goffic
2026-11-10 11:05 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 04/11] pinctrl: scmi: report an off setting as not set Clément Le Goffic
2026-11-03 11:38 ` Andy Shevchenko
2026-11-04 9:32 ` Clément Le Goffic
2026-11-10 11:24 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 05/11] firmware: arm_scmi: stop reading past PINCTRL_LIST_ASSOCIATIONS replies Clément Le Goffic
2026-11-10 10:27 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 06/11] firmware: arm_scmi: report the pin-only and GPIO flags of functions Clément Le Goffic
2026-10-30 15:58 ` [PATCH 07/11] pinctrl: scmi: give no groups to pin-only functions Clément Le Goffic
2026-11-10 11:48 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 08/11] pinctrl: scmi: mark the GPIO functions Clément Le Goffic
2026-11-10 13:16 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 09/11] pinctrl: scmi: report whether a function is GPIO Clément Le Goffic
2026-10-30 15:58 ` [PATCH 10/11] firmware: arm_scmi: add an operation to set the function of a single pin Clément Le Goffic
2026-11-10 13:20 ` Cristian Marussi
2026-10-30 15:58 ` [PATCH 11/11] pinctrl: scmi: select the GPIO function on GPIO requests Clément Le Goffic
2026-11-03 11:41 ` Andy Shevchenko
2026-11-04 9:38 ` Clément Le Goffic
2026-11-04 10:55 ` Andy Shevchenko
2026-11-05 12:58 ` Clément Le Goffic
2026-11-10 13:49 ` Cristian Marussi [this message]
2026-11-10 14:09 ` Andy Shevchenko
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=avMg5XmU8uSzPR4s@pluto \
--to=cristian.marussi@arm.com \
--cc=andy@kernel.org \
--cc=arm-scmi@vger.kernel.org \
--cc=brgl@kernel.org \
--cc=clegoffic@baylibre.com \
--cc=d-gole@ti.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksii_moisieiev@epam.com \
--cc=peng.fan@nxp.com \
--cc=sudeep.holla@kernel.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®