sound/soc/qcom/sc8280xp.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/sc8280xp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/sc8280xp.c- Extension
.c- Size
- 5751 bytes
- Lines
- 195
- 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.hsound/soc.hsound/soc-dapm.hsound/pcm.hsound/pcm_params.hlinux/soundwire/sdw.hsound/jack.hlinux/input-event-codes.hqdsp6/q6afe.hcommon.hsdw.h
Detected Declarations
struct sc8280xp_snd_datafunction sc8280xp_snd_initfunction sc8280xp_be_hw_params_fixupfunction sc8280xp_snd_preparefunction sc8280xp_snd_hw_freefunction sc8280xp_add_be_opsfunction for_each_card_prelinksfunction sc8280xp_platform_probe
Annotated Snippet
struct sc8280xp_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 sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
{
struct sc8280xp_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 PRIMARY_MI2S_RX...QUATERNARY_MI2S_TX:
case QUINARY_MI2S_RX...QUINARY_MI2S_TX:
snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
break;
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_RX0 Digital Volume", 81);
snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 81);
snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
break;
case DISPLAY_PORT_RX_0:
/* DISPLAY_PORT dai ids are not contiguous */
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 sc8280xp_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);
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
rate->min = rate->max = 48000;
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
channels->min = 2;
channels->max = 2;
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 sc8280xp_snd_prepare(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id]);
}
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,q6afe.h`, `linux/module.h`, `linux/platform_device.h`, `sound/soc.h`, `sound/soc-dapm.h`, `sound/pcm.h`, `sound/pcm_params.h`, `linux/soundwire/sdw.h`.
- Detected declarations: `struct sc8280xp_snd_data`, `function sc8280xp_snd_init`, `function sc8280xp_be_hw_params_fixup`, `function sc8280xp_snd_prepare`, `function sc8280xp_snd_hw_free`, `function sc8280xp_add_be_ops`, `function for_each_card_prelinks`, `function sc8280xp_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.