drivers/soundwire/intel_ace2x.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/intel_ace2x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/intel_ace2x.c- Extension
.c- Size
- 30876 bytes
- Lines
- 1151
- 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/acpi.hlinux/cleanup.hlinux/device.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw.hlinux/soundwire/sdw_intel.hlinux/string_choices.hsound/hdaudio.hsound/hda-mlink.hsound/hda-sdw-bpt.hsound/hda_register.hsound/pcm_params.hcadence_master.hbus.hintel.h
Detected Declarations
function sdw_slave_bpt_stream_addfunction intel_ace2x_bpt_open_streamfunction intel_ace2x_bpt_close_streamfunction intel_ace2x_bpt_send_asyncfunction intel_ace2x_bpt_waitfunction intel_shim_vs_initfunction intel_shim_vs_set_clock_sourcefunction intel_shim_check_wakefunction intel_shim_wakefunction intel_link_power_upfunction intel_link_power_downfunction intel_sync_armfunction intel_sync_go_unlockedfunction intel_sync_gofunction intel_check_cmdsync_unlockedfunction intel_params_streamfunction intel_free_streamfunction intel_hw_paramsfunction intel_preparefunction intel_hw_freefunction intel_pcm_set_sdw_streamfunction intel_triggerfunction intel_pdi_initfunction intel_pdi_get_ch_capfunction intel_pdi_get_ch_updatefunction intel_pdi_stream_ch_updatefunction intel_create_daifunction intel_register_daifunction intel_program_sdifunction intel_get_link_count
Annotated Snippet
if (prop->mclk_freq % 2400000) {
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24_576;
clock_source = SDW_SHIM2_MLCS_CARDINAL_CLK;
} else {
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4;
clock_source = SDW_SHIM2_MLCS_XTAL_CLK;
}
} else {
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_96;
clock_source = SDW_SHIM2_MLCS_AUDIO_PLL_CLK;
}
mutex_lock(sdw->link_res->shim_lock);
ret = hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, link_id);
if (ret < 0) {
dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n",
__func__, ret);
goto out;
}
intel_shim_vs_set_clock_source(sdw, clock_source);
if (!*shim_mask) {
/* we first need to program the SyncPRD/CPU registers */
dev_dbg(sdw->cdns.dev, "first link up, programming SYNCPRD\n");
ret = hdac_bus_eml_sdw_set_syncprd_unlocked(sdw->link_res->hbus, syncprd);
if (ret < 0) {
dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_set_syncprd failed: %d\n",
__func__, ret);
goto out;
}
/* SYNCPU will change once link is active */
ret = hdac_bus_eml_sdw_wait_syncpu_unlocked(sdw->link_res->hbus);
if (ret < 0) {
dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_wait_syncpu failed: %d\n",
__func__, ret);
goto out;
}
hdac_bus_eml_enable_interrupt_unlocked(sdw->link_res->hbus, true,
AZX_REG_ML_LEPTR_ID_SDW, true);
}
*shim_mask |= BIT(link_id);
sdw->cdns.link_up = true;
intel_shim_vs_init(sdw);
out:
mutex_unlock(sdw->link_res->shim_lock);
return ret;
}
static int intel_link_power_down(struct sdw_intel *sdw)
{
u32 *shim_mask = sdw->link_res->shim_mask;
unsigned int link_id = sdw->instance;
int ret;
mutex_lock(sdw->link_res->shim_lock);
sdw->cdns.link_up = false;
*shim_mask &= ~BIT(link_id);
if (!*shim_mask)
hdac_bus_eml_enable_interrupt_unlocked(sdw->link_res->hbus, true,
AZX_REG_ML_LEPTR_ID_SDW, false);
ret = hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, link_id);
if (ret < 0) {
dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n",
__func__, ret);
/*
* we leave the sdw->cdns.link_up flag as false since we've disabled
* the link at this point and cannot handle interrupts any longer.
*/
}
mutex_unlock(sdw->link_res->shim_lock);
return ret;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cleanup.h`, `linux/device.h`, `linux/soundwire/sdw_registers.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_intel.h`, `linux/string_choices.h`, `sound/hdaudio.h`.
- Detected declarations: `function sdw_slave_bpt_stream_add`, `function intel_ace2x_bpt_open_stream`, `function intel_ace2x_bpt_close_stream`, `function intel_ace2x_bpt_send_async`, `function intel_ace2x_bpt_wait`, `function intel_shim_vs_init`, `function intel_shim_vs_set_clock_source`, `function intel_shim_check_wake`, `function intel_shim_wake`, `function intel_link_power_up`.
- 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.