STRUCT OTG_SWITCH_MTK(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct otg_switch_mtk(9) πŸŽ€

okay so bestie, this one's straight out of the Kernel API Manual and it's genuinely the main character of USB OTG/dual-role switching πŸ’… like this struct is the whole group chat that keeps host mode and device mode from fighting in the school parking lot.


✨ NAME ✨

struct otg_switch_mtk β€” OTG/dual-role switch management. that's it, that's the vibe: it manages the switch. no cap 🫢


🌸 SYNOPSIS 🌸

struct otg_switch_mtk {
    struct regulator *vbus;
    struct extcon_dev *edev;
    struct notifier_block id_nb;
    struct work_struct dr_work;
    enum usb_role desired_role;
    enum usb_role default_role;
    struct usb_role_switch *role_sw;
    bool role_sw_used;
    bool is_u3_drd;
    bool manual_drd_enabled;
 };

πŸ’– Members πŸ’–

meet the cast, they all ate fr fr:

  • vbus β€” the vbus 5V that host mode uses. give it its flowers ⚑
  • edev β€” the external connector used to detect vbus and iddig changes. it's the one watching the door πŸ‘€
  • id_nb β€” the notifier for iddig (idpin) detection. tiny little heads-up machine πŸŽ€
  • dr_work β€” the work for the drd mode switch, and it exists specifically to avoid sleep in atomic context. lowkey a hero for that 😭
  • desired_role β€” the role you desire to switch to. yes, that's literally the name, and honestly? iconic.
  • default_role β€” the default mode while the usb role is USB_ROLE_NONE. the fallback bestie πŸ’œ
  • role_sw β€” uses USB Role Switch to support dual-role switch. important lore: it can't use extcon at the same time, and extcon is deprecated. so like… don't πŸ™ˆ
heads up bestie: extcon is deprecated here. that's not me being dramatic, that's just the facts πŸ’€
  • role_sw_used β€” true when the USB Role Switch is used. simple, honest, slays ✨
  • is_u3_drd β€” whether port0 supports usb3.0 dual-role device or not. a yes/no girlie 🌈
  • manual_drd_enabled β€” it's true when it supports dual-role device by debugfs to switch host/device modes depending on user input. you get to drive, bestie πŸš—

πŸ¦‹ SEE ALSO πŸ¦‹

start with the kernel file ./drivers/usb/mtu3/mtu3.h, then the whole friend group showing up in the mentions πŸ”₯

  • enum mtu3_g_ep0_state(9)
  • enum mtu3_dr_force_mode(9)
  • struct mtu3_fifo_info(9)
  • struct qmu_gpd(9)
  • struct mtu3_gpd_ring(9)
  • struct ssusb_mtk(9)
  • struct mtu3_ep(9)
  • struct mtu3(9)

⭐ that's the whole page, no notes, and it lives in ./drivers/usb/mtu3 with the October 2026 energy πŸ—“οΈπŸ’– periodt, go read the source bestie, mwah 🫢✨

πŸ“¦ where this page comes from