Skip to contentSkip to conversation

pinctrl: meson: sync some modify from A4

PATCH In review Xianwei Zhao 3 participants 3 messages Aug 12 – Aug 14

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: meson: sync some modify from A4

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.

---
Sync some fixes from A4.

---
 drivers/pinctrl/meson/pinctrl-meson.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +4 -4
index 4507dc8b5563..1eea3e9d1cb2 100644
@@ -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,

Signature · 1 line
Xianwei Zhao <[email protected]>
#1 lore raw
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…

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 <[email protected]>

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.

Quoted 4 lines
drivers/pinctrl/meson/pinctrl-meson.c +0 -0
index 18295b15ecd9d..9fc30aee96a56 100644

[ ... ]

drivers/pinctrl/meson/pinctrl-meson.c static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin, · line 503

Quoted 9 lines
drivers/pinctrl/meson/pinctrl-meson.c +2 -2
@@ -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?

Quoted 2 lines
drivers/pinctrl/meson/pinctrl-meson.c +0 -0
 		break;
 	case PIN_CONFIG_LEVEL:
Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
maintainer
#2 lore raw
In reply to Xianwei Zhao
Quoted 9 lines · On Wed, Aug 12, 2026 at 12:22 PM Xianwei Zhao via B4 Relay…

From: Xianwei Zhao <[email protected]>

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.

Applied this patch as well.

Yours,
Linus Walleij