STRUCT SDW_BUS(9)
π¦ 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 tobus->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 tobus_lockbus_lockβ the bus lock itself, periodtslave_idaβ the IDA that hands out internal slave IDsslavesβ the list of Slaves hanging out on this bus π«Άmsg_lock_keyβ the message lock key associated tomsg_lockmsg_lockβ the message lock, yes bestie, there are two locks, they're differentm_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 laterparamsβ the current bus parametersstream_refcountβ how many streams are currently using this busbpt_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 handledopsβ the Master callback opsport_opsβ the Master port callback opspropβ the Master propertiesvendor_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 ifmulti_linkis set. and if it's set to1, 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 insteadlink_idβ link id number, can be0toN, unique for each Controlleridβ the bus's system-wide unique idcompute_paramsβ points to the Bus resource management implementationassignedβ 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, computedbank_switch_timeoutβ the bank switch timeout, also computedirq_chipβ the IRQ chipdomainβ the IRQ domaindebugfsβ 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
- 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