STRUCT MHI_CONTROLLER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ 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 the struct device of 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 if fw_image is NULL and fbc_download is true (optional).
  • fw_sz β€” Firmware image data size for normal booting, used only if fw_image is NULL and fbc_download is 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 to request_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:

πŸ’Œ Cute sign-off: this page ships from ./include/linux, dated October 2026, and yes it's struct mhi_controller(9). Byeee β€” go populate those required fields πŸ’…βœ¨πŸ«Ά
πŸ“¦ where this page comes from