sound/soc/codecs/rt722-sdca-sdw.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt722-sdca-sdw.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt722-sdca-sdw.c- Extension
.c- Size
- 18079 bytes
- Lines
- 583
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/device.hlinux/module.hlinux/mod_devicetable.hlinux/pm_runtime.hlinux/soundwire/sdw_registers.hrt722-sdca.hrt722-sdca-sdw.h
Detected Declarations
function rt722_sdca_mbq_sizefunction rt722_sdca_readable_registerfunction rt722_sdca_volatile_registerfunction rt722_sdca_update_statusfunction rt722_sdca_read_propfunction rt722_sdca_interrupt_callbackfunction rt722_sdca_sdw_probefunction rt722_sdca_sdw_removefunction rt722_sdca_dev_suspendfunction rt722_sdca_dev_system_suspendfunction rt722_sdca_dev_resume
Annotated Snippet
if (rt722->hs_jack) {
/*
* Due to the SCP_SDCA_INTMASK will be cleared by any reset, and then
* if the device attached again, we will need to set the setting back.
* It could avoid losing the jack detection interrupt.
* This also could sync with the cache value as the rt722_sdca_jack_init set.
*/
sdw_write_no_pm(rt722->slave, SDW_SCP_SDCA_INTMASK1,
SDW_SCP_SDCA_INTMASK_SDCA_0);
sdw_write_no_pm(rt722->slave, SDW_SCP_SDCA_INTMASK2,
SDW_SCP_SDCA_INTMASK_SDCA_8);
}
}
/*
* Perform initialization only if slave status is present and
* hw_init flag is false
*/
if (rt722->hw_init || status != SDW_SLAVE_ATTACHED)
return 0;
/* perform I/O transfers required for Slave initialization */
return rt722_sdca_io_init(&slave->dev, slave);
}
static int rt722_sdca_read_prop(struct sdw_slave *slave)
{
struct sdw_slave_prop *prop = &slave->prop;
int nval;
int i, j;
u32 bit;
unsigned long addr;
struct sdw_dpn_prop *dpn;
sdw_slave_read_lane_mapping(slave);
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
prop->paging_support = true;
/*
* port = 1 for headphone playback
* port = 2 for headset-mic capture
* port = 3 for speaker playback
* port = 6 for digital-mic capture
*/
prop->source_ports = BIT(6) | BIT(2); /* BITMAP: 01000100 */
prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */
nval = hweight32(prop->source_ports);
prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
sizeof(*prop->src_dpn_prop), GFP_KERNEL);
if (!prop->src_dpn_prop)
return -ENOMEM;
i = 0;
dpn = prop->src_dpn_prop;
addr = prop->source_ports;
for_each_set_bit(bit, &addr, 32) {
dpn[i].num = bit;
dpn[i].type = SDW_DPN_FULL;
dpn[i].simple_ch_prep_sm = true;
dpn[i].ch_prep_timeout = 10;
i++;
}
/* do this again for sink now */
nval = hweight32(prop->sink_ports);
prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
if (!prop->sink_dpn_prop)
return -ENOMEM;
j = 0;
dpn = prop->sink_dpn_prop;
addr = prop->sink_ports;
for_each_set_bit(bit, &addr, 32) {
dpn[j].num = bit;
dpn[j].type = SDW_DPN_FULL;
dpn[j].simple_ch_prep_sm = true;
dpn[j].ch_prep_timeout = 10;
j++;
}
/* set the timeout values */
prop->clk_stop_timeout = 900;
/* wake-up event */
prop->wake_capable = 1;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/pm_runtime.h`, `linux/soundwire/sdw_registers.h`, `rt722-sdca.h`, `rt722-sdca-sdw.h`.
- Detected declarations: `function rt722_sdca_mbq_size`, `function rt722_sdca_readable_register`, `function rt722_sdca_volatile_register`, `function rt722_sdca_update_status`, `function rt722_sdca_read_prop`, `function rt722_sdca_interrupt_callback`, `function rt722_sdca_sdw_probe`, `function rt722_sdca_sdw_remove`, `function rt722_sdca_dev_suspend`, `function rt722_sdca_dev_system_suspend`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.