sound/soc/mediatek/mt8186/mt8186-mt6366.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8186/mt8186-mt6366.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8186/mt8186-mt6366.c- Extension
.c- Size
- 40638 bytes
- Lines
- 1378
- 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
linux/gpio/consumer.hlinux/input.hlinux/module.hlinux/of.hsound/jack.hsound/pcm_params.hsound/rt5682.hsound/soc.h../../codecs/da7219.h../../codecs/mt6358.h../../codecs/rt5682.h../common/mtk-afe-platform-driver.h../common/mtk-dsp-sof-common.h../common/mtk-soc-card.h../common/mtk-soundcard-driver.hmt8186-afe-common.hmt8186-afe-clk.hmt8186-afe-gpio.hmt8186-mt6366-common.h
Detected Declarations
struct mt8186_mt6366_rt1019_rt5682s_privenum mt8186_jacksfunction dmic_getfunction dmic_setfunction primary_codec_initfunction mt8186_headset_codec_initfunction mt8186_da7219_i2s_hw_paramsfunction for_each_rtd_codec_daisfunction mt8186_da7219_i2s_hw_freefunction for_each_rtd_codec_daisfunction mt8186_rt5682s_i2s_hw_paramsfunction mt8186_mt6366_rt1019_rt5682s_hdmi_initfunction mt8186_hw_params_fixupfunction mt8186_i2s_hw_params_24le_fixupfunction mt8186_i2s_hw_params_32le_fixupfunction mt8186_sof_dai_link_fixupfunction mt8186_mt6366_legacy_probefunction for_each_card_prelinksfunction mt8186_mt6366_soc_card_probefunction for_each_card_prelinks
Annotated Snippet
struct mt8186_mt6366_rt1019_rt5682s_priv {
struct gpio_desc *dmic_sel;
int dmic_switch;
};
enum mt8186_jacks {
MT8186_JACK_HEADSET,
MT8186_JACK_HDMI,
MT8186_JACK_MAX,
};
/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin mt8186_jack_pins[] = {
{
.pin = "Headphone",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static struct snd_soc_codec_conf mt8186_mt6366_rt1019_rt5682s_codec_conf[] = {
{
.dlc = COMP_CODEC_CONF("mt6358-sound"),
.name_prefix = "Mt6366",
},
{
.dlc = COMP_CODEC_CONF("bt-sco"),
.name_prefix = "Mt8186 bt",
},
{
.dlc = COMP_CODEC_CONF("hdmi-audio-codec"),
.name_prefix = "Mt8186 hdmi",
},
};
static int dmic_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(card);
struct mt8186_mt6366_rt1019_rt5682s_priv *priv = soc_card_data->mach_priv;
ucontrol->value.integer.value[0] = priv->dmic_switch;
return 0;
}
static int dmic_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(card);
struct mt8186_mt6366_rt1019_rt5682s_priv *priv = soc_card_data->mach_priv;
priv->dmic_switch = ucontrol->value.integer.value[0];
if (priv->dmic_sel) {
gpiod_set_value(priv->dmic_sel, priv->dmic_switch);
dev_dbg(card->dev, "dmic_set_value %d\n",
priv->dmic_switch);
}
return 0;
}
static const char * const dmic_mux_text[] = {
"Front Mic",
"Rear Mic",
};
static SOC_ENUM_SINGLE_DECL(mt8186_dmic_enum,
SND_SOC_NOPM, 0, dmic_mux_text);
static const struct snd_kcontrol_new mt8186_dmic_mux_control =
SOC_DAPM_ENUM_EXT("DMIC Select Mux", mt8186_dmic_enum,
dmic_get, dmic_set);
static const struct snd_soc_dapm_widget dmic_widgets[] = {
SND_SOC_DAPM_MIC("DMIC", NULL),
SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0, &mt8186_dmic_mux_control),
};
static const struct snd_soc_dapm_route dmic_map[] = {
/* digital mics */
{"Dmic Mux", "Front Mic", "DMIC"},
{"Dmic Mux", "Rear Mic", "DMIC"},
};
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/input.h`, `linux/module.h`, `linux/of.h`, `sound/jack.h`, `sound/pcm_params.h`, `sound/rt5682.h`, `sound/soc.h`.
- Detected declarations: `struct mt8186_mt6366_rt1019_rt5682s_priv`, `enum mt8186_jacks`, `function dmic_get`, `function dmic_set`, `function primary_codec_init`, `function mt8186_headset_codec_init`, `function mt8186_da7219_i2s_hw_params`, `function for_each_rtd_codec_dais`, `function mt8186_da7219_i2s_hw_free`, `function for_each_rtd_codec_dais`.
- 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.