sound/soc/codecs/rt5660.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt5660.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt5660.c- Extension
.c- Size
- 38780 bytes
- Lines
- 1351
- 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/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/regmap.hlinux/of.hlinux/platform_device.hlinux/spi/spi.hlinux/acpi.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hrl6231.hrt5660.h
Detected Declarations
function rt5660_volatile_registerfunction rt5660_readable_registerfunction rt5660_set_dmic_clkfunction rt5660_is_sys_clk_from_pllfunction rt5660_lout_eventfunction rt5660_hw_paramsfunction rt5660_set_dai_fmtfunction rt5660_set_dai_sysclkfunction rt5660_set_dai_pllfunction rt5660_set_bias_levelfunction rt5660_probefunction rt5660_removefunction rt5660_suspendfunction rt5660_resumefunction rt5660_parse_dtfunction rt5660_i2c_probe
Annotated Snippet
if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) {
clk_disable_unprepare(rt5660->mclk);
} else {
ret = clk_prepare_enable(rt5660->mclk);
if (ret)
return ret;
}
break;
case SND_SOC_BIAS_STANDBY:
if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
snd_soc_component_update_bits(component, RT5660_PWR_ANLG1,
RT5660_PWR_VREF1 | RT5660_PWR_MB |
RT5660_PWR_BG | RT5660_PWR_VREF2,
RT5660_PWR_VREF1 | RT5660_PWR_MB |
RT5660_PWR_BG | RT5660_PWR_VREF2);
usleep_range(10000, 15000);
snd_soc_component_update_bits(component, RT5660_PWR_ANLG1,
RT5660_PWR_FV1 | RT5660_PWR_FV2,
RT5660_PWR_FV1 | RT5660_PWR_FV2);
}
break;
case SND_SOC_BIAS_OFF:
snd_soc_component_update_bits(component, RT5660_GEN_CTRL1,
RT5660_DIG_GATE_CTRL, 0);
break;
default:
break;
}
return 0;
}
static int rt5660_probe(struct snd_soc_component *component)
{
struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component);
rt5660->component = component;
return 0;
}
static void rt5660_remove(struct snd_soc_component *component)
{
snd_soc_component_write(component, RT5660_RESET, 0);
}
#ifdef CONFIG_PM
static int rt5660_suspend(struct snd_soc_component *component)
{
struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component);
regcache_cache_only(rt5660->regmap, true);
regcache_mark_dirty(rt5660->regmap);
return 0;
}
static int rt5660_resume(struct snd_soc_component *component)
{
struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component);
if (rt5660->pdata.poweroff_codec_in_suspend)
msleep(350);
regcache_cache_only(rt5660->regmap, false);
regcache_sync(rt5660->regmap);
return 0;
}
#else
#define rt5660_suspend NULL
#define rt5660_resume NULL
#endif
#define RT5660_STEREO_RATES SNDRV_PCM_RATE_8000_192000
#define RT5660_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8)
static const struct snd_soc_dai_ops rt5660_aif_dai_ops = {
.hw_params = rt5660_hw_params,
.set_fmt = rt5660_set_dai_fmt,
.set_sysclk = rt5660_set_dai_sysclk,
.set_pll = rt5660_set_dai_pll,
};
static struct snd_soc_dai_driver rt5660_dai[] = {
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/of.h`.
- Detected declarations: `function rt5660_volatile_register`, `function rt5660_readable_register`, `function rt5660_set_dmic_clk`, `function rt5660_is_sys_clk_from_pll`, `function rt5660_lout_event`, `function rt5660_hw_params`, `function rt5660_set_dai_fmt`, `function rt5660_set_dai_sysclk`, `function rt5660_set_dai_pll`, `function rt5660_set_bias_level`.
- 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.