sound/soc/qcom/qdsp6/q6afe-dai.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/q6afe-dai.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/q6afe-dai.c- Extension
.c- Size
- 36188 bytes
- Lines
- 1154
- 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,q6afe.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.hq6afe.h
Detected Declarations
struct q6afe_dai_priv_datastruct q6afe_dai_datafunction q6slim_hw_paramsfunction q6hdmi_hw_paramsfunction q6afe_usb_hw_paramsfunction q6i2s_hw_paramsfunction q6i2s_set_fmtfunction q6tdm_set_tdm_slotfunction q6tdm_set_channel_mapfunction q6tdm_hw_paramsfunction q6dma_set_channel_mapfunction q6dma_hw_paramsfunction q6afe_dai_shutdownfunction q6afe_dai_preparefunction q6slim_set_channel_mapfunction q6afe_mi2s_set_sysclkfunction msm_dai_q6_dai_probefunction msm_dai_q6_dai_removefunction of_q6afe_parse_dai_datafunction for_each_child_of_nodefunction q6afe_dai_dev_probe
Annotated Snippet
struct q6afe_dai_priv_data {
uint32_t sd_line_mask;
uint32_t sync_mode;
uint32_t sync_src;
uint32_t data_out_enable;
uint32_t invert_sync;
uint32_t data_delay;
uint32_t data_align;
};
struct q6afe_dai_data {
struct q6afe_port *port[AFE_PORT_MAX];
struct q6afe_port_config port_config[AFE_PORT_MAX];
bool is_port_started[AFE_PORT_MAX];
struct q6afe_dai_priv_data priv[AFE_PORT_MAX];
};
static int q6slim_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
struct q6afe_slim_cfg *slim = &dai_data->port_config[dai->id].slim;
slim->sample_rate = params_rate(params);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
case SNDRV_PCM_FORMAT_SPECIAL:
slim->bit_width = 16;
break;
case SNDRV_PCM_FORMAT_S24_LE:
slim->bit_width = 24;
break;
case SNDRV_PCM_FORMAT_S32_LE:
slim->bit_width = 32;
break;
default:
pr_err("%s: format %d\n",
__func__, params_format(params));
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 q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
int channels = params_channels(params);
struct q6afe_hdmi_cfg *hdmi = &dai_data->port_config[dai->id].hdmi;
int ret;
hdmi->sample_rate = params_rate(params);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
hdmi->bit_width = 16;
break;
case SNDRV_PCM_FORMAT_S24_LE:
hdmi->bit_width = 24;
break;
}
ret = q6dsp_get_channel_allocation(channels);
if (ret < 0)
return ret;
hdmi->channel_allocation = (u16) ret;
return 0;
}
static int q6afe_usb_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
int channels = params_channels(params);
int rate = params_rate(params);
struct q6afe_usb_cfg *usb = &dai_data->port_config[dai->id].usb_audio;
usb->sample_rate = rate;
usb->num_channels = channels;
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_U16_LE:
case SNDRV_PCM_FORMAT_S16_LE:
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,q6afe.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 q6afe_dai_priv_data`, `struct q6afe_dai_data`, `function q6slim_hw_params`, `function q6hdmi_hw_params`, `function q6afe_usb_hw_params`, `function q6i2s_hw_params`, `function q6i2s_set_fmt`, `function q6tdm_set_tdm_slot`, `function q6tdm_set_channel_map`, `function q6tdm_hw_params`.
- 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.