All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-gpio@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 4/5] pinctrl: Add Cortina Systems CS7542 pin multiplexer
Date: Mon, 23 Nov 2026 18:55:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-229885@kernel.org> (raw)
In-Reply-To: <20261123-cs7542-syscon-v1-4-49858e631449@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] pinctrl: cs7542: missing function_is_gpio() breaks strict
  GPIO requests
--

commit e26847f7ebd3df4b67ad59e0473df47cbaeaa5df
Author: Fil Dunsky <filipp.dunsky@gmail.com>

pinctrl: Add Cortina Systems CS7542 pin multiplexer

This commit adds a pin multiplexer driver for the Cortina Systems CS7542
SoC supporting GPIO on all 160 lines and six UART pins via the global
syscon regmap.

> diff --git a/drivers/pinctrl/pinctrl-cs7542.c b/drivers/pinctrl/pinctrl-cs7542.c
> new file mode 100644
> index 0000000000000..977c4ce98100d
> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-cs7542.c
> @@ -0,0 +1,188 @@

[ ... ]

> +enum cs7542_function {
> +	CS7542_FUNCTION_GPIO,
> +	CS7542_FUNCTION_UART,
> +};

[ ... ]

> +static int cs7542_gpio_request_enable(struct pinctrl_dev *pctldev,
> +				      struct pinctrl_gpio_range *range,
> +				      unsigned int pin)
> +{
> +	return cs7542_set_mux(pctldev, CS7542_FUNCTION_GPIO, pin);
> +}
> +
> +static const struct pinmux_ops cs7542_pinmux_ops = {
> +	.get_functions_count = cs7542_get_functions_count,
> +	.get_function_name = cs7542_get_function_name,
> +	.get_function_groups = cs7542_get_function_groups,
> +	.set_mux = cs7542_set_mux,
> +	.gpio_request_enable = cs7542_gpio_request_enable,
> +	.strict = true,
> +};

[Severity: Medium]
Should cs7542_pinmux_ops implement .function_is_gpio?

Because cs7542_pinmux_ops sets .strict = true and exposes "gpio"
(CS7542_FUNCTION_GPIO) as a pinmux function without providing
.function_is_gpio, activating a pinctrl state or hog with function = "gpio"
sets desc->mux_usecount and desc->mux_setting on the pin.  When that pin is
then requested as a GPIO, pin_request() leaves gpio_ok false and rejects
the request with -EINVAL:

drivers/pinctrl/pinmux.c:pin_request() {
	...
		if (mux_setting) {
			if (ops->function_is_gpio)
				gpio_ok = ops->function_is_gpio(pctldev,
								mux_setting->func);
		} else {
			gpio_ok = true;
		}

		if ((!gpio_range || ops->strict) && !gpio_ok &&
		    desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
	...
}

pinmux_can_be_used_for_gpio() likewise returns false for any pin muxed to
CS7542_FUNCTION_GPIO via pinctrl.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-cs7542-syscon-v1-0-49858e631449@gmail.com?part=4

  reply	other threads:[~2026-11-23 18:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:41 [PATCH 0/5] soc: cortina: Add CS7542 global clocks and pin multiplexer Fil Dunsky via B4 Relay
2026-11-23 18:41 ` Fil Dunsky
2026-11-23 18:41 ` [PATCH 1/5] dt-bindings: soc: Add Cortina Systems CS7542 global control block Fil Dunsky via B4 Relay
2026-11-23 18:41   ` Fil Dunsky
2026-11-23 18:41 ` [PATCH 2/5] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux Fil Dunsky via B4 Relay
2026-11-23 18:41   ` Fil Dunsky
2026-11-23 18:41 ` [PATCH 3/5] clk: Add Cortina Systems CS7542 strap-selected clocks Fil Dunsky via B4 Relay
2026-11-23 18:41   ` Fil Dunsky
2026-11-23 18:41 ` [PATCH 4/5] pinctrl: Add Cortina Systems CS7542 pin multiplexer Fil Dunsky via B4 Relay
2026-11-23 18:41   ` Fil Dunsky
2026-11-23 18:55   ` sashiko-bot [this message]
2026-11-23 18:41 ` [PATCH 5/5] MAINTAINERS: Add CS7542 global control support Fil Dunsky via B4 Relay
2026-11-23 18:41   ` Fil Dunsky

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=sashiko-outbox-229885@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=filipp.dunsky@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.