sound/soc/codecs/rt5645.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt5645.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt5645.c- Extension
.c- Size
- 132933 bytes
- Lines
- 4368
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/platform_device.hlinux/spi/spi.hlinux/gpio/consumer.hlinux/acpi.hlinux/dmi.hlinux/regulator/consumer.hsound/core.hsound/pcm.hsound/pcm_params.hsound/jack.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hrl6231.hrt5645.h
Detected Declarations
struct rt5645_eq_param_sstruct rt5645_eq_param_s_be16struct rt5645_platform_datastruct rt5645_privfunction rt5645_resetfunction rt5645_volatile_registerfunction rt5645_readable_registerfunction rt5645_hweq_infofunction rt5645_hweq_getfunction rt5645_validate_hweqfunction rt5645_hweq_putfunction rt5645_spk_put_volswfunction set_dmic_clkfunction is_sys_clk_from_pllfunction is_using_asrcfunction rt5645_enable_hweqfunction rt5645_sel_asrc_clk_srcfunction hp_amp_powerfunction rt5645_hp_eventfunction rt5645_spk_eventfunction rt5645_lout_eventfunction rt5645_bst2_eventfunction rt5645_set_micbias1_eventfunction rt5645_set_micbias2_eventfunction rt5645_hw_paramsfunction rt5645_set_dai_fmtfunction rt5645_set_dai_sysclkfunction rt5645_set_dai_pllfunction rt5645_set_tdm_slotfunction rt5645_set_bias_levelfunction rt5645_enable_push_button_irqfunction rt5645_jack_detectfunction rt5645_button_detectfunction rt5645_set_jack_detectfunction rt5645_component_set_jackfunction rt5645_jack_detect_workfunction rt5645_rcclock_workfunction rt5645_irqfunction rt5645_btn_check_callbackfunction rt5645_probefunction rt5645_removefunction rt5645_suspendfunction rt5645_resumefunction cht_rt5645_ef20_quirk_cbfunction rt5645_check_dpfunction rt5645_parse_dtfunction rt5645_get_pdatafunction rt5645_i2c_probe
Annotated Snippet
struct rt5645_eq_param_s {
unsigned short reg;
unsigned short val;
};
struct rt5645_eq_param_s_be16 {
__be16 reg;
__be16 val;
};
static const char *const rt5645_supply_names[] = {
"avdd",
"cpvdd",
};
struct rt5645_platform_data {
/* IN2 can optionally be differential */
bool in2_diff;
unsigned int dmic1_data_pin;
/* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
unsigned int dmic2_data_pin;
/* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
unsigned int jd_mode;
/* Use level triggered irq */
bool level_trigger_irq;
/* Invert JD1_1 status polarity */
bool inv_jd1_1;
/* Invert HP detect status polarity */
bool inv_hp_pol;
/* Only 1 speaker connected */
bool mono_speaker;
/* Value to assign to snd_soc_card.long_name */
const char *long_name;
/* Some (package) variants have the headset-mic pin not-connected */
bool no_headset_mic;
};
struct rt5645_priv {
struct snd_soc_component *component;
struct rt5645_platform_data pdata;
struct regmap *regmap;
struct i2c_client *i2c;
struct gpio_desc *gpiod_hp_det;
struct gpio_desc *gpiod_cbj_sleeve;
struct snd_soc_jack *hp_jack;
struct snd_soc_jack *mic_jack;
struct snd_soc_jack *btn_jack;
struct delayed_work jack_detect_work, rcclock_work;
struct regulator_bulk_data supplies[ARRAY_SIZE(rt5645_supply_names)];
struct rt5645_eq_param_s *eq_param;
struct timer_list btn_check_timer;
struct mutex jd_mutex;
int codec_type;
int sysclk;
int sysclk_src;
int lrck[RT5645_AIFS];
int bclk[RT5645_AIFS];
int master[RT5645_AIFS];
int pll_src;
int pll_in;
int pll_out;
int jack_type;
bool en_button_func;
int v_id;
};
static int rt5645_reset(struct snd_soc_component *component)
{
return snd_soc_component_write(component, RT5645_RESET, 0);
}
static bool rt5645_volatile_register(struct device *dev, unsigned int reg)
{
int i;
for (i = 0; i < ARRAY_SIZE(rt5645_ranges); i++) {
if (reg >= rt5645_ranges[i].range_min &&
reg <= rt5645_ranges[i].range_max) {
return true;
}
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/platform_device.h`, `linux/spi/spi.h`.
- Detected declarations: `struct rt5645_eq_param_s`, `struct rt5645_eq_param_s_be16`, `struct rt5645_platform_data`, `struct rt5645_priv`, `function rt5645_reset`, `function rt5645_volatile_register`, `function rt5645_readable_register`, `function rt5645_hweq_info`, `function rt5645_hweq_get`, `function rt5645_validate_hweq`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.