Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: meson: sync some modify from A4
@ 2026-08-12 10:22 Xianwei Zhao via B4 Relay
  2026-08-12 10:30 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-12 10:22 UTC (permalink / raw)
  To: Linus Walleij, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-gpio, linux-arm-kernel, linux-amlogic, linux-kernel,
	Xianwei Zhao

From: Xianwei Zhao <xianwei.zhao@amlogic.com>

Set the drive strength before enabling the output to avoid enabling
the output with an unintended drive strength.

Also return the actual output enable state from
PIN_CONFIG_OUTPUT_ENABLE instead of always reporting it as enabled.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Sync some fixes from  A4.
---
 drivers/pinctrl/meson/pinctrl-meson.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 4507dc8b5563..1eea3e9d1cb2 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -252,11 +252,11 @@ static int meson_pinconf_set_output_drive(struct meson_pinctrl *pc,
 {
 	int ret;
 
-	ret = meson_pinconf_set_output(pc, pin, true);
+	ret = meson_pinconf_set_drive(pc, pin, high);
 	if (ret)
 		return ret;
 
-	return meson_pinconf_set_drive(pc, pin, high);
+	return meson_pinconf_set_output(pc, pin, true);
 }
 
 static int meson_pinconf_disable_bias(struct meson_pinctrl *pc,
@@ -498,9 +498,9 @@ static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin,
 		break;
 	case PIN_CONFIG_OUTPUT_ENABLE:
 		ret = meson_pinconf_get_output(pc, pin);
-		if (ret <= 0)
+		if (ret < 0)
 			return -EINVAL;
-		arg = 1;
+		arg = ret;
 		break;
 	case PIN_CONFIG_LEVEL:
 		ret = meson_pinconf_get_output(pc, pin);

---
base-commit: 761af93c9f1a100b8d9f71aa744b8f9abbbbbfb2
change-id: 20260812-sync_a4-011ae20ff31c

Best regards,
-- 
Xianwei Zhao <xianwei.zhao@amlogic.com>



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pinctrl: meson: sync some modify from A4
  2026-08-12 10:22 [PATCH] pinctrl: meson: sync some modify from A4 Xianwei Zhao via B4 Relay
@ 2026-08-12 10:30 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-08-12 10:30 UTC (permalink / raw)
  To: Xianwei Zhao; +Cc: neil.armstrong, linux-amlogic

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Returning 0 with arg=0 for disabled PIN_CONFIG_OUTPUT_ENABLE violates the pinctrl generic API and breaks debugfs dumps.
--

--- Patch [1]: [PATCH] pinctrl: meson: sync some modify from A4 ---
commit 9cd4cd52945d3531f8a1944d79a8d453a832ce33
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

pinctrl: meson: sync some modify from A4

This commit syncs fixes from A4, setting the drive strength before
enabling the output to prevent unintended drive strengths. It also modifies
PIN_CONFIG_OUTPUT_ENABLE to report the actual output enable state.

> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
> index 18295b15ecd9d..9fc30aee96a56 100644
> --- a/drivers/pinctrl/meson/pinctrl-meson.c
> +++ b/drivers/pinctrl/meson/pinctrl-meson.c

[ ... ]

> @@ -498,9 +498,9 @@ static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin,
>  		break;
>  	case PIN_CONFIG_OUTPUT_ENABLE:
>  		ret = meson_pinconf_get_output(pc, pin);
> -		if (ret <= 0)
> +		if (ret < 0)
>  			return -EINVAL;
> -		arg = 1;
> +		arg = ret;

[Severity: Medium]
The generic pinctrl API defines PIN_CONFIG_OUTPUT_ENABLE as a boolean
parameter without an argument.

When a feature is inactive or disabled, drivers are expected to return 
-EINVAL from the get callback. Because the parameter has no argument, the 
core pinctrl debugfs logic ignores the returned arg value.

By returning 0 with arg = 0 when the output is disabled, won't debugfs 
falsely report all disabled pins as having their output enabled?

Should this code still return -EINVAL when ret is 0 to avoid breaking 
debugfs output?

>  		break;
>  	case PIN_CONFIG_LEVEL:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812-sync_a4-v1-1-b7279c26e2bc@amlogic.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-12 10:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 10:22 [PATCH] pinctrl: meson: sync some modify from A4 Xianwei Zhao via B4 Relay
2026-08-12 10:30 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox