sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c- Extension
.c- Size
- 9372 bytes
- Lines
- 342
- 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.
- 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,q6dsp-lpass-ports.hlinux/err.hlinux/init.hlinux/module.hlinux/device.hlinux/platform_device.hlinux/slab.hsound/pcm.hsound/soc.hsound/pcm_params.hq6dsp-lpass-ports.hq6dsp-common.haudioreach.hq6apm.h
Detected Declarations
struct q6apm_lpass_dai_datafunction q6dma_set_channel_mapfunction q6hdmi_hw_paramsfunction q6dma_hw_paramsfunction q6apm_lpass_dai_shutdownfunction q6apm_lpass_dai_triggerfunction q6apm_lpass_dai_preparefunction q6apm_lpass_dai_startupfunction q6i2s_set_fmtfunction q6apm_lpass_dai_dev_probe
Annotated Snippet
struct q6apm_lpass_dai_data {
struct q6apm_graph *graph[APM_PORT_MAX];
bool is_port_started[APM_PORT_MAX];
struct audioreach_module_config module_config[APM_PORT_MAX];
};
static int q6dma_set_channel_map(struct snd_soc_dai *dai,
unsigned int tx_num,
const unsigned int *tx_ch_mask,
unsigned int rx_num,
const unsigned int *rx_ch_mask)
{
struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
struct audioreach_module_config *cfg = &dai_data->module_config[dai->id];
int i;
switch (dai->id) {
case WSA_CODEC_DMA_TX_0:
case WSA_CODEC_DMA_TX_1:
case WSA_CODEC_DMA_TX_2:
case VA_CODEC_DMA_TX_0:
case VA_CODEC_DMA_TX_1:
case VA_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
case TX_CODEC_DMA_TX_4:
case TX_CODEC_DMA_TX_5:
if (!tx_ch_mask) {
dev_err(dai->dev, "tx slot not found\n");
return -EINVAL;
}
if (tx_num > AR_PCM_MAX_NUM_CHANNEL) {
dev_err(dai->dev, "invalid tx num %d\n",
tx_num);
return -EINVAL;
}
for (i = 0; i < tx_num; i++)
cfg->channel_map[i] = tx_ch_mask[i];
break;
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_2:
case RX_CODEC_DMA_RX_3:
case RX_CODEC_DMA_RX_4:
case RX_CODEC_DMA_RX_5:
case RX_CODEC_DMA_RX_6:
case RX_CODEC_DMA_RX_7:
/* rx */
if (!rx_ch_mask) {
dev_err(dai->dev, "rx slot not found\n");
return -EINVAL;
}
if (rx_num > APM_PORT_MAX_AUDIO_CHAN_CNT) {
dev_err(dai->dev, "invalid rx num %d\n",
rx_num);
return -EINVAL;
}
for (i = 0; i < rx_num; i++)
cfg->channel_map[i] = rx_ch_mask[i];
break;
default:
dev_err(dai->dev, "%s: invalid dai id 0x%x\n",
__func__, dai->id);
return -EINVAL;
}
return 0;
}
static int q6hdmi_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{
struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
struct audioreach_module_config *cfg = &dai_data->module_config[dai->id];
int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max;
int ret;
cfg->bit_width = params_width(params);
cfg->sample_rate = params_rate(params);
cfg->num_channels = channels;
audioreach_set_default_channel_mapping(cfg->channel_map, channels);
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,q6dsp-lpass-ports.h`, `linux/err.h`, `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/platform_device.h`, `linux/slab.h`, `sound/pcm.h`.
- Detected declarations: `struct q6apm_lpass_dai_data`, `function q6dma_set_channel_map`, `function q6hdmi_hw_params`, `function q6dma_hw_params`, `function q6apm_lpass_dai_shutdown`, `function q6apm_lpass_dai_trigger`, `function q6apm_lpass_dai_prepare`, `function q6apm_lpass_dai_startup`, `function q6i2s_set_fmt`, `function q6apm_lpass_dai_dev_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
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.