sound/soc/codecs/rt1015.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt1015.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt1015.c- Extension
.c- Size
- 30273 bytes
- Lines
- 1191
- 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/delay.hlinux/firmware.hlinux/fs.hlinux/i2c.hlinux/init.hlinux/module.hlinux/moduleparam.hlinux/platform_device.hlinux/pm.hlinux/regmap.hsound/core.hsound/initval.hsound/pcm.hsound/pcm_params.hsound/rt1015.hsound/soc-dapm.hsound/soc.hsound/tlv.hrl6231.hrt1015.h
Detected Declarations
function rt1015_volatile_registerfunction rt1015_readable_registerfunction rt1015_boost_mode_getfunction rt1015_boost_mode_putfunction rt1015_bypass_boost_getfunction rt1015_calibratefunction rt1015_bypass_boost_putfunction rt1015_is_sys_clk_from_pllfunction r1015_dac_eventfunction rt1015_amp_drv_eventfunction rt1015_hw_paramsfunction rt1015_set_dai_fmtfunction rt1015_set_component_sysclkfunction rt1015_set_component_pllfunction rt1015_set_tdm_slotfunction rt1015_probefunction rt1015_removefunction rt1015_suspendfunction rt1015_resumefunction rt1015_parse_dtfunction rt1015_i2c_probefunction rt1015_i2c_shutdown
Annotated Snippet
if (rt1015->bypass_boost == RT1015_Enable_Boost) {
snd_soc_component_write(component,
RT1015_SYS_RST1, 0x05f7);
snd_soc_component_write(component,
RT1015_SYS_RST2, 0x0b0a);
snd_soc_component_write(component,
RT1015_GAT_BOOST, 0xacfe);
snd_soc_component_write(component,
RT1015_PWR9, 0xaa00);
snd_soc_component_write(component,
RT1015_GAT_BOOST, 0xecfe);
} else {
snd_soc_component_write(component,
0x032d, 0xaa60);
snd_soc_component_write(component,
RT1015_SYS_RST1, 0x05f7);
snd_soc_component_write(component,
RT1015_SYS_RST2, 0x0b0a);
snd_soc_component_write(component,
RT1015_PWR_STATE_CTRL, 0x008e);
}
break;
case SND_SOC_DAPM_POST_PMD:
if (rt1015->bypass_boost == RT1015_Enable_Boost) {
snd_soc_component_write(component,
RT1015_PWR9, 0xa800);
snd_soc_component_write(component,
RT1015_SYS_RST1, 0x05f5);
snd_soc_component_write(component,
RT1015_SYS_RST2, 0x0b9a);
} else {
snd_soc_component_write(component,
0x032d, 0xaa60);
snd_soc_component_write(component,
RT1015_PWR_STATE_CTRL, 0x0088);
snd_soc_component_write(component,
RT1015_SYS_RST1, 0x05f5);
snd_soc_component_write(component,
RT1015_SYS_RST2, 0x0b9a);
}
rt1015->dac_is_used = 0;
break;
default:
break;
}
return 0;
}
static int rt1015_amp_drv_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);
struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
unsigned int ret, ret2;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
ret = snd_soc_component_read(component, RT1015_CLK_DET);
ret2 = snd_soc_component_read(component, RT1015_SPK_DC_DETECT1);
if (!((ret >> 15) & 0x1)) {
snd_soc_component_update_bits(component, RT1015_CLK_DET,
RT1015_EN_BCLK_DET_MASK, RT1015_EN_BCLK_DET);
dev_dbg(component->dev, "BCLK Detection Enabled.\n");
}
if (!((ret2 >> 12) & 0x1)) {
snd_soc_component_update_bits(component, RT1015_SPK_DC_DETECT1,
RT1015_EN_CLA_D_DC_DET_MASK, RT1015_EN_CLA_D_DC_DET);
dev_dbg(component->dev, "Class-D DC Detection Enabled.\n");
}
break;
case SND_SOC_DAPM_POST_PMU:
msleep(rt1015->pdata.power_up_delay_ms);
break;
default:
break;
}
return 0;
}
static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("PLL", RT1015_PWR1, RT1015_PWR_PLL_BIT, 0,
NULL, 0),
SND_SOC_DAPM_AIF_IN("AIFRX", "AIF Playback", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_DAC_E("DAC", NULL, SND_SOC_NOPM, 0, 0,
r1015_dac_event, SND_SOC_DAPM_PRE_PMU |
SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_OUT_DRV_E("Amp Drv", SND_SOC_NOPM, 0, 0, NULL, 0,
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/delay.h`, `linux/firmware.h`, `linux/fs.h`, `linux/i2c.h`, `linux/init.h`, `linux/module.h`, `linux/moduleparam.h`.
- Detected declarations: `function rt1015_volatile_register`, `function rt1015_readable_register`, `function rt1015_boost_mode_get`, `function rt1015_boost_mode_put`, `function rt1015_bypass_boost_get`, `function rt1015_calibrate`, `function rt1015_bypass_boost_put`, `function rt1015_is_sys_clk_from_pll`, `function r1015_dac_event`, `function rt1015_amp_drv_event`.
- 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.