sound/soc/amd/acp-es8336.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/acp-es8336.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/acp-es8336.c- Extension
.c- Size
- 8174 bytes
- Lines
- 320
- 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.hlinux/device.hlinux/dmi.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/i2c.hlinux/input.hlinux/module.hlinux/platform_device.hlinux/acpi.hacp.h
Detected Declarations
function sof_es8316_speaker_power_eventfunction st_es8336_initfunction st_es8336_codec_startupfunction st_es8336_late_probefunction st_es8336_quirk_cbfunction st_es8336_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Machine driver for AMD Stoney platform using ES8336 Codec
*
* Copyright 2022 Advanced Micro Devices, Inc.
*/
#include <sound/core.h>
#include <sound/soc.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include "acp.h"
#define DUAL_CHANNEL 2
#define DRV_NAME "acp2x_mach"
#define ST_JADEITE 1
#define ES8336_PLL_FREQ (48000 * 256)
static unsigned long acp2x_machine_id;
static struct snd_soc_jack st_jack;
static struct device *codec_dev;
static struct gpio_desc *gpio_pa;
static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
if (SND_SOC_DAPM_EVENT_ON(event))
gpiod_set_value_cansleep(gpio_pa, true);
else
gpiod_set_value_cansleep(gpio_pa, false);
return 0;
}
static struct snd_soc_jack_pin st_es8316_jack_pins[] = {
{
.pin = "Headphone",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static int st_es8336_init(struct snd_soc_pcm_runtime *rtd)
{
int ret;
struct snd_soc_card *card;
struct snd_soc_component *codec;
codec = snd_soc_rtd_to_codec(rtd, 0)->component;
card = rtd->card;
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0,
&st_jack, st_es8316_jack_pins,
ARRAY_SIZE(st_es8316_jack_pins));
if (ret) {
dev_err(card->dev, "HP jack creation failed %d\n", ret);
return ret;
}
snd_jack_set_key(st_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
ret = snd_soc_component_set_jack(codec, &st_jack, NULL);
if (ret) {
dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
return ret;
}
return 0;
}
static const unsigned int st_channels[] = {
DUAL_CHANNEL,
};
static const unsigned int st_rates[] = {
48000,
};
Annotation
- Immediate include surface: `sound/core.h`, `sound/soc.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc-dapm.h`, `sound/jack.h`, `linux/device.h`, `linux/dmi.h`.
- Detected declarations: `function sof_es8316_speaker_power_event`, `function st_es8336_init`, `function st_es8336_codec_startup`, `function st_es8336_late_probe`, `function st_es8336_quirk_cb`, `function st_es8336_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.