sound/soc/codecs/nau8825.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/nau8825.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/nau8825.c- Extension
.c- Size
- 99385 bytes
- Lines
- 2969
- 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/module.hlinux/delay.hlinux/init.hlinux/int_log.hlinux/i2c.hlinux/regmap.hlinux/slab.hlinux/clk.hlinux/acpi.hlinux/math64.hlinux/semaphore.hsound/initval.hsound/tlv.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hnau8825.h
Detected Declarations
struct nau8825_fllstruct nau8825_fll_attrstruct nau8825_osr_attrfunction nau8825_sema_acquirefunction downfunction nau8825_sema_resetfunction nau8825_hpvol_rampfunction log10function nau8825_xtalk_sidetonefunction nau8825_xtalk_baktab_index_by_regfunction nau8825_xtalk_backupfunction nau8825_xtalk_restorefunction nau8825_xtalk_prepare_dacfunction nau8825_xtalk_prepare_adcfunction nau8825_xtalk_clockfunction nau8825_xtalk_preparefunction nau8825_xtalk_clean_dacfunction nau8825_xtalk_clean_adcfunction nau8825_xtalk_cleanfunction nau8825_xtalk_imm_startfunction nau8825_xtalk_imm_stopfunction JKTIPfunction nau8825_xtalk_workfunction nau8825_xtalk_cancelfunction nau8825_readable_regfunction nau8825_writeable_regfunction nau8825_volatile_regfunction nau8825_fepga_eventfunction nau8825_adc_eventfunction nau8825_pump_eventfunction nau8825_output_dac_eventfunction system_clock_controlfunction nau8825_biq_coeff_getfunction nau8825_biq_coeff_putfunction nau8825_get_osrfunction nau8825_dai_startupfunction nau8825_hw_paramsfunction nau8825_set_dai_fmtfunction nau8825_set_tdm_slotfunction hweight_longfunction nau8825_enable_jack_detectfunction nau8825_is_jack_insertedfunction nau8825_restart_jack_detectionfunction nau8825_int_status_clear_allfunction nau8825_eject_jackfunction nau8825_setup_auto_irqfunction nau8825_button_decodefunction nau8825_high_imped_detection
Annotated Snippet
struct nau8825_fll {
int mclk_src;
int ratio;
int fll_frac;
int fll_frac_num;
int fll_int;
int clk_ref_div;
};
struct nau8825_fll_attr {
unsigned int param;
unsigned int val;
};
/* scaling for mclk from sysclk_src output */
static const struct nau8825_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 nau8825_fll_attr fll_ratio[] = {
{ 512000, 0x01 },
{ 256000, 0x02 },
{ 128000, 0x04 },
{ 64000, 0x08 },
{ 32000, 0x10 },
{ 8000, 0x20 },
{ 4000, 0x40 },
};
static const struct nau8825_fll_attr fll_pre_scalar[] = {
{ 1, 0x0 },
{ 2, 0x1 },
{ 4, 0x2 },
{ 8, 0x3 },
};
/* over sampling rate */
struct nau8825_osr_attr {
unsigned int osr;
unsigned int clk_src;
};
static const struct nau8825_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 nau8825_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 */
};
static const struct reg_default nau8825_reg_defaults[] = {
{ NAU8825_REG_ENA_CTRL, 0x00ff },
{ NAU8825_REG_IIC_ADDR_SET, 0x0 },
{ NAU8825_REG_CLK_DIVIDER, 0x0050 },
{ NAU8825_REG_FLL1, 0x0 },
{ NAU8825_REG_FLL2, 0x3126 },
{ NAU8825_REG_FLL3, 0x0008 },
{ NAU8825_REG_FLL4, 0x0010 },
{ NAU8825_REG_FLL5, 0x0 },
{ NAU8825_REG_FLL6, 0x6000 },
{ NAU8825_REG_FLL_VCO_RSV, 0xf13c },
{ NAU8825_REG_HSD_CTRL, 0x000c },
{ NAU8825_REG_JACK_DET_CTRL, 0x0 },
{ NAU8825_REG_INTERRUPT_MASK, 0x0 },
{ NAU8825_REG_INTERRUPT_DIS_CTRL, 0xffff },
{ NAU8825_REG_SAR_CTRL, 0x0015 },
{ NAU8825_REG_KEYDET_CTRL, 0x0110 },
{ NAU8825_REG_VDET_THRESHOLD_1, 0x0 },
{ NAU8825_REG_VDET_THRESHOLD_2, 0x0 },
{ NAU8825_REG_VDET_THRESHOLD_3, 0x0 },
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/init.h`, `linux/int_log.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/slab.h`, `linux/clk.h`.
- Detected declarations: `struct nau8825_fll`, `struct nau8825_fll_attr`, `struct nau8825_osr_attr`, `function nau8825_sema_acquire`, `function down`, `function nau8825_sema_reset`, `function nau8825_hpvol_ramp`, `function log10`, `function nau8825_xtalk_sidetone`, `function nau8825_xtalk_baktab_index_by_reg`.
- 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.