STRUCT CI_HDRC(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐ŸŒธ 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 at ci_otg_work.
  • b_sess_valid_event โ€” indicates there is a vbus event, and handled at ci_otg_work. vbus event detected, also handled at ci_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:

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