Skip to contentSkip to conversation

Enable pass-through on GPIOE1 and GPIOE3 free

PATCH In review Bills, Jason M 2 participants 2 messages Feb 2, 2022

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

PATCH 1/2 Enable pass-through on GPIOE1 and GPIOE3 free

From a511f72a6514e67ee332715f1950140be528f112 Mon Sep 17 00:00:00 2001
From: "Jason M. Bills" <[email protected]>
Date: Fri, 3 May 2019 16:12:39 -0700
Subject: [PATCH 1/2] Enable pass-through on GPIOE1 and GPIOE3 free

This change adds a gpio_disable_free() implementation that checks if the GPIO being freed is GPIOE1 (33) or GPIOE3 (35) and will re-enable the pass-through mux.

Tested:
Requested GPIOs 33 and 35 and used devmem to check that pass-through was disabled. Then freed them and checked that pass-through was enabled again.

---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 17 +++++++
 drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 17 +++++++
 drivers/pinctrl/aspeed/pinctrl-aspeed.c    | 53 ++++++++++++++++++++++
 drivers/pinctrl/aspeed/pinctrl-aspeed.h    |  3 ++
 4 files changed, 90 insertions(+)
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +17 -0
index 4c0d26606b6c..6ab3473cbba6 100644
@@ -2785,6 +2785,22 @@ static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx,
 	return 0;
 }
 
+#define GPIOE1 33
+#define GPIOE3 35
+static void aspeed_g5_gpio_disable_free(struct pinctrl_dev *pctldev,
+			      struct pinctrl_gpio_range *range,
+			      unsigned int offset)
+{
+	/*
+	 * If we're freeing GPIOE1 (33) or GPIOE3 (35) then re-enable the
+	 * pass-through mux setting; otherwise, do nothing.
+	 */
+	if (offset != GPIOE1 && offset != GPIOE3)
+		return;
+
+	aspeed_gpio_disable_free(pctldev, range, offset);
+}
+
 static const struct aspeed_pin_config_map aspeed_g5_pin_config_map[] = {
 	{ PIN_CONFIG_BIAS_PULL_DOWN,  0, 1, BIT_MASK(0)},
 	{ PIN_CONFIG_BIAS_PULL_DOWN, -1, 0, BIT_MASK(0)},
@@ -2820,6 +2836,7 @@ static const struct pinmux_ops aspeed_g5_pinmux_ops = {
 	.get_function_groups = aspeed_pinmux_get_fn_groups,
 	.set_mux = aspeed_pinmux_set_mux,
 	.gpio_request_enable = aspeed_gpio_request_enable,
+	.gpio_disable_free = aspeed_g5_gpio_disable_free,
 	.strict = true,
 };
 
drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +17 -0
index a3fa03bcd9a3..ffc72168ef7b 100644
@@ -2693,6 +2693,22 @@ static int aspeed_g6_sig_expr_set(struct aspeed_pinmux_data *ctx,
 	return 0;
 }
 
+#define GPIOP1 121
+#define GPIOP3 123
+static void aspeed_g6_gpio_disable_free(struct pinctrl_dev *pctldev,
+			      struct pinctrl_gpio_range *range,
+			      unsigned int offset)
+{
+	/*
+	 * If we're freeing GPIOP1 (121) or GPIOP3 (123) then re-enable the
+	 * pass-through mux setting; otherwise, do nothing.
+	 */
+	if (offset != GPIOP1 && offset != GPIOP3)
+		return;
+
+	aspeed_gpio_disable_free(pctldev, range, offset);
+}
+
 static const struct aspeed_pin_config_map aspeed_g6_pin_config_map[] = {
 	{ PIN_CONFIG_BIAS_PULL_DOWN,  0,   1, BIT_MASK(0)},
 	{ PIN_CONFIG_BIAS_PULL_DOWN, -1,   0, BIT_MASK(0)},
@@ -2733,6 +2749,7 @@ static const struct pinmux_ops aspeed_g6_pinmux_ops = {
 	.get_function_groups = aspeed_pinmux_get_fn_groups,
 	.set_mux = aspeed_pinmux_set_mux,
 	.gpio_request_enable = aspeed_gpio_request_enable,
+	.gpio_disable_free = aspeed_g6_gpio_disable_free,
 	.strict = true,
 };
 
drivers/pinctrl/aspeed/pinctrl-aspeed.c +53 -0

59 lines not on this page · raw message

drivers/pinctrl/aspeed/pinctrl-aspeed.h +3 -0
index 4dcde3bc29c8..bd497c20a15f 100644
@@ -101,6 +101,9 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
 int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev,
 		struct pinctrl_gpio_range *range,
 		unsigned int offset);
+void aspeed_gpio_disable_free(struct pinctrl_dev *pctldev,
+		struct pinctrl_gpio_range *range,
+		unsigned int offset);
 int aspeed_pinctrl_probe(struct platform_device *pdev,
 		struct pinctrl_desc *pdesc,
 		struct aspeed_pinctrl_data *pdata);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Jason M

From a511f72a6514e67ee332715f1950140be528f112 Mon Sep 17 00:00:00 2001
From: "Jason M. Bills" <[email protected]>
Date: Fri, 3 May 2019 16:12:39 -0700
Subject: [PATCH 1/2] Enable pass-through on GPIOE1 and GPIOE3 free

Please use a prefix such as "pinctrl: aspeed:" in the subject line. This way, the context of the patch will be clear to everyone who sees only the subject line.

Best regards,
Jonathan Neuschäfer