sound/soc/codecs/rk3308_codec.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rk3308_codec.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rk3308_codec.c- Extension
.c- Size
- 35668 bytes
- Lines
- 976
- 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/device.hlinux/delay.hlinux/init.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/util_macros.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hrk3308_codec.h
Detected Declarations
struct rk3308_codec_privfunction rk3308_codec_pop_sound_setfunction rk3308_codec_set_dai_fmtfunction rk3308_codec_dac_dig_configfunction rk3308_codec_adc_dig_configfunction rk3308_codec_hw_paramsfunction rk3308_codec_resetfunction rk3308_codec_initializefunction dBfunction rk3308_codec_probefunction rk3308_codec_set_bias_levelfunction rk3308_codec_get_versionfunction rk3308_codec_set_micbias_levelfunction rk3308_codec_platform_probe
Annotated Snippet
struct rk3308_codec_priv {
const struct device *dev;
struct regmap *regmap;
struct regmap *grf;
struct reset_control *reset;
struct clk *hclk;
struct clk *mclk_rx;
struct clk *mclk_tx;
struct snd_soc_component *component;
unsigned char codec_ver;
};
static struct clk_bulk_data rk3308_codec_clocks[] = {
{ .id = "hclk" },
{ .id = "mclk_rx" },
{ .id = "mclk_tx" },
};
static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv, -1800, 150, 0);
static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, -3900, 150, 0);
static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_RANGE(rk3308_codec_dac_lineout_gain_tlv,
0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(-300, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(-150, 0, 0),
3, 3, TLV_DB_SCALE_ITEM(0, 0, 0),
);
static const char * const rk3308_codec_hpf_cutoff_text[] = {
"20 Hz", "245 Hz", "612 Hz"
};
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum12, RK3308_ADC_DIG_CON04(0), 0,
rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum34, RK3308_ADC_DIG_CON04(1), 0,
rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum56, RK3308_ADC_DIG_CON04(2), 0,
rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum78, RK3308_ADC_DIG_CON04(3), 0,
rk3308_codec_hpf_cutoff_text);
static const struct snd_kcontrol_new rk3308_codec_controls[] = {
/* Despite the register names, these set the gain when AGC is OFF */
SOC_SINGLE_RANGE_TLV("MIC1 Capture Volume",
RK3308_ADC_ANA_CON03(0),
RK3308_ADC_CH1_ALC_GAIN_SFT,
RK3308_ADC_CH1_ALC_GAIN_MIN,
RK3308_ADC_CH1_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC2 Capture Volume",
RK3308_ADC_ANA_CON04(0),
RK3308_ADC_CH2_ALC_GAIN_SFT,
RK3308_ADC_CH2_ALC_GAIN_MIN,
RK3308_ADC_CH2_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC3 Capture Volume",
RK3308_ADC_ANA_CON03(1),
RK3308_ADC_CH1_ALC_GAIN_SFT,
RK3308_ADC_CH1_ALC_GAIN_MIN,
RK3308_ADC_CH1_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC4 Capture Volume",
RK3308_ADC_ANA_CON04(1),
RK3308_ADC_CH2_ALC_GAIN_SFT,
RK3308_ADC_CH2_ALC_GAIN_MIN,
RK3308_ADC_CH2_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC5 Capture Volume",
RK3308_ADC_ANA_CON03(2),
RK3308_ADC_CH1_ALC_GAIN_SFT,
RK3308_ADC_CH1_ALC_GAIN_MIN,
RK3308_ADC_CH1_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC6 Capture Volume",
RK3308_ADC_ANA_CON04(2),
RK3308_ADC_CH2_ALC_GAIN_SFT,
RK3308_ADC_CH2_ALC_GAIN_MIN,
RK3308_ADC_CH2_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC7 Capture Volume",
RK3308_ADC_ANA_CON03(3),
RK3308_ADC_CH1_ALC_GAIN_SFT,
RK3308_ADC_CH1_ALC_GAIN_MIN,
RK3308_ADC_CH1_ALC_GAIN_MAX,
0, rk3308_codec_adc_alc_gain_tlv),
SOC_SINGLE_RANGE_TLV("MIC8 Capture Volume",
RK3308_ADC_ANA_CON04(3),
RK3308_ADC_CH2_ALC_GAIN_SFT,
RK3308_ADC_CH2_ALC_GAIN_MIN,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/delay.h`, `linux/init.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct rk3308_codec_priv`, `function rk3308_codec_pop_sound_set`, `function rk3308_codec_set_dai_fmt`, `function rk3308_codec_dac_dig_config`, `function rk3308_codec_adc_dig_config`, `function rk3308_codec_hw_params`, `function rk3308_codec_reset`, `function rk3308_codec_initialize`, `function dB`, `function rk3308_codec_probe`.
- 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.