sound/soc/qcom/x1e80100.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/x1e80100.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/x1e80100.c- Extension
.c- Size
- 6203 bytes
- Lines
- 230
- 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/module.hlinux/platform_device.hlinux/soundwire/sdw.hsound/pcm.hsound/jack.hsound/soc.hsound/soc-dapm.hcommon.hqdsp6/q6afe.hqdsp6/q6dsp-common.hsdw.h
Detected Declarations
struct x1e80100_snd_datafunction x1e80100_snd_initfunction x1e80100_be_hw_params_fixupfunction x1e80100_snd_hw_map_channelsfunction x1e80100_snd_preparefunction x1e80100_snd_hw_freefunction x1e80100_add_be_opsfunction for_each_card_prelinksfunction x1e80100_platform_probe
Annotated Snippet
struct x1e80100_snd_data {
bool stream_prepared[AFE_PORT_MAX];
struct snd_soc_card *card;
struct snd_soc_jack jack;
struct snd_soc_jack dp_jack[8];
bool jack_setup;
};
static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
{
struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_card *card = rtd->card;
struct snd_soc_jack *dp_jack = NULL;
int dp_pcm_id = 0;
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
/*
* Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
* to reduce the risk of speaker damage until we have active
* speaker protection in place.
*/
snd_soc_limit_volume(card, "WSA WSA_RX0 Digital Volume", 81);
snd_soc_limit_volume(card, "WSA WSA_RX1 Digital Volume", 81);
snd_soc_limit_volume(card, "WSA2 WSA_RX0 Digital Volume", 81);
snd_soc_limit_volume(card, "WSA2 WSA_RX1 Digital Volume", 81);
snd_soc_limit_volume(card, "SpkrLeft PA Volume", 6);
snd_soc_limit_volume(card, "SpkrRight PA Volume", 6);
snd_soc_limit_volume(card, "WooferLeft PA Volume", 6);
snd_soc_limit_volume(card, "TweeterLeft PA Volume", 6);
snd_soc_limit_volume(card, "WooferRight PA Volume", 6);
snd_soc_limit_volume(card, "TweeterRight PA Volume", 6);
break;
case DISPLAY_PORT_RX_0:
dp_pcm_id = 0;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
dp_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
default:
break;
}
if (dp_jack)
return qcom_snd_dp_jack_setup(rtd, dp_jack, dp_pcm_id);
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
static int x1e80100_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_interval *rate = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
rate->min = rate->max = 48000;
switch (cpu_dai->id) {
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
channels->min = 1;
break;
default:
break;
}
return 0;
}
static int x1e80100_snd_hw_map_channels(unsigned int *ch_map, int num)
{
switch (num) {
case 1:
ch_map[0] = PCM_CHANNEL_FC;
break;
case 2:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
break;
case 3:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,q6afe.h`, `linux/module.h`, `linux/platform_device.h`, `linux/soundwire/sdw.h`, `sound/pcm.h`, `sound/jack.h`, `sound/soc.h`, `sound/soc-dapm.h`.
- Detected declarations: `struct x1e80100_snd_data`, `function x1e80100_snd_init`, `function x1e80100_be_hw_params_fixup`, `function x1e80100_snd_hw_map_channels`, `function x1e80100_snd_prepare`, `function x1e80100_snd_hw_free`, `function x1e80100_add_be_ops`, `function for_each_card_prelinks`, `function x1e80100_platform_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.