STRUCT MHI_CONTROLLER(9)
π¦ NAME π¦
Okay bestie, welcome to the Kernel API Manual page for struct mhi_controller(9) β the Master MHI controller structure. This is the main-character struct of the MHI controller world, fr fr. π
β¨ SYNOPSIS β¨
Here's the whole struct, copied exactly because we do not gatekeep π:
struct mhi_controller {
const char *name;
struct device *cntrl_dev;
struct mhi_device *mhi_dev;
struct dentry *debugfs_dentry;
void __iomem *regs;
void __iomem *bhi;
void __iomem *bhie;
void __iomem *wake_db;
dma_addr_t iova_start;
dma_addr_t iova_stop;
const char *fw_image;
const u8 *fw_data;
size_t fw_sz;
const char *edl_image;
size_t rddm_size;
size_t sbl_size;
size_t seg_len;
size_t reg_len;
struct image_info *fbc_image;
struct image_info *rddm_image;
struct mhi_chan *mhi_chan;
struct list_head lpm_chans;
int *irq;
u32 max_chan;
u32 total_ev_rings;
u32 hw_ev_rings;
u32 sw_ev_rings;
u32 nr_irqs;
u32 serial_number;
struct mhi_event *mhi_event;
struct mhi_cmd *mhi_cmd;
struct mhi_ctxt *mhi_ctxt;
struct mutex pm_mutex;
rwlock_t pm_lock;
u32 timeout_ms;
u32 ready_timeout_ms;
u32 pm_state;
u32 db_access;
enum mhi_ee_type ee;
enum mhi_state dev_state;
atomic_t dev_wake;
atomic_t pending_pkts;
u32 M0, M2, M3;
struct list_head transition_list;
spinlock_t transition_lock;
spinlock_t wlock;
struct mhi_link_info mhi_link_info;
struct work_struct st_worker;
struct workqueue_struct *hiprio_wq;
wait_queue_head_t state_event;
void (*status_cb)(struct mhi_controller *mhi_cntrl, enum
mhi_callback cb);
void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override);
void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override);
void (*wake_toggle)(struct mhi_controller *mhi_cntrl);
int (*runtime_get)(struct mhi_controller *mhi_cntrl);
void (*runtime_put)(struct mhi_controller *mhi_cntrl);
int (*map_single)(struct mhi_controller *mhi_cntrl, struct
mhi_buf_info *buf);
void (*unmap_single)(struct mhi_controller *mhi_cntrl, struct
mhi_buf_info *buf);
int (*read_reg)(struct mhi_controller *mhi_cntrl, void __iomem
*addr, u32 *out);
void (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem
*addr, u32 val);
void (*reset)(struct mhi_controller *mhi_cntrl);
int (*edl_trigger)(struct mhi_controller *mhi_cntrl);
size_t buffer_len;
int index;
bool bounce_buf;
bool fbc_download;
bool wake_set;
bool no_m3;
unsigned long irq_flags;
u32 mru;
};
π Members π
Vibe check on every single field β required and optional tea included ββ¨:
nameβ Device name of the MHI controller.cntrl_devβ Pointer to thestruct deviceof physical bus acting as the MHI controller (required).mhi_devβ MHI device instance for the controller.debugfs_dentryβ MHI controller debugfs directory.regsβ Base address of MHI MMIO register space (required).bhiβ Points to base of MHI BHI register space.bhieβ Points to base of MHI BHIe register space.wake_dbβ MHI WAKE doorbell register address.iova_startβ IOMMU starting address for data (required).iova_stopβ IOMMU stop address for data (required).fw_imageβ Firmware image name for normal booting (optional).fw_dataβ Firmware image data content for normal booting, used only iffw_imageisNULLandfbc_downloadis true (optional).fw_szβ Firmware image data size for normal booting, used only iffw_imageisNULLandfbc_downloadis true (optional).edl_imageβ Firmware image name for emergency download mode (optional).rddm_sizeβ RAM dump size that host should allocate for debugging purpose.sbl_sizeβ SBL image size downloaded through BHIe (optional).seg_lenβ BHIe vector size (optional).reg_lenβ Length of the MHI MMIO region (required).fbc_imageβ Points to firmware image buffer.rddm_imageβ Points to RAM dump buffer.mhi_chanβ Points to the channel configuration table.lpm_chansβ List of channels that require LPM notifications.irqβ base irq # to request (required).max_chanβ Maximum number of channels the controller supports.total_ev_ringsβ Total # of event rings allocated.hw_ev_ringsβ Number of hardware event rings.sw_ev_ringsβ Number of software event rings.nr_irqsβ Number of IRQ allocated by bus master (required).serial_numberβ MHI controller serial number obtained from BHI.mhi_eventβ MHI event ring configurations table.mhi_cmdβ MHI command ring configurations table.mhi_ctxtβ MHI device context, shared memory between host and device.pm_mutexβ Mutex for suspend/resume operation.pm_lockβ Lock for protecting MHI power management state.timeout_msβ Timeout in ms for state transitions.ready_timeout_msβ Timeout in ms for waiting device to be ready (optional).pm_stateβ MHI power management state.db_accessβ DB access states.eeβ MHI device execution environment.dev_stateβ MHI device state.dev_wakeβ Device wakeup count.pending_pktsβ Pending packets for the controller.M0β Counter to track number of device MHI state changes.M2β Counter to track number of device MHI state changes.M3β Counter to track number of device MHI state changes.transition_listβ List of MHI state transitions.transition_lockβ Lock for protecting MHI state transition list.wlockβ Lock for protecting device wakeup.mhi_link_infoβ Device bandwidth info.st_workerβ State transition worker.hiprio_wqβ High priority workqueue for MHI work such as state transitions.state_eventβ State change event.status_cbβ CB function to notify power states of the device (required).wake_getβ CB function to assert device wake (optional).wake_putβ CB function to de-assert device wake (optional).wake_toggleβ CB function to assert and de-assert device wake (optional).runtime_getβ CB function to controller runtime resume (required).runtime_putβ CB function to decrement pm usage (required).map_singleβ CB function to create TRE buffer.unmap_singleβ CB function to destroy TRE buffer.read_regβ Read a MHI register via the physical link (required).write_regβ Write a MHI register via the physical link (required).resetβ Controller specific reset function (optional).edl_triggerβ CB function to trigger EDL mode (optional).buffer_lenβ Bounce buffer length.indexβ Index of the MHI controller instance.bounce_bufβ Use of bounce buffer.fbc_downloadβ MHI host needs to do complete image transfer (optional).wake_setβ Device wakeup set flag.no_m3β Device doesn't support M3 state.irq_flagsβ irq flags passed torequest_irq(optional).mruβ the default MRU for the MHI device.
π Description π
Okay so here's the literal tea, bestie: fields marked as (required) need to be populated by the controller driver before calling mhi_register_controller. No cap, that's non-negotiable. For the fields marked as (optional), they can be populated depending on the usecase. That's the whole vibe. Slay. π
π SEE ALSO π
Kernel file ./include/linux/mhi.h β and the whole reference squad is:
enum mhi_callback(9)enum mhi_flags(9)enum mhi_device_type(9)enum mhi_ch_type(9)struct mhi_buf(9)struct image_info(9)struct mhi_link_info(9)enum mhi_ee_type(9)enum mhi_state(9)enum mhi_ch_ee_mask(9)enum mhi_er_data_type(9)enum mhi_db_brst_mode(9)struct mhi_channel_config(9)struct mhi_event_config(9)struct mhi_controller_config(9)struct mhi_device(9)struct mhi_result(9)struct mhi_driver(9)mhi_alloc_controller(9)mhi_free_controller(9)mhi_register_controller(9)mhi_unregister_controller(9)__mhi_driver_register(9)mhi_driver_unregister(9)mhi_set_mhi_state(9)mhi_notify(9)mhi_get_free_desc_count(9)mhi_prepare_for_power_up(9)mhi_async_power_up(9)mhi_sync_power_up(9)mhi_power_down(9)mhi_power_down_keep_dev(9)mhi_unprepare_after_power_down(9)mhi_pm_suspend(9)mhi_pm_resume(9)mhi_pm_resume_force(9)mhi_download_rddm_image(9)mhi_force_rddm_mode(9)mhi_get_exec_env(9)mhi_get_mhi_state(9)mhi_soc_reset(9)mhi_device_get_sync(9)mhi_device_put(9)mhi_prepare_for_transfer(9)mhi_unprepare_from_transfer(9)mhi_queue_buf(9)mhi_queue_skb(9)mhi_queue_is_full(9)mhi_get_channel_doorbell_offset(9)
π Cute sign-off: this page ships from./include/linux, datedOctober 2026, and yes it'sstruct mhi_controller(9). Byeee β go populate those required fields π β¨π«Ά
π¦ 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