sound/soc/intel/avs/probes.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/probes.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/probes.c- Extension
.c- Size
- 8788 bytes
- Lines
- 315
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
sound/compress_driver.hsound/hdaudio_ext.hsound/hdaudio.hsound/soc.havs.hdebug.hmessages.h
Detected Declarations
function avs_dsp_init_probefunction avs_dsp_delete_probefunction avs_probe_compr_openfunction avs_probe_compr_freefunction avs_probe_compr_set_paramsfunction avs_probe_compr_triggerfunction avs_probe_compr_pointerfunction avs_probe_compr_copyfunction avs_register_probe_component
Annotated Snippet
if (!adev->num_probe_streams) {
avs_dsp_delete_probe(adev);
avs_dsp_enable_d0ix(adev);
}
}
snd_hdac_stream_cleanup(hdac_stream(host_stream));
hdac_stream(host_stream)->prepared = 0;
snd_hdac_ext_stream_release(host_stream, HDAC_EXT_STREAM_TYPE_HOST);
snd_compr_free_pages(cstream);
adev->extractor = NULL;
return ret;
}
static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
struct snd_compr_params *params, struct snd_soc_dai *dai)
{
struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
struct snd_compr_runtime *rtd = cstream->runtime;
struct avs_dev *adev = to_avs_dev(dai->dev);
unsigned int format_val;
int bps, ret;
hdac_stream(host_stream)->bufsize = 0;
hdac_stream(host_stream)->period_bytes = 0;
hdac_stream(host_stream)->format_val = 0;
cstream->dma_buffer.dev.type = SNDRV_DMA_TYPE_DEV_SG;
cstream->dma_buffer.dev.dev = adev->dev;
ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
if (ret < 0)
return ret;
bps = snd_pcm_format_physical_width((__force snd_pcm_format_t)params->codec.format);
if (bps < 0)
return bps;
format_val = snd_hdac_stream_format(params->codec.ch_out, bps, params->codec.sample_rate);
ret = snd_hdac_stream_set_params(hdac_stream(host_stream), format_val);
if (ret < 0)
return ret;
ret = snd_hdac_stream_setup(hdac_stream(host_stream), false);
if (ret < 0)
return ret;
hdac_stream(host_stream)->prepared = 1;
if (!adev->num_probe_streams) {
union avs_connector_node_id node_id;
/* D0ix not allowed during probing. */
ret = avs_dsp_disable_d0ix(adev);
if (ret)
return ret;
node_id.vindex = hdac_stream(host_stream)->stream_tag - 1;
node_id.dma_type = AVS_DMA_HDA_HOST_INPUT;
ret = avs_dsp_init_probe(adev, params, bps, node_id, rtd->dma_bytes);
if (ret < 0) {
dev_err(dai->dev, "probe init failed: %d\n", ret);
avs_dsp_enable_d0ix(adev);
return ret;
}
}
adev->num_probe_streams++;
return 0;
}
static int avs_probe_compr_trigger(struct snd_compr_stream *cstream, int cmd,
struct snd_soc_dai *dai)
{
struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
struct avs_dev *adev = to_avs_dev(dai->dev);
struct hdac_bus *bus = &adev->base.core;
unsigned long cookie;
if (!hdac_stream(host_stream)->prepared)
return -EPIPE;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
spin_lock_irqsave(&bus->reg_lock, cookie);
snd_hdac_stream_start(hdac_stream(host_stream));
spin_unlock_irqrestore(&bus->reg_lock, cookie);
break;
Annotation
- Immediate include surface: `sound/compress_driver.h`, `sound/hdaudio_ext.h`, `sound/hdaudio.h`, `sound/soc.h`, `avs.h`, `debug.h`, `messages.h`.
- Detected declarations: `function avs_dsp_init_probe`, `function avs_dsp_delete_probe`, `function avs_probe_compr_open`, `function avs_probe_compr_free`, `function avs_probe_compr_set_params`, `function avs_probe_compr_trigger`, `function avs_probe_compr_pointer`, `function avs_probe_compr_copy`, `function avs_register_probe_component`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.