sound/soc/intel/boards/bytcht_es8316.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/bytcht_es8316.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/boards/bytcht_es8316.c- Extension
.c- Size
- 21897 bytes
- Lines
- 756
- 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/acpi.hlinux/clk.hlinux/device.hlinux/dmi.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/input.hlinux/module.hlinux/platform_device.hlinux/slab.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.h../../codecs/es83xx-dsm-common.h../atom/sst-atom-controls.h../common/soc-intel-quirks.h
Detected Declarations
struct byt_cht_es8316_privatefunction log_quirksfunction byt_cht_es8316_speaker_power_eventfunction byt_cht_es8316_disable_mclkfunction byt_cht_es8316_initfunction byt_cht_es8316_exitfunction byt_cht_es8316_codec_fixupfunction byt_cht_es8316_aif1_startupfunction byt_cht_es8316_suspendfunction for_each_card_componentsfunction byt_cht_es8316_resumefunction for_each_card_componentsfunction byt_cht_es8316_get_quirks_from_dsmfunction snd_byt_cht_es8316_mc_probefunction snd_byt_cht_es8316_mc_remove
Annotated Snippet
struct byt_cht_es8316_private {
struct clk *mclk;
struct snd_soc_jack jack;
struct gpio_desc *speaker_en_gpio;
struct device *codec_dev;
bool speaker_en;
bool mclk_enabled;
};
enum {
BYT_CHT_ES8316_INTMIC_IN1_MAP,
BYT_CHT_ES8316_INTMIC_IN2_MAP,
};
#define BYT_CHT_ES8316_MAP_MASK GENMASK(3, 0)
#define BYT_CHT_ES8316_MAP(quirk) ((quirk) & BYT_CHT_ES8316_MAP_MASK)
#define BYT_CHT_ES8316_SSP0 BIT(16)
#define BYT_CHT_ES8316_MONO_SPEAKER BIT(17)
#define BYT_CHT_ES8316_JD_INVERTED BIT(18)
static unsigned long quirk;
static int quirk_override = -1;
module_param_named(quirk, quirk_override, int, 0444);
MODULE_PARM_DESC(quirk, "Board-specific quirk override");
static void log_quirks(struct device *dev)
{
int map;
map = BYT_CHT_ES8316_MAP(quirk);
switch (map) {
case BYT_CHT_ES8316_INTMIC_IN1_MAP:
dev_info(dev, "quirk IN1_MAP enabled");
break;
case BYT_CHT_ES8316_INTMIC_IN2_MAP:
dev_info(dev, "quirk IN2_MAP enabled");
break;
default:
dev_warn_once(dev, "quirk sets invalid input map: 0x%x, default to INTMIC_IN1_MAP\n", map);
quirk &= ~BYT_CHT_ES8316_MAP_MASK;
quirk |= BYT_CHT_ES8316_INTMIC_IN1_MAP;
break;
}
if (quirk & BYT_CHT_ES8316_SSP0)
dev_info(dev, "quirk SSP0 enabled");
if (quirk & BYT_CHT_ES8316_MONO_SPEAKER)
dev_info(dev, "quirk MONO_SPEAKER enabled\n");
if (quirk & BYT_CHT_ES8316_JD_INVERTED)
dev_info(dev, "quirk JD_INVERTED enabled\n");
}
static int byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
if (SND_SOC_DAPM_EVENT_ON(event))
priv->speaker_en = true;
else
priv->speaker_en = false;
gpiod_set_value_cansleep(priv->speaker_en_gpio, priv->speaker_en);
return 0;
}
static const struct snd_soc_dapm_widget byt_cht_es8316_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("Speaker Power", SND_SOC_NOPM, 0, 0,
byt_cht_es8316_speaker_power_event,
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
};
static const struct snd_soc_dapm_route byt_cht_es8316_audio_map[] = {
{"Headphone", NULL, "HPOL"},
{"Headphone", NULL, "HPOR"},
/*
* There is no separate speaker output instead the speakers are muxed to
* the HP outputs. The mux is controlled by the "Speaker Power" supply.
*/
{"Speaker", NULL, "HPOL"},
{"Speaker", NULL, "HPOR"},
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/device.h`, `linux/dmi.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/input.h`.
- Detected declarations: `struct byt_cht_es8316_private`, `function log_quirks`, `function byt_cht_es8316_speaker_power_event`, `function byt_cht_es8316_disable_mclk`, `function byt_cht_es8316_init`, `function byt_cht_es8316_exit`, `function byt_cht_es8316_codec_fixup`, `function byt_cht_es8316_aif1_startup`, `function byt_cht_es8316_suspend`, `function for_each_card_components`.
- 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.