sound/soc/codecs/max98373-sdw.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/max98373-sdw.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/max98373-sdw.c- Extension
.c- Size
- 25723 bytes
- Lines
- 877
- 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/module.hlinux/mod_devicetable.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hsound/pcm.hsound/pcm_params.hsound/sdw.hsound/soc.hsound/tlv.hlinux/of.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hlinux/soundwire/sdw_registers.hmax98373.hmax98373-sdw.h
Detected Declarations
function max98373_readable_registerfunction max98373_volatile_regfunction max98373_suspendfunction max98373_resumefunction max98373_read_propfunction max98373_io_initfunction max98373_clock_calculatefunction max98373_clock_configfunction max98373_sdw_dai_hw_paramsfunction max98373_pcm_hw_freefunction max98373_set_sdw_streamfunction max98373_shutdownfunction max98373_sdw_set_tdm_slotfunction max98373_initfunction max98373_update_statusfunction max98373_bus_configfunction max98373_sdw_probefunction max98373_sdw_remove
Annotated Snippet
if (max98373->slot) {
stream_config.ch_count = max98373->slot;
port_config.ch_mask = max98373->rx_mask;
}
} else {
port_config.num = 3;
/* only IV are supported by capture */
stream_config.ch_count = 2;
port_config.ch_mask = GENMASK((int)stream_config.ch_count - 1, 0);
}
ret = sdw_stream_add_slave(max98373->slave, &stream_config,
&port_config, 1, sdw_stream);
if (ret) {
dev_err(dai->dev, "Unable to configure port\n");
return ret;
}
if (params_channels(params) > 16) {
dev_err(component->dev, "Unsupported channels %d\n",
params_channels(params));
return -EINVAL;
}
/* Channel size configuration */
switch (snd_pcm_format_width(params_format(params))) {
case 16:
chan_sz = MAX98373_PCM_MODE_CFG_CHANSZ_16;
break;
case 24:
chan_sz = MAX98373_PCM_MODE_CFG_CHANSZ_24;
break;
case 32:
chan_sz = MAX98373_PCM_MODE_CFG_CHANSZ_32;
break;
default:
dev_err(component->dev, "Channel size unsupported %d\n",
params_format(params));
return -EINVAL;
}
max98373->ch_size = snd_pcm_format_width(params_format(params));
regmap_update_bits(max98373->regmap,
MAX98373_R2024_PCM_DATA_FMT_CFG,
MAX98373_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 = MAX98373_PCM_SR_SET1_SR_8000;
break;
case 11025:
sampling_rate = MAX98373_PCM_SR_SET1_SR_11025;
break;
case 12000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_12000;
break;
case 16000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_16000;
break;
case 22050:
sampling_rate = MAX98373_PCM_SR_SET1_SR_22050;
break;
case 24000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_24000;
break;
case 32000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_32000;
break;
case 44100:
sampling_rate = MAX98373_PCM_SR_SET1_SR_44100;
break;
case 48000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_48000;
break;
case 88200:
sampling_rate = MAX98373_PCM_SR_SET1_SR_88200;
break;
case 96000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_96000;
break;
default:
dev_err(component->dev, "Rate %d is not supported\n",
params_rate(params));
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/delay.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/slab.h`, `sound/pcm.h`.
- Detected declarations: `function max98373_readable_register`, `function max98373_volatile_reg`, `function max98373_suspend`, `function max98373_resume`, `function max98373_read_prop`, `function max98373_io_init`, `function max98373_clock_calculate`, `function max98373_clock_config`, `function max98373_sdw_dai_hw_params`, `function max98373_pcm_hw_free`.
- 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.