sound/soc/codecs/rt1011.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt1011.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt1011.c- Extension
.c- Size
- 66698 bytes
- Lines
- 2487
- 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/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/acpi.hlinux/regmap.hlinux/platform_device.hlinux/firmware.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hrl6231.hrt1011.h
Detected Declarations
function rt1011_reg_initfunction rt1011_volatile_registerfunction rt1011_readable_registerfunction rt1011_resetfunction rt1011_recv_spk_mode_getfunction rt1011_recv_spk_mode_putfunction rt1011_validate_bq_drc_coefffunction rt1011_bq_drc_coeff_getfunction rt1011_bq_drc_coeff_putfunction rt1011_bq_drc_infofunction rt1011_r0_cali_getfunction rt1011_r0_cali_putfunction rt1011_r0_loadfunction rt1011_r0_load_mode_getfunction rt1011_r0_load_mode_putfunction rt1011_r0_load_infofunction rt1011_i2s_ref_putfunction rt1011_i2s_ref_getfunction rt1011_is_sys_clk_from_pllfunction rt1011_dac_eventfunction rt1011_get_clk_infofunction rt1011_hw_paramsfunction rt1011_set_dai_fmtfunction rt1011_set_component_sysclkfunction rt1011_set_component_pllfunction rt1011_set_tdm_slotfunction rt1011_probefunction rt1011_removefunction rt1011_suspendfunction rt1011_resumefunction rt1011_set_bias_levelfunction rt1011_calibratefunction rt1011_calibration_workfunction rt1011_parse_dpfunction rt1011_i2c_probefunction rt1011_i2c_shutdown
Annotated Snippet
if (rt1011->recv_spk_mode) {
/* 1: recevier mode on */
snd_soc_component_update_bits(component,
RT1011_CLASSD_INTERNAL_SET_3,
RT1011_REG_GAIN_CLASSD_RI_SPK_MASK,
RT1011_REG_GAIN_CLASSD_RI_410K);
snd_soc_component_update_bits(component,
RT1011_CLASSD_INTERNAL_SET_1,
RT1011_RECV_MODE_SPK_MASK,
RT1011_RECV_MODE);
} else {
/* 0: speaker mode on */
snd_soc_component_update_bits(component,
RT1011_CLASSD_INTERNAL_SET_3,
RT1011_REG_GAIN_CLASSD_RI_SPK_MASK,
RT1011_REG_GAIN_CLASSD_RI_72P5K);
snd_soc_component_update_bits(component,
RT1011_CLASSD_INTERNAL_SET_1,
RT1011_RECV_MODE_SPK_MASK,
RT1011_SPK_MODE);
}
}
return 0;
}
static bool rt1011_validate_bq_drc_coeff(unsigned short reg)
{
if ((reg == RT1011_DAC_SET_1) ||
(reg >= RT1011_ADC_SET && reg <= RT1011_ADC_SET_1) ||
(reg == RT1011_ADC_SET_4) || (reg == RT1011_ADC_SET_5) ||
(reg == RT1011_MIXER_1) ||
(reg == RT1011_A_TIMING_1) ||
(reg >= RT1011_POWER_7 && reg <= RT1011_POWER_8) ||
(reg == RT1011_CLASS_D_POS) || (reg == RT1011_ANALOG_CTRL) ||
(reg >= RT1011_SPK_TEMP_PROTECT_0 && reg <= RT1011_SPK_TEMP_PROTECT_6) ||
(reg >= RT1011_SPK_PRO_DC_DET_5 && reg <= RT1011_BAT_GAIN_1) ||
(reg >= RT1011_RT_DRC_CROSS && reg <= RT1011_RT_DRC_POS_8) ||
(reg >= RT1011_CROSS_BQ_SET_1 && reg <= RT1011_BQ_10_A2_15_0) ||
(reg >= RT1011_SMART_BOOST_TIMING_1 && reg <= RT1011_SMART_BOOST_TIMING_36) ||
(reg == RT1011_SINE_GEN_REG_1) ||
(reg >= RT1011_STP_ALPHA_RECIPROCAL_MSB && reg <= RT1011_BQ_6_PARAMS_CHECK_5) ||
(reg >= RT1011_BQ_7_PARAMS_CHECK_1 && reg <= RT1011_BQ_10_PARAMS_CHECK_5))
return true;
return false;
}
static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct rt1011_priv *rt1011 =
snd_soc_component_get_drvdata(component);
struct rt1011_bq_drc_params *bq_drc_info;
struct rt1011_bq_drc_params *params =
(struct rt1011_bq_drc_params *)ucontrol->value.integer.value;
unsigned int i, mode_idx = 0;
if (strstr(ucontrol->id.name, "AdvanceMode Initial Set"))
mode_idx = RT1011_ADVMODE_INITIAL_SET;
else if (strstr(ucontrol->id.name, "AdvanceMode SEP BQ Coeff"))
mode_idx = RT1011_ADVMODE_SEP_BQ_COEFF;
else if (strstr(ucontrol->id.name, "AdvanceMode EQ BQ Coeff"))
mode_idx = RT1011_ADVMODE_EQ_BQ_COEFF;
else if (strstr(ucontrol->id.name, "AdvanceMode BQ UI Coeff"))
mode_idx = RT1011_ADVMODE_BQ_UI_COEFF;
else if (strstr(ucontrol->id.name, "AdvanceMode SmartBoost Coeff"))
mode_idx = RT1011_ADVMODE_SMARTBOOST_COEFF;
else
return -EINVAL;
pr_info("%s, id.name=%s, mode_idx=%d\n", __func__,
ucontrol->id.name, mode_idx);
bq_drc_info = rt1011->bq_drc_params[mode_idx];
for (i = 0; i < RT1011_BQ_DRC_NUM; i++) {
params[i].reg = bq_drc_info[i].reg;
params[i].val = bq_drc_info[i].val;
}
return 0;
}
static int rt1011_bq_drc_coeff_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct rt1011_priv *rt1011 =
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/acpi.h`, `linux/regmap.h`.
- Detected declarations: `function rt1011_reg_init`, `function rt1011_volatile_register`, `function rt1011_readable_register`, `function rt1011_reset`, `function rt1011_recv_spk_mode_get`, `function rt1011_recv_spk_mode_put`, `function rt1011_validate_bq_drc_coeff`, `function rt1011_bq_drc_coeff_get`, `function rt1011_bq_drc_coeff_put`, `function rt1011_bq_drc_info`.
- 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.