sound/soc/qcom/sc7180.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/sc7180.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/sc7180.c- Extension
.c- Size
- 15704 bytes
- Lines
- 583
- 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/sc7180-lpass.hdt-bindings/sound/qcom,q6afe.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/platform_device.hsound/core.hsound/jack.hsound/pcm.hsound/soc.huapi/linux/input-event-codes.h../codecs/rt5682.h../codecs/rt5682s.hcommon.hqdsp6/q6afe.h
Detected Declarations
struct sc7180_snd_datafunction sc7180_jack_freefunction sc7180_headset_initfunction sc7180_hdmi_initfunction sc7180_initfunction sc7180_qdsp_initfunction sc7180_startup_realtek_codecfunction sc7180_snd_startupfunction sc7180_qdsp_snd_startupfunction dmic_getfunction dmic_setfunction sc7180_snd_shutdownfunction sc7180_qdsp_snd_shutdownfunction sc7180_adau7002_initfunction sc7180_adau7002_snd_startupfunction sc7180_qdsp_be_hw_params_fixupfunction sc7180_snd_platform_probefunction for_each_card_prelinks
Annotated Snippet
struct sc7180_snd_data {
struct snd_soc_card card;
u32 pri_mi2s_clk_count;
struct snd_soc_jack hs_jack;
struct snd_soc_jack hdmi_jack;
struct gpio_desc *dmic_sel;
int dmic_switch;
};
static void sc7180_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 sc7180_jack_pins[] = {
{
.pin = "Headphone Jack",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static int sc7180_headset_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct sc7180_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;
struct snd_jack *jack;
int rval;
rval = snd_soc_card_jack_new_pins(card, "Headset Jack",
SND_JACK_HEADSET |
SND_JACK_HEADPHONE |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3,
&pdata->hs_jack,
sc7180_jack_pins,
ARRAY_SIZE(sc7180_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 = sc7180_jack_free;
return snd_soc_component_set_jack(component, &pdata->hs_jack, NULL);
}
static int sc7180_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct sc7180_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;
struct snd_jack *jack;
int rval;
rval = snd_soc_card_jack_new(
card, "HDMI Jack",
SND_JACK_LINEOUT,
&pdata->hdmi_jack);
if (rval < 0) {
dev_err(card->dev, "Unable to add HDMI Jack\n");
return rval;
}
jack = pdata->hdmi_jack.jack;
jack->private_data = component;
jack->private_free = sc7180_jack_free;
return snd_soc_component_set_jack(component, &pdata->hdmi_jack, NULL);
}
static int sc7180_init(struct snd_soc_pcm_runtime *rtd)
Annotation
- Immediate include surface: `dt-bindings/sound/sc7180-lpass.h`, `dt-bindings/sound/qcom,q6afe.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `sound/core.h`, `sound/jack.h`.
- Detected declarations: `struct sc7180_snd_data`, `function sc7180_jack_free`, `function sc7180_headset_init`, `function sc7180_hdmi_init`, `function sc7180_init`, `function sc7180_qdsp_init`, `function sc7180_startup_realtek_codec`, `function sc7180_snd_startup`, `function sc7180_qdsp_snd_startup`, `function dmic_get`.
- 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.