sound/soc/codecs/es8389.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/es8389.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/es8389.c- Extension
.c- Size
- 42568 bytes
- Lines
- 1037
- 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/clk.hlinux/module.hlinux/kernel.hlinux/delay.hlinux/i2c.hlinux/regmap.hlinux/regulator/consumer.hsound/core.hsound/pcm.hsound/pcm_params.hsound/tlv.hsound/soc.hes8389.h
Detected Declarations
struct es8389_privatestruct _coeff_divfunction es8389_volatile_registerfunction es8389_dmic_setfunction get_coefffunction es8389_set_dai_sysclkfunction es8389_set_tdm_slotfunction es8389_set_dai_fmtfunction es8389_pcm_hw_paramsfunction es8389_set_bias_levelfunction es8389_mutefunction es8389_initfunction es8389_suspendfunction es8389_resumefunction es8389_probefunction es8389_removefunction es8389_i2c_shutdownfunction es8389_i2c_probe
Annotated Snippet
struct es8389_private {
struct regmap *regmap;
struct clk *mclk;
struct regulator_bulk_data core_supply[2];
unsigned int sysclk;
int mastermode;
u8 mclk_src;
u8 vddd;
int version;
enum snd_soc_bias_level bias_level;
};
static const char * const es8389_core_supplies[] = {
"vddd",
"vdda",
};
static bool es8389_volatile_register(struct device *dev,
unsigned int reg)
{
if ((reg <= 0xff))
return true;
else
return false;
}
static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -9550, 50, 0);
static const DECLARE_TLV_DB_SCALE(pga_vol_tlv, 0, 300, 0);
static const DECLARE_TLV_DB_SCALE(mix_vol_tlv, -9500, 100, 0);
static const DECLARE_TLV_DB_SCALE(alc_target_tlv, -3200, 200, 0);
static const DECLARE_TLV_DB_SCALE(alc_max_level, -3200, 200, 0);
static int es8389_dmic_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol);
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
struct es8389_private *es8389 = snd_soc_component_get_drvdata(component);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
bool changed1, changed2;
val = ucontrol->value.integer.value[0];
if (val > 1)
return -EINVAL;
if (val) {
regmap_update_bits_check(es8389->regmap, ES8389_DMIC_EN, 0xC0, 0xC0, &changed1);
regmap_update_bits_check(es8389->regmap, ES8389_ADC_MODE, 0x03, 0x03, &changed2);
} else {
regmap_update_bits_check(es8389->regmap, ES8389_DMIC_EN, 0xC0, 0x00, &changed1);
regmap_update_bits_check(es8389->regmap, ES8389_ADC_MODE, 0x03, 0x00, &changed2);
}
if (changed1 & changed2)
return snd_soc_dapm_mux_update_power(dapm, kcontrol, val, e, NULL);
else
return 0;
}
static const char *const alc[] = {
"ALC OFF",
"ADCR ALC ON",
"ADCL ALC ON",
"ADCL & ADCL ALC ON",
};
static const char *const ramprate[] = {
"0.125db/1 LRCK",
"0.125db/4 LRCK",
"0.125db/8 LRCK",
"0.125db/16 LRCK",
"0.125db/32 LRCK",
"0.125db/64 LRCK",
"0.125db/128 LRCK",
"0.125db/256 LRCK",
"0.125db/512 LRCK",
"0.125db/1024 LRCK",
"0.125db/2048 LRCK",
"0.125db/4096 LRCK",
"0.125db/8192 LRCK",
"0.125db/16384 LRCK",
"0.125db/32768 LRCK",
"0.125db/65536 LRCK",
};
static const char *const winsize[] = {
"2 LRCK",
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/kernel.h`, `linux/delay.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/regulator/consumer.h`, `sound/core.h`.
- Detected declarations: `struct es8389_private`, `struct _coeff_div`, `function es8389_volatile_register`, `function es8389_dmic_set`, `function get_coeff`, `function es8389_set_dai_sysclk`, `function es8389_set_tdm_slot`, `function es8389_set_dai_fmt`, `function es8389_pcm_hw_params`, `function es8389_set_bias_level`.
- 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.