sound/soc/codecs/max98520.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/max98520.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/max98520.c- Extension
.c- Size
- 24664 bytes
- Lines
- 767
- 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/acpi.hlinux/delay.hlinux/i2c.hlinux/module.hlinux/regmap.hlinux/slab.hlinux/cdev.hsound/pcm.hsound/pcm_params.hsound/soc.hlinux/gpio/consumer.hlinux/of.hsound/tlv.hmax98520.h
Detected Declarations
function max98520_dai_set_fmtfunction max98520_get_bclk_selfunction max98520_set_clockfunction max98520_dai_hw_paramsfunction max98520_dai_tdm_slotfunction max98520_dac_eventfunction max98520_readable_registerfunction max98520_volatile_regfunction max98520_probefunction max98520_suspendfunction max98520_resumefunction max98520_power_onfunction max98520_i2c_probe
Annotated Snippet
if (!value) {
dev_err(component->dev, "format unsupported %d\n",
params_format(params));
return -EINVAL;
}
regmap_update_bits(max98520->regmap,
MAX98520_R2041_PCM_CLK_SETUP,
MAX98520_PCM_CLK_SETUP_BSEL_MASK,
value);
}
dev_dbg(component->dev, "%s tdm_mode:%d out\n", __func__, max98520->tdm_mode);
return 0;
}
static int max98520_dai_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 max98520_priv *max98520 =
snd_soc_component_get_drvdata(component);
unsigned int sampling_rate = 0;
unsigned int chan_sz = 0;
/* pcm mode configuration */
switch (snd_pcm_format_width(params_format(params))) {
case 16:
chan_sz = MAX98520_PCM_MODE_CFG_CHANSZ_16;
break;
case 24:
chan_sz = MAX98520_PCM_MODE_CFG_CHANSZ_24;
break;
case 32:
chan_sz = MAX98520_PCM_MODE_CFG_CHANSZ_32;
break;
default:
dev_err(component->dev, "format unsupported %d\n",
params_format(params));
goto err;
}
max98520->ch_size = snd_pcm_format_width(params_format(params));
regmap_update_bits(max98520->regmap,
MAX98520_R2040_PCM_MODE_CFG,
MAX98520_PCM_MODE_CFG_CHANSZ_MASK, chan_sz);
dev_dbg(component->dev, "format supported %d",
params_format(params));
/* sampling rate configuration */
switch (params_rate(params)) {
case 8000:
sampling_rate = MAX98520_PCM_SR_8000;
break;
case 11025:
sampling_rate = MAX98520_PCM_SR_11025;
break;
case 12000:
sampling_rate = MAX98520_PCM_SR_12000;
break;
case 16000:
sampling_rate = MAX98520_PCM_SR_16000;
break;
case 22050:
sampling_rate = MAX98520_PCM_SR_22050;
break;
case 24000:
sampling_rate = MAX98520_PCM_SR_24000;
break;
case 32000:
sampling_rate = MAX98520_PCM_SR_32000;
break;
case 44100:
sampling_rate = MAX98520_PCM_SR_44100;
break;
case 48000:
sampling_rate = MAX98520_PCM_SR_48000;
break;
case 88200:
sampling_rate = MAX98520_PCM_SR_88200;
break;
case 96000:
sampling_rate = MAX98520_PCM_SR_96000;
break;
case 176400:
sampling_rate = MAX98520_PCM_SR_176400;
break;
case 192000:
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/delay.h`, `linux/i2c.h`, `linux/module.h`, `linux/regmap.h`, `linux/slab.h`, `linux/cdev.h`, `sound/pcm.h`.
- Detected declarations: `function max98520_dai_set_fmt`, `function max98520_get_bclk_sel`, `function max98520_set_clock`, `function max98520_dai_hw_params`, `function max98520_dai_tdm_slot`, `function max98520_dac_event`, `function max98520_readable_register`, `function max98520_volatile_reg`, `function max98520_probe`, `function max98520_suspend`.
- 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.