sound/soc/codecs/nau8822.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/nau8822.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/nau8822.c- Extension
.c- Size
- 38994 bytes
- Lines
- 1262
- 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/module.hlinux/moduleparam.hlinux/kernel.hlinux/init.hlinux/clk.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.hasm/div64.hnau8822.h
Detected Declarations
function nau8822_readable_regfunction nau8822_writeable_regfunction nau8822_volatilefunction nau8822_eq_getfunction nau8822_eq_putfunction check_mclk_select_pllfunction nau8822_calc_pllfunction nau8822_config_clkdivfunction nau8822_set_pllfunction nau8822_set_dai_sysclkfunction nau8822_set_dai_fmtfunction nau8822_hw_paramsfunction nau8822_mutefunction nau8822_set_bias_levelfunction nau8822_suspendfunction nau8822_resumefunction nau8822_probefunction nau8822_i2c_probefunction nau8822_i2c_remove
Annotated Snippet
if (ret) {
dev_err(component->dev,
"EQ configuration fail, register: %x ret: %d\n",
reg + i, ret);
kfree(data);
return ret;
}
}
kfree(data);
return 0;
}
static const char * const nau8822_companding[] = {
"Off", "NC", "u-law", "A-law"};
static const struct soc_enum nau8822_companding_adc_enum =
SOC_ENUM_SINGLE(NAU8822_REG_COMPANDING_CONTROL, NAU8822_ADCCM_SFT,
ARRAY_SIZE(nau8822_companding), nau8822_companding);
static const struct soc_enum nau8822_companding_dac_enum =
SOC_ENUM_SINGLE(NAU8822_REG_COMPANDING_CONTROL, NAU8822_DACCM_SFT,
ARRAY_SIZE(nau8822_companding), nau8822_companding);
static const char * const nau8822_eqmode[] = {"Capture", "Playback"};
static const struct soc_enum nau8822_eqmode_enum =
SOC_ENUM_SINGLE(NAU8822_REG_EQ1, NAU8822_EQM_SFT,
ARRAY_SIZE(nau8822_eqmode), nau8822_eqmode);
static const char * const nau8822_alc1[] = {"Off", "Right", "Left", "Both"};
static const char * const nau8822_alc3[] = {"Normal", "Limiter"};
static const struct soc_enum nau8822_alc_enable_enum =
SOC_ENUM_SINGLE(NAU8822_REG_ALC_CONTROL_1, NAU8822_ALCEN_SFT,
ARRAY_SIZE(nau8822_alc1), nau8822_alc1);
static const struct soc_enum nau8822_alc_mode_enum =
SOC_ENUM_SINGLE(NAU8822_REG_ALC_CONTROL_3, NAU8822_ALCM_SFT,
ARRAY_SIZE(nau8822_alc3), nau8822_alc3);
static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(spk_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(pga_boost_tlv, 0, 2000, 0);
static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
static const DECLARE_TLV_DB_SCALE(limiter_tlv, 0, 100, 0);
static const struct snd_kcontrol_new nau8822_snd_controls[] = {
SOC_ENUM("ADC Companding", nau8822_companding_adc_enum),
SOC_ENUM("DAC Companding", nau8822_companding_dac_enum),
SOC_ENUM("EQ Function", nau8822_eqmode_enum),
SND_SOC_BYTES_EXT("EQ Parameters", 10,
nau8822_eq_get, nau8822_eq_put),
SOC_DOUBLE("DAC Inversion Switch",
NAU8822_REG_DAC_CONTROL, 0, 1, 1, 0),
SOC_DOUBLE_R_TLV("PCM Volume",
NAU8822_REG_LEFT_DAC_DIGITAL_VOLUME,
NAU8822_REG_RIGHT_DAC_DIGITAL_VOLUME, 0, 255, 0, digital_tlv),
SOC_SINGLE("High Pass Filter Switch",
NAU8822_REG_ADC_CONTROL, 8, 1, 0),
SOC_SINGLE("High Pass Cut Off",
NAU8822_REG_ADC_CONTROL, 4, 7, 0),
SOC_DOUBLE("ADC Inversion Switch",
NAU8822_REG_ADC_CONTROL, 0, 1, 1, 0),
SOC_DOUBLE_R_TLV("ADC Volume",
NAU8822_REG_LEFT_ADC_DIGITAL_VOLUME,
NAU8822_REG_RIGHT_ADC_DIGITAL_VOLUME, 0, 255, 0, digital_tlv),
SOC_SINGLE("DAC Limiter Switch",
NAU8822_REG_DAC_LIMITER_1, 8, 1, 0),
SOC_SINGLE("DAC Limiter Decay",
NAU8822_REG_DAC_LIMITER_1, 4, 15, 0),
SOC_SINGLE("DAC Limiter Attack",
NAU8822_REG_DAC_LIMITER_1, 0, 15, 0),
SOC_SINGLE("DAC Limiter Threshold",
NAU8822_REG_DAC_LIMITER_2, 4, 7, 0),
SOC_SINGLE_TLV("DAC Limiter Volume",
NAU8822_REG_DAC_LIMITER_2, 0, 12, 0, limiter_tlv),
SOC_ENUM("ALC Mode", nau8822_alc_mode_enum),
SOC_ENUM("ALC Enable Switch", nau8822_alc_enable_enum),
SOC_SINGLE("ALC Min Gain",
NAU8822_REG_ALC_CONTROL_1, 0, 7, 0),
SOC_SINGLE("ALC Max Gain",
NAU8822_REG_ALC_CONTROL_1, 3, 7, 0),
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/init.h`, `linux/clk.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`.
- Detected declarations: `function nau8822_readable_reg`, `function nau8822_writeable_reg`, `function nau8822_volatile`, `function nau8822_eq_get`, `function nau8822_eq_put`, `function check_mclk_select_pll`, `function nau8822_calc_pll`, `function nau8822_config_clkdiv`, `function nau8822_set_pll`, `function nau8822_set_dai_sysclk`.
- 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.