sound/soc/qcom/sc7280.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/sc7280.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/sc7280.c- Extension
.c- Size
- 10832 bytes
- Lines
- 401
- 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,lpass.hdt-bindings/sound/qcom,q6afe.hlinux/input.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hsound/core.hsound/jack.hsound/pcm.hsound/soc.hsound/rt5682s.hlinux/soundwire/sdw.hsound/pcm_params.h../codecs/rt5682.h../codecs/rt5682s.hcommon.hlpass.hqdsp6/q6afe.hsdw.h
Detected Declarations
struct sc7280_snd_datafunction sc7280_jack_freefunction sc7280_headset_initfunction for_each_rtd_codec_daisfunction sc7280_hdmi_initfunction sc7280_rt5682_initfunction sc7280_initfunction sc7280_snd_hw_paramsfunction sc7280_snd_swr_preparefunction sc7280_snd_preparefunction sc7280_snd_hw_freefunction sc7280_snd_shutdownfunction sc7280_snd_startupfunction sc7280_snd_be_hw_params_fixupfunction sc7280_snd_platform_probefunction for_each_card_prelinks
Annotated Snippet
struct sc7280_snd_data {
struct snd_soc_card card;
u32 pri_mi2s_clk_count;
struct snd_soc_jack hs_jack;
struct snd_soc_jack hdmi_jack;
bool jack_setup;
bool stream_prepared[LPASS_MAX_PORTS];
};
static void sc7280_jack_free(struct snd_jack *jack)
{
struct snd_soc_component *component = jack->private_data;
snd_soc_component_set_jack(component, NULL, NULL);
}
static struct snd_soc_jack_pin sc7280_jack_pins[] = {
{
.pin = "Headphone Jack",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static int sc7280_headset_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct sc7280_snd_data *pdata = snd_soc_card_get_drvdata(card);
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_component *component = codec_dai->component;
struct snd_jack *jack;
int rval, i;
if (!pdata->jack_setup) {
rval = snd_soc_card_jack_new_pins(card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_LINEOUT |
SND_JACK_MECHANICAL |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3 |
SND_JACK_BTN_4 | SND_JACK_BTN_5,
&pdata->hs_jack,
sc7280_jack_pins,
ARRAY_SIZE(sc7280_jack_pins));
if (rval < 0) {
dev_err(card->dev, "Unable to add Headset Jack\n");
return rval;
}
jack = pdata->hs_jack.jack;
snd_jack_set_key(jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_jack_set_key(jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
snd_jack_set_key(jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
snd_jack_set_key(jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
jack->private_data = component;
jack->private_free = sc7280_jack_free;
pdata->jack_setup = true;
}
switch (cpu_dai->id) {
case MI2S_PRIMARY:
case LPASS_CDC_DMA_RX0:
case LPASS_CDC_DMA_TX3:
case TX_CODEC_DMA_TX_3:
for_each_rtd_codec_dais(rtd, i, codec_dai) {
rval = snd_soc_component_set_jack(component, &pdata->hs_jack, NULL);
if (rval != 0 && rval != -ENOTSUPP) {
dev_err(card->dev, "Failed to set jack: %d\n", rval);
return rval;
}
}
break;
default:
break;
}
return 0;
}
static int sc7280_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct sc7280_snd_data *pdata = snd_soc_card_get_drvdata(card);
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_component *component = codec_dai->component;
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,lpass.h`, `dt-bindings/sound/qcom,q6afe.h`, `linux/input.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `sound/core.h`, `sound/jack.h`.
- Detected declarations: `struct sc7280_snd_data`, `function sc7280_jack_free`, `function sc7280_headset_init`, `function for_each_rtd_codec_dais`, `function sc7280_hdmi_init`, `function sc7280_rt5682_init`, `function sc7280_init`, `function sc7280_snd_hw_params`, `function sc7280_snd_swr_prepare`, `function sc7280_snd_prepare`.
- 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.