sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c- Extension
.c- Size
- 13525 bytes
- Lines
- 456
- 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
sound/core.hsound/soc.hsound/pcm.hsound/pcm_params.hsound/soc-dapm.hsound/jack.hsound/soc-acpi.hlinux/clk.hlinux/gpio/consumer.hlinux/module.hlinux/i2c.hlinux/input.hlinux/io.hlinux/acpi.hlinux/dmi.hlinux/string_choices.h../acp-mach.hacp3x-es83xx.h
Detected Declarations
struct acp3x_es83xx_privatefunction acp3x_es83xx_codec_startupfunction acp3x_es83xx_configure_widgetsfunction acp3x_es83xx_headphone_power_eventfunction acp3x_es83xx_speaker_power_eventfunction acp3x_es83xx_suspend_prefunction acp3x_es83xx_resume_postfunction acp3x_es83xx_configure_gpiosfunction acp3x_es83xx_configure_micsfunction acp3x_es83xx_initfunction acp3x_es83xx_configure_linkfunction acp3x_es83xx_probefunction acp3x_es83xx_init_ops
Annotated Snippet
struct acp3x_es83xx_private {
bool speaker_on;
bool headphone_on;
unsigned long quirk;
struct snd_soc_component *codec;
struct device *codec_dev;
struct gpio_desc *gpio_speakers, *gpio_headphone;
struct acpi_gpio_params enable_spk_gpio, enable_hp_gpio;
struct acpi_gpio_mapping gpio_mapping[3];
struct snd_soc_dapm_route mic_map[2];
};
static const unsigned int channels[] = {
DUAL_CHANNEL,
};
static const struct snd_pcm_hw_constraint_list constraints_channels = {
.count = ARRAY_SIZE(channels),
.list = channels,
.mask = 0,
};
#define ES83xx_12288_KHZ_MCLK_FREQ (48000 * 256)
#define ES83xx_48_MHZ_MCLK_FREQ (48000 * 1000)
static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
static int acp3x_es83xx_codec_startup(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct acp3x_es83xx_private *priv;
unsigned int freq;
int ret;
runtime = substream->runtime;
rtd = snd_soc_substream_to_rtd(substream);
codec_dai = snd_soc_rtd_to_codec(rtd, 0);
priv = get_mach_priv(rtd->card);
if (priv->quirk & ES83XX_48_MHZ_MCLK) {
dev_dbg(priv->codec_dev, "using a 48Mhz MCLK\n");
freq = ES83xx_48_MHZ_MCLK_FREQ;
} else {
dev_dbg(priv->codec_dev, "using a 12.288Mhz MCLK\n");
freq = ES83xx_12288_KHZ_MCLK_FREQ;
}
ret = snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_OUT);
if (ret < 0) {
dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret);
return ret;
}
runtime->hw.channels_max = DUAL_CHANNEL;
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_channels);
return 0;
}
static struct snd_soc_jack es83xx_jack;
static struct snd_soc_jack_pin es83xx_jack_pins[] = {
{
.pin = "Headphone",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static const struct snd_soc_dapm_widget acp3x_es83xx_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Internal Mic", NULL),
SND_SOC_DAPM_SUPPLY("Headphone Power", SND_SOC_NOPM, 0, 0,
acp3x_es83xx_headphone_power_event,
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0,
acp3x_es83xx_speaker_power_event,
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
Annotation
- Immediate include surface: `sound/core.h`, `sound/soc.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc-dapm.h`, `sound/jack.h`, `sound/soc-acpi.h`, `linux/clk.h`.
- Detected declarations: `struct acp3x_es83xx_private`, `function acp3x_es83xx_codec_startup`, `function acp3x_es83xx_configure_widgets`, `function acp3x_es83xx_headphone_power_event`, `function acp3x_es83xx_speaker_power_event`, `function acp3x_es83xx_suspend_pre`, `function acp3x_es83xx_resume_post`, `function acp3x_es83xx_configure_gpios`, `function acp3x_es83xx_configure_mics`, `function acp3x_es83xx_init`.
- 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.