sound/soc/qcom/lpass-platform.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/lpass-platform.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/lpass-platform.c- Extension
.c- Size
- 41030 bytes
- Lines
- 1397
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
dt-bindings/sound/qcom,lpass.hlinux/dma-mapping.hlinux/export.hlinux/kernel.hlinux/module.hlinux/platform_device.hsound/pcm_params.hlinux/regmap.hsound/soc.hlpass-lpaif-reg.hlpass.h
Detected Declarations
function lpass_platform_alloc_rxtx_dmactl_fieldsfunction lpass_platform_alloc_va_dmactl_fieldsfunction lpass_platform_alloc_dmactl_fieldsfunction lpass_platform_alloc_hdmidmactl_fieldsfunction lpass_platform_pcmops_openfunction lpass_platform_pcmops_closefunction __lpass_get_idfunction lpass_platform_pcmops_hw_paramsfunction lpass_platform_pcmops_hw_freefunction lpass_platform_pcmops_preparefunction lpass_platform_pcmops_triggerfunction lpass_platform_pcmops_pointerfunction lpass_platform_cdc_dma_mmapfunction lpass_platform_pcmops_mmapfunction lpass_dma_interrupt_handlerfunction lpass_platform_lpaif_irqfunction lpass_platform_hdmiif_irqfunction lpass_platform_rxtxif_irqfunction lpass_platform_vaif_irqfunction lpass_platform_prealloc_cdc_dma_bufferfunction lpass_platform_pcm_newfunction lpass_platform_pcmops_suspendfunction lpass_platform_pcmops_resumefunction lpass_platform_copyfunction asoc_qcom_lpass_platform_registerexport asoc_qcom_lpass_platform_register
Annotated Snippet
if (ret) {
kfree(data);
dev_err(soc_runtime->dev, "error writing to rdmactl reg: %d\n", ret);
return ret;
}
snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware);
runtime->dma_bytes = lpass_platform_pcm_hardware.buffer_bytes_max;
break;
case LPASS_CDC_DMA_RX0 ... LPASS_CDC_DMA_RX9:
case LPASS_CDC_DMA_TX0 ... LPASS_CDC_DMA_TX8:
snd_soc_set_runtime_hwparams(substream, &lpass_platform_rxtx_hardware);
runtime->dma_bytes = lpass_platform_rxtx_hardware.buffer_bytes_max;
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
break;
case LPASS_CDC_DMA_VA_TX0 ... LPASS_CDC_DMA_VA_TX8:
snd_soc_set_runtime_hwparams(substream, &lpass_platform_va_hardware);
runtime->dma_bytes = lpass_platform_va_hardware.buffer_bytes_max;
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
break;
default:
break;
}
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (ret < 0) {
kfree(data);
dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
ret);
return -EINVAL;
}
return 0;
}
static int lpass_platform_pcmops_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_runtime = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(soc_runtime, 0);
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
const struct lpass_variant *v = drvdata->variant;
struct lpass_pcm_data *data;
unsigned int dai_id = cpu_dai->driver->id;
data = runtime->private_data;
switch (dai_id) {
case MI2S_PRIMARY ... MI2S_QUINARY:
drvdata->substream[data->dma_ch] = NULL;
break;
case LPASS_DP_RX:
drvdata->hdmi_substream[data->dma_ch] = NULL;
break;
case LPASS_CDC_DMA_RX0 ... LPASS_CDC_DMA_RX9:
case LPASS_CDC_DMA_TX0 ... LPASS_CDC_DMA_TX8:
drvdata->rxtx_substream[data->dma_ch] = NULL;
break;
case LPASS_CDC_DMA_VA_TX0 ... LPASS_CDC_DMA_VA_TX8:
drvdata->va_substream[data->dma_ch] = NULL;
break;
default:
break;
}
if (v->free_dma_channel)
v->free_dma_channel(drvdata, data->dma_ch, dai_id);
kfree(data);
return 0;
}
static struct lpaif_dmactl *__lpass_get_dmactl_handle(const struct snd_pcm_substream *substream,
struct snd_soc_component *component)
{
struct snd_soc_pcm_runtime *soc_runtime = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(soc_runtime, 0);
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
struct lpaif_dmactl *dmactl = NULL;
switch (cpu_dai->driver->id) {
case MI2S_PRIMARY ... MI2S_QUINARY:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
dmactl = drvdata->rd_dmactl;
else
dmactl = drvdata->wr_dmactl;
break;
case LPASS_DP_RX:
dmactl = drvdata->hdmi_rd_dmactl;
break;
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,lpass.h`, `linux/dma-mapping.h`, `linux/export.h`, `linux/kernel.h`, `linux/module.h`, `linux/platform_device.h`, `sound/pcm_params.h`, `linux/regmap.h`.
- Detected declarations: `function lpass_platform_alloc_rxtx_dmactl_fields`, `function lpass_platform_alloc_va_dmactl_fields`, `function lpass_platform_alloc_dmactl_fields`, `function lpass_platform_alloc_hdmidmactl_fields`, `function lpass_platform_pcmops_open`, `function lpass_platform_pcmops_close`, `function __lpass_get_id`, `function lpass_platform_pcmops_hw_params`, `function lpass_platform_pcmops_hw_free`, `function lpass_platform_pcmops_prepare`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.