sound/soc/codecs/cx2072x.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cx2072x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cx2072x.c- Extension
.c- Size
- 52479 bytes
- Lines
- 1719
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/gpio.hlinux/init.hlinux/i2c.hlinux/module.hlinux/platform_device.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hsound/core.hsound/initval.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/tlv.hsound/soc.hsound/soc-dapm.hcx2072x.h
Detected Declarations
struct cx2072x_privfunction cx2072x_register_sizefunction cx2072x_readable_registerfunction cx2072x_volatile_registerfunction cx2072x_reg_raw_writefunction cx2072x_reg_writefunction cx2072x_reg_readfunction get_div_from_mclkfunction cx2072x_config_pllfunction cx2072x_config_i2spcmfunction afg_power_evfunction cx2072x_hw_paramsfunction cx2072x_set_dai_bclk_ratiofunction cx2072x_set_dai_sysclkfunction cx2072x_set_dai_fmtfunction cx2072x_set_bias_levelfunction cx2072x_enable_jack_detectfunction cx2072x_disable_jack_detectfunction cx2072x_jack_status_checkfunction cx2072x_set_jackfunction cx2072x_probefunction cx2072x_dsp_dai_probefunction cx2072x_runtime_suspendfunction cx2072x_runtime_resumefunction cx2072x_i2c_probefunction cx2072x_i2c_remove
Annotated Snippet
struct cx2072x_priv {
struct regmap *regmap;
struct clk *mclk;
unsigned int mclk_rate;
struct device *dev;
struct snd_soc_component *codec;
struct snd_soc_jack_gpio jack_gpio;
struct mutex lock;
unsigned int bclk_ratio;
bool pll_changed;
bool i2spcm_changed;
int sample_size;
int frame_size;
int sample_rate;
unsigned int dai_fmt;
bool en_aec_ref;
};
/*
* DAC/ADC Volume
*
* max : 74 : 0 dB
* ( in 1 dB step )
* min : 0 : -74 dB
*/
static const DECLARE_TLV_DB_SCALE(adc_tlv, -7400, 100, 0);
static const DECLARE_TLV_DB_SCALE(dac_tlv, -7400, 100, 0);
static const DECLARE_TLV_DB_SCALE(boost_tlv, 0, 1200, 0);
static const DECLARE_TLV_DB_RANGE(hpf_tlv,
0, 0, TLV_DB_SCALE_ITEM(120, 0, 0),
1, 63, TLV_DB_SCALE_ITEM(30, 30, 0)
);
/* Lookup table for PRE_DIV */
static const struct {
unsigned int mclk;
unsigned int div;
} mclk_pre_div[] = {
{ 6144000, 1 },
{ 12288000, 2 },
{ 19200000, 3 },
{ 26000000, 4 },
{ 28224000, 5 },
{ 36864000, 6 },
{ 36864000, 7 },
{ 48000000, 8 },
{ 49152000, 8 },
};
/*
* cx2072x register cache.
*/
static const struct reg_default cx2072x_reg_defaults[] = {
{ CX2072X_AFG_POWER_STATE, 0x00000003 },
{ CX2072X_UM_RESPONSE, 0x00000000 },
{ CX2072X_GPIO_DATA, 0x00000000 },
{ CX2072X_GPIO_ENABLE, 0x00000000 },
{ CX2072X_GPIO_DIRECTION, 0x00000000 },
{ CX2072X_GPIO_WAKE, 0x00000000 },
{ CX2072X_GPIO_UM_ENABLE, 0x00000000 },
{ CX2072X_GPIO_STICKY_MASK, 0x00000000 },
{ CX2072X_DAC1_CONVERTER_FORMAT, 0x00000031 },
{ CX2072X_DAC1_AMP_GAIN_RIGHT, 0x0000004a },
{ CX2072X_DAC1_AMP_GAIN_LEFT, 0x0000004a },
{ CX2072X_DAC1_POWER_STATE, 0x00000433 },
{ CX2072X_DAC1_CONVERTER_STREAM_CHANNEL, 0x00000000 },
{ CX2072X_DAC1_EAPD_ENABLE, 0x00000000 },
{ CX2072X_DAC2_CONVERTER_FORMAT, 0x00000031 },
{ CX2072X_DAC2_AMP_GAIN_RIGHT, 0x0000004a },
{ CX2072X_DAC2_AMP_GAIN_LEFT, 0x0000004a },
{ CX2072X_DAC2_POWER_STATE, 0x00000433 },
{ CX2072X_DAC2_CONVERTER_STREAM_CHANNEL, 0x00000000 },
{ CX2072X_ADC1_CONVERTER_FORMAT, 0x00000031 },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_0, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_0, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_1, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_1, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_2, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_2, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_3, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_3, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_4, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_4, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_5, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_5, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_RIGHT_6, 0x0000004a },
{ CX2072X_ADC1_AMP_GAIN_LEFT_6, 0x0000004a },
{ CX2072X_ADC1_CONNECTION_SELECT_CONTROL, 0x00000000 },
{ CX2072X_ADC1_POWER_STATE, 0x00000433 },
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio.h`, `linux/init.h`, `linux/i2c.h`, `linux/module.h`, `linux/platform_device.h`.
- Detected declarations: `struct cx2072x_priv`, `function cx2072x_register_size`, `function cx2072x_readable_register`, `function cx2072x_volatile_register`, `function cx2072x_reg_raw_write`, `function cx2072x_reg_write`, `function cx2072x_reg_read`, `function get_div_from_mclk`, `function cx2072x_config_pll`, `function cx2072x_config_i2spcm`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.