STRUCT CI_HDRC(9)
๐ธ NAME ๐ธ
okay so bestie, meet struct ci_hdrc โ the chipidea device representation straight out of the Kernel API Manual. this is the main-character struct for chipidea controller state, and it is literally carrying so much info ๐ซถโจ.
โจ SYNOPSIS โจ
here's the exact shape, no cap โ copy-paste sacred text:
struct ci_hdrc {
struct device *dev;
spinlock_t lock;
struct hw_bank hw_bank;
int irq;
struct ci_role_driver *roles[CI_ROLE_END];
enum ci_role role;
bool is_otg;
struct usb_otg otg;
struct otg_fsm fsm;
struct hrtimer otg_fsm_hrtimer;
ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS];
unsigned enabled_otg_timer_bits;
enum otg_fsm_timer next_otg_timer;
struct usb_role_switch *role_switch;
struct work_struct work;
struct work_struct power_lost_work;
struct workqueue_struct *wq;
struct dma_pool *qh_pool;
struct dma_pool *td_pool;
struct usb_gadget gadget;
struct usb_gadget_driver *driver;
enum usb_device_state resume_state;
unsigned hw_ep_max;
struct ci_hw_ep ci_hw_ep[ENDPT_MAX];
u32 ep0_dir;
struct ci_hw_ep *ep0out, *ep0in;
struct usb_request *status;
bool setaddr;
u8 address;
u8 remote_wakeup;
u8 suspended;
u8 test_mode;
struct ci_hdrc_platform_data *platdata;
int vbus_active;
struct ulpi *ulpi;
struct ulpi_ops ulpi_ops;
struct phy *phy;
struct usb_phy *usb_phy;
struct usb_hcd *hcd;
bool id_event;
bool b_sess_valid_event;
bool imx28_write_fix;
bool has_portsc_pec_bug;
bool has_short_pkt_limit;
bool supports_runtime_pm;
bool in_lpm;
bool wakeup_int;
enum ci_revision rev;
struct mutex mutex;
};
it's giving "this struct has a lot going on and every field is important" energy. keep scrolling for the member tea โ๐ .
๐ Members ๐
devโ pointer to the parent device, aka the device that brought this whole struct into existence ๐ผ.lockโ the access synchronization. yes bestie, we love a lock keeping things from getting messy.hw_bankโ the hardware register mapping. it's literally the map to the hardware registers ๐บ๏ธ.irqโ the IRQ number. interrupt queen behavior โก.rolesโ array of supported roles for this controller. it's an array, and it holds the role options, periodt.roleโ the current role. not past role, not future role, current role ๐ .is_otgโ tells you if the device is otg-capable. so if this is true, OTG is in the chat.fsmโ the otg finite state machine. it's a whole machine of states, bestie ๐๏ธ.otg_fsm_hrtimerโ hrtimer for otg fsm timers. yes, a timer for the FSM timers โ very meta, very iconic.hr_timeoutsโ time out list for active otg fsm timers. plural! a list! we love organization โจ.enabled_otg_timer_bitsโ bits of enabled otg timers. literally bits doing bit things.next_otg_timerโ the next nearest enabled timer to be expired. it's the timer with the closest expiration energy โฐ.workโ work for role changing. when the role switches, this is the work item that handles it.power_lost_workโ work for power lost handling. for when power says "and I oop" ๐๐.wqโ workqueue thread. the thread where work gets queued and handled.qh_poolโ allocation pool for queue heads. pool party, but for queue heads ๐.td_poolโ allocation pool for transfer descriptors. another pool, another allocation situation.gadgetโ device side representation for peripheral controller. it's the gadget side of the controller.driverโ gadget driver. the driver for the gadget.resume_stateโ save the state of gadget suspend from. yes, that's exactly how the manpage puts it ๐ญ it's saving the suspend state origin.hw_ep_maxโ total number of endpoints supported by hardware. the hardware endpoint limit, no more no less.ci_hw_epโ array of endpoints. yes, an array. yes, it's endpoints. yes, we're obsessed.ep0_dirโ ep0 direction. which way ep0 is going ๐งญ.ep0outโ pointer to ep0 OUT endpoint. pointer bestie pointing at the OUT endpoint.ep0inโ pointer to ep0 IN endpoint. same vibe, IN direction.statusโ ep0 status request. the status request for ep0.setaddrโ if we should set the address on status completion. it's a yes/no situation: set address on status completion? ๐addressโ usb address received from the host. the host said "here's your address," and this is it.remote_wakeupโ host-enabled remote wakeup. remote wakeup, but enabled by the host.suspendedโ suspended by host. not by me, by the host ๐ด.test_modeโ the selected test mode. which test mode got selected, exactly.platdataโ platform specific information supplied by parent device. parent device said "here's some platform info," and this is it ๐ซถ.vbus_activeโ is VBUS active. literally that: is VBUS active?ulpiโ pointer to ULPI device, if any. pointer, conditional "if any," very mindful.ulpi_opsโ ULPI read/write ops for this device. the read/write operations for ULPI on this device.phyโ pointer to PHY, if any. again with the "if any," we love an optional pointer ๐ฑ.usb_phyโ pointer to USB PHY, if any and if using the USB PHY framework. double conditional, highkey specific.hcdโ pointer to usb_hcd for ehci host driver. the usb_hcd pointer for the ehci host driver.id_eventโ indicates there is an id event, and handled at ci_otg_work. id event detected, handled over atci_otg_work.b_sess_valid_eventโ indicates there is a vbus event, and handled at ci_otg_work. vbus event detected, also handled atci_otg_work.imx28_write_fixโ Freescale imx28 needs swp instruction for writing. that's the fix: imx28 needs the swp instruction for writing.supports_runtime_pmโ if runtime pm is supported. runtime PM support: yes or no.in_lpmโ if the core in low power mode. is the core in low power mode? this field knows.wakeup_intโ if wakeup interrupt occur. whether a wakeup interrupt occurred.revโ The revision number for controller. the controller's revision number, capital T in "The" and all.mutexโ protect code from concorrent running when doing role switch. it keeps code safe from concorrent running during a role switch (their spelling, not mine ๐).
tiny side quest: the struct also has otg, role_switch, has_portsc_pec_bug, and has_short_pkt_limit, but the original Members list doesn't describe them, so I'm not inventing lore. periodt ๐ซก.
๐ฎ SEE ALSO ๐ฎ
the manpage points you to the Kernel file ./drivers/usb/chipidea/ci.h, plus these absolute icons:
struct ci_hw_ep(9)struct ci_role_driver(9)struct hw_bank(9)hw_read_id_reg(9)hw_write_id_reg(9)hw_read(9)hw_write(9)hw_test_and_clear(9)hw_test_and_write(9)ci_otg_is_fsm_mode(9)
go read them, bestie, they're literally right there ๐โจ.
mwah ๐ this gem comes from ./drivers/usb/chipidea, dated October 2026, and it is, of course, the struct ci_hdrc(9) page. bye bestie, slay your kernel adventures ๐ซถ๐โญ
๐ฆ 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