sound/soc/codecs/adau17x1.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/adau17x1.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/adau17x1.c- Extension
.c- Size
- 29246 bytes
- Lines
- 1124
- 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.
- 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/init.hlinux/clk.hlinux/delay.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hlinux/i2c.hlinux/spi/spi.hlinux/regmap.hlinux/unaligned.hsigmadsp.hadau17x1.hadau-utils.h
Detected Declarations
function adau17x1_pll_eventfunction adau17x1_adc_fixupfunction snd_soc_dai_set_tdm_slotfunction adau17x1_dsp_mux_enum_getfunction adau17x1_has_dspfunction adau17x1_has_disused_dspfunction adau17x1_has_safeloadfunction adau17x1_set_dai_pllfunction adau17x1_set_dai_sysclkfunction adau17x1_auto_pllfunction adau17x1_hw_paramsfunction adau17x1_set_dai_fmtfunction adau17x1_set_dai_tdm_slotfunction adau17x1_startupfunction adau17x1_set_micbias_voltagefunction adau17x1_precious_registerfunction adau17x1_readable_registerfunction adau17x1_volatile_registerfunction adau17x1_setup_firmwarefunction adau17x1_add_widgetsfunction adau17x1_add_routesfunction adau17x1_resumefunction adau17x1_safeloadfunction adau17x1_probefunction adau17x1_removeexport adau17x1_dai_opsexport adau17x1_set_micbias_voltageexport adau17x1_precious_registerexport adau17x1_readable_registerexport adau17x1_volatile_registerexport adau17x1_add_widgetsexport adau17x1_add_routesexport adau17x1_resumeexport adau17x1_probeexport adau17x1_remove
Annotated Snippet
if (is_pll) {
snd_soc_dapm_add_routes(dapm,
&adau17x1_dapm_pll_route, 1);
} else {
snd_soc_dapm_del_routes(dapm,
&adau17x1_dapm_pll_route, 1);
}
}
adau->clk_src = clk_id;
return 0;
}
static int adau17x1_auto_pll(struct snd_soc_dai *dai,
struct snd_pcm_hw_params *params)
{
struct adau *adau = snd_soc_dai_get_drvdata(dai);
unsigned int pll_rate;
switch (params_rate(params)) {
case 48000:
case 8000:
case 12000:
case 16000:
case 24000:
case 32000:
case 96000:
pll_rate = 48000 * 1024;
break;
case 44100:
case 7350:
case 11025:
case 14700:
case 22050:
case 29400:
case 88200:
pll_rate = 44100 * 1024;
break;
default:
return -EINVAL;
}
return adau17x1_set_dai_pll(dai, ADAU17X1_PLL, ADAU17X1_PLL_SRC_MCLK,
clk_get_rate(adau->mclk), pll_rate);
}
static int adau17x1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{
struct snd_soc_component *component = dai->component;
struct adau *adau = snd_soc_component_get_drvdata(component);
unsigned int val, div, dsp_div;
unsigned int freq;
int ret;
switch (adau->clk_src) {
case ADAU17X1_CLK_SRC_PLL_AUTO:
ret = adau17x1_auto_pll(dai, params);
if (ret)
return ret;
fallthrough;
case ADAU17X1_CLK_SRC_PLL:
freq = adau->pll_freq;
break;
default:
freq = adau->sysclk;
break;
}
if (freq % params_rate(params) != 0)
return -EINVAL;
switch (freq / params_rate(params)) {
case 1024: /* fs */
div = 0;
dsp_div = 1;
break;
case 6144: /* fs / 6 */
div = 1;
dsp_div = 6;
break;
case 4096: /* fs / 4 */
div = 2;
dsp_div = 5;
break;
case 3072: /* fs / 3 */
div = 3;
dsp_div = 4;
break;
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/clk.h`, `linux/delay.h`, `linux/slab.h`, `sound/core.h`, `sound/pcm.h`, `sound/pcm_params.h`.
- Detected declarations: `function adau17x1_pll_event`, `function adau17x1_adc_fixup`, `function snd_soc_dai_set_tdm_slot`, `function adau17x1_dsp_mux_enum_get`, `function adau17x1_has_dsp`, `function adau17x1_has_disused_dsp`, `function adau17x1_has_safeload`, `function adau17x1_set_dai_pll`, `function adau17x1_set_dai_sysclk`, `function adau17x1_auto_pll`.
- 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.
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.