sound/soc/codecs/tas2552.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas2552.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas2552.c- Extension
.c- Size
- 21109 bytes
- Lines
- 777
- 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/module.hlinux/errno.hlinux/device.hlinux/i2c.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hlinux/gpio/consumer.hlinux/regulator/consumer.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/tlv.hsound/tas2552-plat.hdt-bindings/sound/tas2552.htas2552.h
Detected Declarations
struct tas2552_datafunction tas2552_post_eventfunction tas2552_sw_shutdownfunction tas2552_setup_pllfunction tas2552_hw_paramsfunction tas2552_preparefunction tas2552_set_dai_fmtfunction tas2552_set_dai_sysclkfunction tas2552_set_dai_tdm_slotfunction tas2552_mutefunction tas2552_runtime_suspendfunction tas2552_runtime_resumefunction tas2552_component_probefunction tas2552_component_removefunction tas2552_suspendfunction tas2552_resumefunction tas2552_probefunction tas2552_i2c_remove
Annotated Snippet
struct tas2552_data {
struct snd_soc_component *component;
struct regmap *regmap;
struct i2c_client *tas2552_client;
struct regulator_bulk_data supplies[TAS2552_NUM_SUPPLIES];
struct gpio_desc *enable_gpio;
unsigned char regs[TAS2552_VBAT_DATA];
unsigned int pll_clkin;
int pll_clk_id;
unsigned int pdm_clk;
int pdm_clk_id;
unsigned int dai_fmt;
unsigned int tdm_delay;
};
static int tas2552_post_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
snd_soc_component_write(component, TAS2552_RESERVED_0D, 0xc0);
snd_soc_component_update_bits(component, TAS2552_LIMIT_RATE_HYS, (1 << 5),
(1 << 5));
snd_soc_component_update_bits(component, TAS2552_CFG_2, 1, 0);
snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_SWS, 0);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_SWS,
TAS2552_SWS);
snd_soc_component_update_bits(component, TAS2552_CFG_2, 1, 1);
snd_soc_component_update_bits(component, TAS2552_LIMIT_RATE_HYS, (1 << 5), 0);
snd_soc_component_write(component, TAS2552_RESERVED_0D, 0xbe);
break;
}
return 0;
}
/* Input mux controls */
static const char * const tas2552_input_texts[] = {
"Digital", "Analog" };
static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
tas2552_input_texts);
static const struct snd_kcontrol_new tas2552_input_mux_control =
SOC_DAPM_ENUM("Route", tas2552_input_mux_enum);
static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
{
SND_SOC_DAPM_INPUT("IN"),
/* MUX Controls */
SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
&tas2552_input_mux_control),
SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("ASI OUT", "DAC Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
SND_SOC_DAPM_POST("Post Event", tas2552_post_event),
SND_SOC_DAPM_OUTPUT("OUT"),
SND_SOC_DAPM_INPUT("DMIC")
};
static const struct snd_soc_dapm_route tas2552_audio_map[] = {
{"DAC", NULL, "DAC IN"},
{"Input selection", "Digital", "DAC"},
{"Input selection", "Analog", "IN"},
{"ClassD", NULL, "Input selection"},
{"OUT", NULL, "ClassD"},
{"ClassD", NULL, "PLL"},
{"ASI OUT", NULL, "DMIC"}
};
static void tas2552_sw_shutdown(struct tas2552_data *tas2552, int sw_shutdown)
{
u8 cfg1_reg = 0;
if (!tas2552->component)
return;
if (sw_shutdown)
cfg1_reg = TAS2552_SWS;
snd_soc_component_update_bits(tas2552->component, TAS2552_CFG_1, TAS2552_SWS,
cfg1_reg);
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/device.h`, `linux/i2c.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/slab.h`, `linux/gpio/consumer.h`.
- Detected declarations: `struct tas2552_data`, `function tas2552_post_event`, `function tas2552_sw_shutdown`, `function tas2552_setup_pll`, `function tas2552_hw_params`, `function tas2552_prepare`, `function tas2552_set_dai_fmt`, `function tas2552_set_dai_sysclk`, `function tas2552_set_dai_tdm_slot`, `function tas2552_mute`.
- 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.