summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-01 16:01:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-01 16:01:16 +0200
commit84b002612b900352eb90e71842c8e1e11f078b81 (patch)
treebf906e2dab7e7b749c4a7c4b71763ed0d09e648e /drivers/usb
parentcee9395acd8043be0644b25c34bfa86623f2b935 (diff)
parent40a050c1bca6ddad5546feb88950b03b87dc8fc6 (diff)
downloadlinux-next-84b002612b900352eb90e71842c8e1e11f078b81.tar.gz
linux-next-84b002612b900352eb90e71842c8e1e11f078b81.zip
Merge patch series "usb: gpio-sbu-mux: add FUSB340 and enable option for orientation"
Fabrice Gasnier <fabrice.gasnier@foss.st.com> says: Add a new compatible for FUSB340. Also manage the enable GPIO, when used as orientation-switch only. It is used on STM32MP25 DK boards, as orientation-switch only for USB SuperSpeed lines on the Type-C connector, the enable GPIO being connected to the SoC. - - - - SoC - - - - - - - - - - board - - - - - | USB-C +------+ +----------+ | +-+ | |--| USB2PHY |<-----------------HS->|*| | |--| HS |<-----------------HS->|*| | | +----------+ | | | | | | ________ | | + dwc3 | +----------+ | / |<-SS->|*| | | | |<--->/ |<-SS->|*| | |--| ComboPHY |<---> FUSB340 | | | | | | SS | | \ __ |<-SS->|*| +------+ +----------+ | \_en__sw_|<-SS->|*| | ^ ^ | | +----------+ | | | ... [ GPIO ]--------+ | [ GPIO ]------------+ +----------+ | - - - - - - - - - - - - - - - - - - - - - - -- This is a subset of STM32MP25 Type-C support [1]. [1] https://lore.kernel.org/all/20260821-ucpd-host-fusb340-v7-2-rfc-v1-0-c5e27cbc0795@foss.st.com/ Link: https://patch.msgid.link/20260826-usb-fusb340-v1-v3-0-11927682504d@foss.st.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/mux/gpio-sbu-mux.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
index 1834f1a2dd9d..b1aa976aca24 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,19 +41,24 @@ 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;
}
- if (enabled != sbu_mux->enabled)
- gpiod_set_value_cansleep(sbu_mux->enable_gpio, enabled);
-
if (swapped != sbu_mux->swapped)
gpiod_set_value_cansleep(sbu_mux->select_gpio, swapped);
+ /* If both enabled and swapped transition, set enable GPIO after to avoid glitches */
+ if (enabled != sbu_mux->enabled)
+ gpiod_set_value_cansleep(sbu_mux->enable_gpio, enabled);
+
sbu_mux->enabled = enabled;
sbu_mux->swapped = swapped;
@@ -120,6 +126,7 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
sw_desc.fwnode = dev_fwnode(dev);
sw_desc.set = gpio_sbu_switch_set;
+ sbu_mux->mode_switch = device_property_read_bool(dev, "mode-switch");
sbu_mux->sw = typec_switch_register(dev, &sw_desc);
if (IS_ERR(sbu_mux->sw))
return dev_err_probe(dev, PTR_ERR(sbu_mux->sw),