STRUCT OTG_SWITCH_MTK(9)
π 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β thevbus5V that host mode uses. give it its flowers β‘edevβ the external connector used to detectvbusandiddigchanges. 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 isUSB_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βtruewhen 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'struewhen 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms