[Linux-stm32] [PATCH 2/2] usb: typec: mux: gpio-sbu: enable when only used for orientation

Fabrice Gasnier fabrice.gasnier at foss.st.com
Tue Aug 25 12:54:24 UTC 2026


When used as orientation-switch only (no mode-switch, e.g. no altmode),
the optional enable gpio remains disabled.
Enable it from the switch_set() routine, in this case, when the
orientation is set and the enable-gpios property has been provided.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier at foss.st.com>
---
 drivers/usb/typec/mux/gpio-sbu-mux.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
index 1834f1a2dd9d..4151d78e3b8d 100644
--- a/drivers/usb/typec/mux/gpio-sbu-mux.c
+++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
@@ -17,6 +17,7 @@ struct gpio_sbu_mux {
 
 	struct typec_switch_dev *sw;
 	struct typec_mux_dev *mux;
+	bool mode_switch;
 
 	struct mutex lock; /* protect enabled and swapped */
 	bool enabled;
@@ -40,9 +41,13 @@ static int gpio_sbu_switch_set(struct typec_switch_dev *sw,
 		enabled = false;
 		break;
 	case TYPEC_ORIENTATION_NORMAL:
+		if (!sbu_mux->mode_switch)
+			enabled = true;
 		swapped = false;
 		break;
 	case TYPEC_ORIENTATION_REVERSE:
+		if (!sbu_mux->mode_switch)
+			enabled = true;
 		swapped = true;
 		break;
 	}
@@ -125,6 +130,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(sbu_mux->sw),
 				     "failed to register typec switch\n");
 
+	sbu_mux->mode_switch = device_property_read_bool(dev, "mode-switch");
+
 	mux_desc.drvdata = sbu_mux;
 	mux_desc.fwnode = dev_fwnode(dev);
 	mux_desc.set = gpio_sbu_mux_set;

-- 
2.43.0




More information about the Linux-stm32 mailing list