sound/soc/mediatek/mt8365/mt8365-mt6357.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8365/mt8365-mt6357.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8365/mt8365-mt6357.c- Extension
.c- Size
- 9121 bytes
- Lines
- 347
- 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/array_size.hlinux/dev_printk.hlinux/err.hlinux/mod_devicetable.hlinux/module.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/types.hsound/soc.hsound/pcm_params.hmt8365-afe-common.h../common/mtk-soc-card.h../common/mtk-soundcard-driver.h
Detected Declarations
struct mt8365_mt6357_privenum pinctrl_pin_statefunction mt8365_mt6357_int_adda_startupfunction mt8365_mt6357_int_adda_shutdownfunction mt8365_mt6357_gpio_probefunction mt8365_mt6357_dev_probe
Annotated Snippet
struct mt8365_mt6357_priv {
struct pinctrl *pinctrl;
struct pinctrl_state *pin_states[PIN_STATE_MAX];
};
enum {
/* FE */
DAI_LINK_DL1_PLAYBACK = 0,
DAI_LINK_DL2_PLAYBACK,
DAI_LINK_AWB_CAPTURE,
DAI_LINK_VUL_CAPTURE,
/* BE */
DAI_LINK_2ND_I2S_INTF,
DAI_LINK_DMIC,
DAI_LINK_INT_ADDA,
DAI_LINK_NUM
};
static const struct snd_soc_dapm_widget mt8365_mt6357_widgets[] = {
SND_SOC_DAPM_OUTPUT("HDMI Out"),
};
static const struct snd_soc_dapm_route mt8365_mt6357_routes[] = {
{"HDMI Out", NULL, "2ND I2S Playback"},
{"DMIC In", NULL, "MICBIAS0"},
};
static int mt8365_mt6357_int_adda_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mt8365_mt6357_priv *priv = snd_soc_card_get_drvdata(rtd->card);
int ret = 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (IS_ERR(priv->pin_states[PIN_STATE_MOSI_ON]))
return ret;
ret = pinctrl_select_state(priv->pinctrl,
priv->pin_states[PIN_STATE_MOSI_ON]);
if (ret)
dev_err(rtd->card->dev, "%s failed to select state %d\n",
__func__, ret);
}
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
if (IS_ERR(priv->pin_states[PIN_STATE_MISO_ON]))
return ret;
ret = pinctrl_select_state(priv->pinctrl,
priv->pin_states[PIN_STATE_MISO_ON]);
if (ret)
dev_err(rtd->card->dev, "%s failed to select state %d\n",
__func__, ret);
}
return 0;
}
static void mt8365_mt6357_int_adda_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mt8365_mt6357_priv *priv = snd_soc_card_get_drvdata(rtd->card);
int ret = 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (IS_ERR(priv->pin_states[PIN_STATE_MOSI_OFF]))
return;
ret = pinctrl_select_state(priv->pinctrl,
priv->pin_states[PIN_STATE_MOSI_OFF]);
if (ret)
dev_err(rtd->card->dev, "%s failed to select state %d\n",
__func__, ret);
}
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
if (IS_ERR(priv->pin_states[PIN_STATE_MISO_OFF]))
return;
ret = pinctrl_select_state(priv->pinctrl,
priv->pin_states[PIN_STATE_MISO_OFF]);
if (ret)
dev_err(rtd->card->dev, "%s failed to select state %d\n",
__func__, ret);
}
}
static const struct snd_soc_ops mt8365_mt6357_int_adda_ops = {
.startup = mt8365_mt6357_int_adda_startup,
.shutdown = mt8365_mt6357_int_adda_shutdown,
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/dev_printk.h`, `linux/err.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/pinctrl/consumer.h`, `linux/platform_device.h`, `linux/types.h`.
- Detected declarations: `struct mt8365_mt6357_priv`, `enum pinctrl_pin_state`, `function mt8365_mt6357_int_adda_startup`, `function mt8365_mt6357_int_adda_shutdown`, `function mt8365_mt6357_gpio_probe`, `function mt8365_mt6357_dev_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.