STRUCT SDW_BUS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ struct sdw_bus β€” SoundWire bus πŸ¦‹

okay so bestie, this is the page for struct sdw_bus(9) from the Kernel API Manual, and honestly? it's giving "the main character of the SoundWire universe." it's the bus struct. everything lives here. let's get into it πŸ’…


✨ SYNOPSIS ✨

struct sdw_bus {
    struct device *dev;
    struct sdw_master_device *md;
    struct lock_class_key bus_lock_key;
    struct mutex bus_lock;
    struct ida slave_ida;
    struct list_head slaves;
    struct lock_class_key msg_lock_key;
    struct mutex msg_lock;
    struct list_head m_rt_list;
    struct sdw_defer defer_msg;
    struct sdw_bus_params params;
    int stream_refcount;
    int bpt_stream_refcount;
    struct sdw_stream_runtime *bpt_stream;
    const struct sdw_master_ops *ops;
    const struct sdw_master_port_ops *port_ops;
    struct sdw_master_prop prop;
    void *vendor_specific_prop;
    int hw_sync_min_links;
    int controller_id;
    unsigned int link_id;
    int id;
    int (*compute_params)(struct sdw_bus *bus, struct sdw_stream_runtime
*stream);
    unsigned long assigned[BITS_TO_LONGS( SDW_MAX_DEVICES)];
    unsigned int clk_stop_timeout;
    u32 bank_switch_timeout;
    struct irq_chip irq_chip;
    struct irq_domain *domain;
  #ifdef CONFIG_DEBUG_FS;
    struct dentry *debugfs;
  #endif;
    bool multi_link;
    unsigned int lane_used_bandwidth[SDW_MAX_LANES];
 };

like, look at that field list. it ate. no notes πŸ”₯


πŸ’– MEMBERS πŸ’–

okay now the fun part β€” every single field, explained, no skips, we are NOT skipping πŸ’€

  • dev β€” shortcut to bus->md->dev, and the whole reason it exists is so nobody has to go change the entire code. iconic laziness. respect.
  • md β€” the master device πŸŽ€
  • bus_lock_key β€” the bus lock key that's associated to bus_lock
  • bus_lock β€” the bus lock itself, periodt
  • slave_ida β€” the IDA that hands out internal slave IDs
  • slaves β€” the list of Slaves hanging out on this bus 🫢
  • msg_lock_key β€” the message lock key associated to msg_lock
  • msg_lock β€” the message lock, yes bestie, there are two locks, they're different
  • m_rt_list β€” list of Master instance of all stream(s) running on Bus. this one is lowkey important: it's what's used to compute and program bus bandwidth, clock, frame shape, transport and port parameters 🌈
  • defer_msg β€” a deferred message, held for later
  • params β€” the current bus parameters
  • stream_refcount β€” how many streams are currently using this bus
  • bpt_stream_refcount β€” number of BTP streams currently using this bus. important caveat: it should be zero or one, because multiple streams per link is not supported 🚫
  • bpt_stream β€” pointer stored so BTP streams can be handled
  • ops β€” the Master callback ops
  • port_ops β€” the Master port callback ops
  • prop β€” the Master properties
  • vendor_specific_prop β€” pointer to non-standard properties (the ✨ custom ✨ stuff)
  • hw_sync_min_links β€” number of links used by a stream above which hardware-based synchronization is required. fiY: this value is only meaningful if multi_link is set. and if it's set to 1, hardware-based synchronization will be used even if a stream only uses a single SoundWire segment πŸ‘‘
  • controller_id β€” system-unique controller ID. if it's set to -1, the bus id gets used instead
  • link_id β€” link id number, can be 0 to N, unique for each Controller
  • id β€” the bus's system-wide unique id
  • compute_params β€” points to the Bus resource management implementation
  • assigned β€” bitmap for Slave device numbers. bit set means the number is used, bit clear means it's unused πŸŽ€
  • clk_stop_timeout β€” the clock stop timeout, computed
  • bank_switch_timeout β€” the bank switch timeout, also computed
  • irq_chip β€” the IRQ chip
  • domain β€” the IRQ domain
  • debugfs β€” the bus debugfs, and it's optional 🧚
  • multi_link β€” stores the bus property that says whether multi links are supported. this flag gets populated by drivers after they read the appropriate firmware (ACPI/DT) πŸ‘€
  • lane_used_bandwidth β€” how much bandwidth, in bits per second, is used by each lane
ngl the bandwidth accounting is the part everyone forgets about and then wonders why their stream sounds cursed. not us though. we read the whole struct πŸ’€

🌸 SEE ALSO 🌸

the whole friend group, in ./include/linux/soundwire/sdw.h (Kernel file):

  • enum sdw_slave_status(9)
  • enum sdw_clk_stop_type(9)
  • enum sdw_command_response(9)
  • enum sdw_stream_type(9)
  • enum sdw_data_direction(9)
  • enum sdw_port_data_mode(9)
  • enum sdw_p15_behave(9)
  • enum sdw_dpn_type(9)
  • enum sdw_clk_stop_mode(9)
  • struct sdw_dp0_prop(9)
  • struct sdw_dpn_prop(9)
  • struct sdw_slave_prop(9)
  • struct sdw_master_prop(9)
  • struct sdw_slave_id(9)
  • struct sdw_slave_intr_status(9)
  • enum sdw_reg_bank(9)
  • struct sdw_prepare_ch(9)
  • enum sdw_port_prep_ops(9)
  • struct sdw_bus_params(9)
  • struct sdw_slave_ops(9)
  • struct sdw_slave(9)
  • struct sdw_master_device(9)
  • struct sdw_port_params(9)
  • struct sdw_transport_params(9)
  • struct sdw_enable_ch(9)
  • struct sdw_master_port_ops(9)
  • struct sdw_defer(9)
  • struct sdw_master_ops(9)
  • struct sdw_port_config(9)
  • struct sdw_stream_config(9)
  • enum sdw_stream_state(9)
  • struct sdw_stream_params(9)
  • struct sdw_stream_runtime(9)
  • sdw_slave_wait_for_init(9)

and that's the whole page bestie, you're officially a SoundWire bus expert πŸŽ“πŸ’œ

little sign-off from the source: this one lives in ./include/linux/soundwire, it's dated October 2026, and it's part of the Kernel API Manual. slay πŸŽ€βœ¨
πŸ“¦ where this page comes from