drivers/soundwire/stream.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/stream.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/stream.c- Extension
.c- Size
- 54884 bytes
- Lines
- 2247
- Domain
- Driver Families
- Bucket
- drivers/soundwire
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/device.hlinux/init.hlinux/iopoll.hlinux/module.hlinux/mod_devicetable.hlinux/slab.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hlinux/string_choices.hsound/soc.hbus.h
Detected Declarations
function sdw_find_col_indexfunction sdw_find_row_indexfunction _sdw_program_slave_port_paramsfunction sdw_program_slave_port_paramsfunction sdw_program_master_port_paramsfunction sdw_program_port_paramsfunction list_for_each_entryfunction sdw_enable_disable_slave_portsfunction sdw_enable_disable_master_portsfunction sdw_enable_disable_portsfunction list_for_each_entryfunction sdw_do_port_prepfunction sdw_prep_deprep_slave_portsfunction sdw_prep_deprep_master_portsfunction sdw_prep_deprep_portsfunction list_for_each_entryfunction sdw_notify_configfunction list_for_each_entryfunction sdw_program_paramsfunction sdw_bank_switchfunction sdw_ml_sync_bank_switchfunction do_bank_switchfunction list_for_each_entryfunction post_bank_switchfunction sdw_port_configfunction sdw_port_freefunction sdw_slave_port_allocatedfunction sdw_slave_port_freefunction list_for_each_entryfunction list_for_each_entry_safefunction sdw_slave_port_allocfunction sdw_slave_port_is_valid_rangefunction sdw_slave_port_configfunction sdw_master_port_allocatedfunction sdw_master_port_freefunction list_for_each_entry_safefunction sdw_master_port_allocfunction sdw_master_port_configfunction sdw_slave_rt_allocfunction sdw_slave_rt_configfunction list_for_each_entryfunction sdw_slave_rt_freefunction sdw_master_rt_allocfunction sdw_master_rt_configfunction sdw_master_rt_freefunction list_for_each_entry_safefunction sdw_config_streamfunction sdw_get_slave_dpn_prop
Annotated Snippet
if (ret < 0) {
dev_err(bus->dev, "DPN_BlockCtrl3 register write failed\n");
return ret;
}
}
/*
* Data ports are FULL, SIMPLE and REDUCED. This function handles
* FULL and REDUCED only and beyond this point only FULL is
* handled, so bail out if we are not FULL data port type
*/
if (type != SDW_DPN_FULL)
return ret;
/* Program DPN_SampleCtrl2 register */
wbuf = FIELD_GET(SDW_DPN_SAMPLECTRL_HIGH, t_params->sample_interval - 1);
ret = sdw_write_no_pm(slave, addr3, wbuf);
if (ret < 0) {
dev_err(bus->dev, "DPN_SampleCtrl2 register write failed\n");
return ret;
}
/* Program DPN_HCtrl register */
wbuf = FIELD_PREP(SDW_DPN_HCTRL_HSTART, t_params->hstart);
wbuf |= FIELD_PREP(SDW_DPN_HCTRL_HSTOP, t_params->hstop);
ret = sdw_write_no_pm(slave, addr4, wbuf);
if (ret < 0)
dev_err(bus->dev, "DPN_HCtrl register write failed\n");
return ret;
}
static int sdw_program_slave_port_params(struct sdw_bus *bus,
struct sdw_slave_runtime *s_rt,
struct sdw_port_runtime *p_rt)
{
struct sdw_transport_params *t_params = &p_rt->transport_params;
struct sdw_port_params *p_params = &p_rt->port_params;
struct sdw_slave_prop *slave_prop = &s_rt->slave->prop;
u32 addr1, addr2, addr3, addr4, addr5, addr6;
enum sdw_dpn_type port_type;
bool read_only_wordlength;
int ret;
u8 wbuf;
if (s_rt->slave->is_mockup_device)
return 0;
if (t_params->port_num) {
struct sdw_dpn_prop *dpn_prop;
dpn_prop = sdw_get_slave_dpn_prop(s_rt->slave, s_rt->direction,
t_params->port_num);
if (!dpn_prop)
return -EINVAL;
read_only_wordlength = dpn_prop->read_only_wordlength;
port_type = dpn_prop->type;
} else {
read_only_wordlength = false;
port_type = SDW_DPN_FULL;
}
addr1 = SDW_DPN_PORTCTRL(t_params->port_num);
addr2 = SDW_DPN_BLOCKCTRL1(t_params->port_num);
if (bus->params.next_bank) {
addr3 = SDW_DPN_SAMPLECTRL1_B1(t_params->port_num);
addr4 = SDW_DPN_OFFSETCTRL1_B1(t_params->port_num);
addr5 = SDW_DPN_BLOCKCTRL2_B1(t_params->port_num);
addr6 = SDW_DPN_LANECTRL_B1(t_params->port_num);
} else {
addr3 = SDW_DPN_SAMPLECTRL1_B0(t_params->port_num);
addr4 = SDW_DPN_OFFSETCTRL1_B0(t_params->port_num);
addr5 = SDW_DPN_BLOCKCTRL2_B0(t_params->port_num);
addr6 = SDW_DPN_LANECTRL_B0(t_params->port_num);
}
/* Program DPN_PortCtrl register */
wbuf = FIELD_PREP(SDW_DPN_PORTCTRL_DATAMODE, p_params->data_mode);
wbuf |= FIELD_PREP(SDW_DPN_PORTCTRL_FLOWMODE, p_params->flow_mode);
ret = sdw_update_no_pm(s_rt->slave, addr1, 0xF, wbuf);
if (ret < 0) {
dev_err(&s_rt->slave->dev,
"DPN_PortCtrl register write failed for port %d\n",
t_params->port_num);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/init.h`, `linux/iopoll.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/slab.h`, `linux/soundwire/sdw_registers.h`.
- Detected declarations: `function sdw_find_col_index`, `function sdw_find_row_index`, `function _sdw_program_slave_port_params`, `function sdw_program_slave_port_params`, `function sdw_program_master_port_params`, `function sdw_program_port_params`, `function list_for_each_entry`, `function sdw_enable_disable_slave_ports`, `function sdw_enable_disable_master_ports`, `function sdw_enable_disable_ports`.
- Atlas domain: Driver Families / drivers/soundwire.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.