sound/soc/codecs/nau8821.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/nau8821.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/nau8821.c- Extension
.c- Size
- 64590 bytes
- Lines
- 2007
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/dmi.hlinux/i2c.hlinux/init.hlinux/math64.hlinux/module.hlinux/regmap.hlinux/slab.hsound/core.hsound/initval.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hnau8821.h
Detected Declarations
struct nau8821_fllstruct nau8821_fll_attrstruct nau8821_osr_attrstruct nau8821_dmic_speedfunction nau8821_readable_regfunction nau8821_writeable_regfunction nau8821_volatile_regfunction nau8821_biq_coeff_getfunction nau8821_biq_coeff_putfunction dmic_clock_controlfunction nau8821_left_adc_eventfunction nau8821_right_adc_eventfunction nau8821_pump_eventfunction nau8821_output_dac_eventfunction system_clock_controlfunction nau8821_left_fepga_eventfunction nau8821_get_osrfunction nau8821_dai_startupfunction nau8821_hw_paramsfunction nau8821_set_dai_fmtfunction nau8821_digital_mutefunction nau8821_is_jack_insertedfunction nau8821_irq_status_clearfunction nau8821_eject_jackfunction nau8821_jdet_workfunction nau8821_setup_inserted_irqfunction nau8821_interruptfunction nau8821_component_probefunction nau8821_component_removefunction nau8821_calc_fll_paramfunction nau8821_fll_applyfunction nau8821_set_fllfunction nau8821_configure_mclk_as_sysclkfunction nau8821_configure_sysclkfunction nau8821_set_sysclkfunction nau8821_resume_setupfunction nau8821_set_bias_levelfunction nau8821_suspendfunction nau8821_resumefunction nau8821_enable_jack_detectfunction nau8821_reset_chipfunction nau8821_print_device_propertiesfunction nau8821_read_device_propertiesfunction nau8821_init_regsfunction nau8821_setup_irqfunction nau8821_check_quirksfunction nau8821_i2c_probeexport nau8821_enable_jack_detect
Annotated Snippet
struct nau8821_fll {
int mclk_src;
int ratio;
int fll_frac;
int fll_int;
int clk_ref_div;
};
struct nau8821_fll_attr {
unsigned int param;
unsigned int val;
};
/* scaling for mclk from sysclk_src output */
static const struct nau8821_fll_attr mclk_src_scaling[] = {
{ 1, 0x0 },
{ 2, 0x2 },
{ 4, 0x3 },
{ 8, 0x4 },
{ 16, 0x5 },
{ 32, 0x6 },
{ 3, 0x7 },
{ 6, 0xa },
{ 12, 0xb },
{ 24, 0xc },
{ 48, 0xd },
{ 96, 0xe },
{ 5, 0xf },
};
/* ratio for input clk freq */
static const struct nau8821_fll_attr fll_ratio[] = {
{ 512000, 0x01 },
{ 256000, 0x02 },
{ 128000, 0x04 },
{ 64000, 0x08 },
{ 32000, 0x10 },
{ 8000, 0x20 },
{ 4000, 0x40 },
};
static const struct nau8821_fll_attr fll_pre_scalar[] = {
{ 0, 0x0 },
{ 1, 0x1 },
{ 2, 0x2 },
{ 3, 0x3 },
};
/* over sampling rate */
struct nau8821_osr_attr {
unsigned int osr;
unsigned int clk_src;
};
static const struct nau8821_osr_attr osr_dac_sel[] = {
{ 64, 2 }, /* OSR 64, SRC 1/4 */
{ 256, 0 }, /* OSR 256, SRC 1 */
{ 128, 1 }, /* OSR 128, SRC 1/2 */
{ 0, 0 },
{ 32, 3 }, /* OSR 32, SRC 1/8 */
};
static const struct nau8821_osr_attr osr_adc_sel[] = {
{ 32, 3 }, /* OSR 32, SRC 1/8 */
{ 64, 2 }, /* OSR 64, SRC 1/4 */
{ 128, 1 }, /* OSR 128, SRC 1/2 */
{ 256, 0 }, /* OSR 256, SRC 1 */
};
struct nau8821_dmic_speed {
unsigned int param;
unsigned int val;
};
static const struct nau8821_dmic_speed dmic_speed_sel[] = {
{ 0, 0x0 }, /*SPEED 1, SRC 1 */
{ 1, 0x1 }, /*SPEED 2, SRC 1/2 */
{ 2, 0x2 }, /*SPEED 4, SRC 1/4 */
{ 3, 0x3 }, /*SPEED 8, SRC 1/8 */
};
static const struct reg_default nau8821_reg_defaults[] = {
{ NAU8821_R01_ENA_CTRL, 0x00ff },
{ NAU8821_R03_CLK_DIVIDER, 0x0050 },
{ NAU8821_R04_FLL1, 0x0 },
{ NAU8821_R05_FLL2, 0x00bc },
{ NAU8821_R06_FLL3, 0x0008 },
{ NAU8821_R07_FLL4, 0x0010 },
{ NAU8821_R08_FLL5, 0x4000 },
{ NAU8821_R09_FLL6, 0x6900 },
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/delay.h`, `linux/dmi.h`, `linux/i2c.h`, `linux/init.h`, `linux/math64.h`, `linux/module.h`.
- Detected declarations: `struct nau8821_fll`, `struct nau8821_fll_attr`, `struct nau8821_osr_attr`, `struct nau8821_dmic_speed`, `function nau8821_readable_reg`, `function nau8821_writeable_reg`, `function nau8821_volatile_reg`, `function nau8821_biq_coeff_get`, `function nau8821_biq_coeff_put`, `function dmic_clock_control`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.