[openwrt/openwrt] ramips: pinctrl: support requesting different functions for same group
LEDE Commits
lede-commits at lists.infradead.org
Tue Sep 5 17:35:04 PDT 2023
dangole pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/9df91263204b8a9a4c506fd75e06b83236fdc56e
commit 9df91263204b8a9a4c506fd75e06b83236fdc56e
Author: Shiji Yang <yangshiji66 at qq.com>
AuthorDate: Sat Jul 29 21:24:10 2023 +0800
ramips: pinctrl: support requesting different functions for same group
MT7620 wireless radio needs change the pin group function between
"gpio" and "pa" during the calibration process. However, ralink
pinctrl driver doesn't support requesting different functions for
the same group. This patch enables pinctrl consumers to perform
such operations.
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
(cherry picked from commit b4ea49ad442d2884d0b86009f404f125635c4153)
---
...ips-support-requesting-different-function.patch | 45 ++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
new file mode 100644
index 0000000000..047808f1e6
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
@@ -0,0 +1,45 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Wed, 26 Jul 2023 01:32:55 +0800
+Subject: [PATCH] pinctrl: mtmips: support requesting different functions for
+ same group
+
+Sometimes pinctrl consumers may request different functions for the
+same pin group in different situations. This patch can help to reset
+the group function flag when requesting a different function.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ drivers/pinctrl/ralink/pinctrl-ralink.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+--- a/drivers/pinctrl/ralink/pinctrl-ralink.c
++++ b/drivers/pinctrl/ralink/pinctrl-ralink.c
+@@ -123,11 +123,24 @@ static int ralink_pmx_group_enable(struc
+ int i;
+ int shift;
+
+- /* dont allow double use */
++ /*
++ * for the same pin group, if request a different function,
++ * then clear the group function flag and continue, else exit.
++ */
+ if (p->groups[group].enabled) {
+- dev_err(p->dev, "%s is already enabled\n",
+- p->groups[group].name);
+- return 0;
++ for (i = 0; i < p->groups[group].func_count; i++) {
++ if (p->groups[group].func[i].enabled == 1) {
++ if (!strcmp(p->func[func]->name,
++ p->groups[group].func[i].name))
++ return 0;
++ p->groups[group].func[i].enabled = 0;
++ break;
++ }
++ }
++
++ /* exit if request the "gpio" function again */
++ if (i == p->groups[group].func_count && func == 0)
++ return 0;
+ }
+
+ p->groups[group].enabled = 1;
More information about the lede-commits
mailing list