STRUCT SDW_SLAVE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🎧 struct sdw_slave(9) β€” the SoundWire Slave, explained πŸ’…

okay so this is a page out of the Kernel API Manual (the 9 section, kernel internals, iykyk) and it's literally just ✨ the struct ✨ β€” one struct, struct sdw_slave, and every single field in it. let's get into it bestie 🫢


πŸ’– NAME πŸ’–

struct sdw_slave β€” SoundWire Slave. that's it. that's the whole vibe. one struct, main character energy, representing a Slave device on the SoundWire bus πŸ‘‘


🌸 SYNOPSIS 🌸

here's the whole thing, exactly as it lives, no edits, no cap:

struct sdw_slave {
    struct sdw_slave_id id;
    struct device dev;
    int index;
    int irq;
    enum sdw_slave_status status;
    struct sdw_bus *bus;
    struct sdw_slave_prop prop;
  #ifdef CONFIG_DEBUG_FS;
    struct dentry *debugfs;
  #endif;
    struct list_head node;
    struct completion port_ready[SDW_MAX_PORTS];
    unsigned int m_port_map[SDW_MAX_PORTS];
    u16 dev_num;
    u16 dev_num_sticky;
    bool probed;
    struct completion enumeration_complete;
    struct completion initialization_complete;
    u32 unattach_request;
    bool first_interrupt_done;
    bool is_mockup_device;
    struct mutex sdw_dev_lock;
    struct sdca_device_data sdca_data;
 };

yes bestie, that #ifdef CONFIG_DEBUG_FS; is real, that's how it's written, we don't question it, we just vibe πŸ¦‹


✨ Members ✨

field-by-field, no skips, we're doing the whole roster πŸŽ€

  • id β€” the MIPI device ID. the whole identity crisis of the slave in one field.
  • dev β€” the Linux device 🐧 the actual kernel-side device object.
  • index β€” internal ID for this slave. it's giving "we don't talk about it, it's internal."
  • irq β€” the IRQ number. interrupts, iconic.
  • status β€” Status reported by the Slave. yes, the slave reports it, we just read the room πŸ’…
  • bus β€” Bus handle. a pointer to the bus, obviously.
  • prop β€” Slave properties. all the configurational lore.
  • debugfs β€” Slave debugfs. (only exists when CONFIG_DEBUG_FS is on, per the synopsis β€” keep that in mind, bestie πŸ”₯)
  • node β€” node for bus list. linked-list plumbing, we love a struct list_head.
  • port_ready β€” Port ready completion flag for each Slave port. it's an array of struct completion, one per port, up to SDW_MAX_PORTS.
  • m_port_map β€” static Master port map for each Slave port. also SDW_MAX_PORTS sized, also unsigned int.
  • dev_num β€” Current Device Number, values can be 0 or dev_num_sticky. those are the options, periodt.
  • dev_num_sticky β€” one-time static Device Number assigned by Bus. sticky by name, sticky by nature πŸ“
  • probed β€” boolean tracking driver state. did the driver probe? boop, bool.
  • enumeration_complete β€” completion utility to control potential races on startup between device enumeration and read/write access to the Slave device. so like, nobody reads or writes before we're enumerated, ok? 😀
  • initialization_complete β€” completion utility to control potential races on startup between device enumeration and settings being restored. same energy, different phase 🧚
  • unattach_request β€” mask field to keep track why the Slave re-attached and was re-initialized. This is useful to deal with potential race conditions between the Master suspending and the codec resuming, and make sure that when the Master triggered a reset the Slave is properly enumerated and initialized. that's the whole deal, word for word, it's a u32.
  • first_interrupt_done β€” status flag tracking if the interrupt handling for a Slave happens for the first time after enumeration. first time for everything, bestie πŸ™ˆ
  • is_mockup_device β€” status flag used to squelch errors in the command/control protocol for SoundWire mockup devices. fake device, real flag πŸ’€
  • sdw_dev_lock β€” mutex used to protect callbacks/remove races. lock it down before you wreck it πŸ”’
  • sdca_data β€” structure containing all device data for SDCA helpers. the struct sdca_device_data pile, one-stop shop for the helpers.
ngl a lot of these fields exist purely to fight race conditions on startup and suspend/resume. SoundWire said "we will be careful" and meant it 😭

🌈 SEE ALSO 🌈

found in the kernel file ./include/linux/soundwire/sdw.h, and here's the entire friend group, all (9) entries, not one dropped πŸ’œ:

  • 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_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)
  • struct sdw_bus(9)
  • sdw_slave_wait_for_init(9)

and that's the page πŸŽ€ one last lil housekeeping note so you know where this came from: it's from ./include/linux/soundwire, dated October 2026, in the Kernel API Manual β€” so like, when you cite it, cite it cute. mwah, go read sdw_slave_wait_for_init(9) next, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from