sound/soc/codecs/max98090.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/max98090.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/max98090.c- Extension
.c- Size
- 87488 bytes
- Lines
- 2724
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/i2c.hlinux/module.hlinux/of.hlinux/pm.hlinux/regmap.hlinux/slab.hlinux/acpi.hlinux/clk.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hsound/max98090.hmax98090.h
Detected Declarations
struct dmic_tablefunction max98090_volatile_registerfunction max98090_readable_registerfunction max98090_resetfunction max98090_get_enab_tlvfunction max98090_put_enab_tlvfunction max98090_micinput_eventfunction max98090_shdn_eventfunction max98090_add_widgetsfunction max98090_configure_bclkfunction max98090_dai_set_fmtfunction max98090_set_tdm_slotfunction max98090_set_bias_levelfunction max98090_find_divisorfunction max98090_find_closest_pclkfunction max98090_configure_dmicfunction max98090_dai_startupfunction max98090_dai_hw_paramsfunction max98090_dai_set_sysclkfunction max98090_dai_mutefunction max98090_dai_triggerfunction max98090_pll_det_enable_workfunction max98090_pll_det_disable_workfunction max98090_pll_workfunction max98090_jack_workfunction max98090_interruptfunction snd_soc_jack_add_gpiosfunction max98090_probefunction max98090_removefunction max98090_seq_notifierfunction max98090_i2c_probefunction max98090_i2c_shutdownfunction max98090_i2c_removefunction max98090_runtime_resumefunction max98090_runtime_suspendfunction max98090_resume
Annotated Snippet
struct dmic_table {
int pclk;
struct {
int freq;
int comp[6]; /* One each for 8, 16, 32, 44.1, 48, and 96 kHz */
} settings[6]; /* One for each dmic divisor. */
};
static const struct dmic_table dmic_table[] = { /* One for each pclk freq. */
{
.pclk = 11289600,
.settings = {
{ .freq = 2, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 1, .comp = { 7, 8, 2, 2, 2, 2 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 6, 6, 6, 6 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
},
},
{
.pclk = 12000000,
.settings = {
{ .freq = 2, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 1, .comp = { 7, 8, 2, 2, 2, 2 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 5, 5, 6, 6 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
}
},
{
.pclk = 12288000,
.settings = {
{ .freq = 2, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 1, .comp = { 7, 8, 2, 2, 2, 2 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 6, 6, 6, 6 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 3, 3, 3, 3 } },
}
},
{
.pclk = 13000000,
.settings = {
{ .freq = 2, .comp = { 7, 8, 1, 1, 1, 1 } },
{ .freq = 1, .comp = { 7, 8, 0, 0, 0, 0 } },
{ .freq = 0, .comp = { 7, 8, 1, 1, 1, 1 } },
{ .freq = 0, .comp = { 7, 8, 4, 4, 5, 5 } },
{ .freq = 0, .comp = { 7, 8, 1, 1, 1, 1 } },
{ .freq = 0, .comp = { 7, 8, 1, 1, 1, 1 } },
}
},
{
.pclk = 19200000,
.settings = {
{ .freq = 2, .comp = { 0, 0, 0, 0, 0, 0 } },
{ .freq = 1, .comp = { 7, 8, 1, 1, 1, 1 } },
{ .freq = 0, .comp = { 7, 8, 5, 5, 6, 6 } },
{ .freq = 0, .comp = { 7, 8, 2, 2, 3, 3 } },
{ .freq = 0, .comp = { 7, 8, 1, 1, 2, 2 } },
{ .freq = 0, .comp = { 7, 8, 5, 5, 6, 6 } },
}
},
};
static int max98090_find_divisor(int target_freq, int pclk)
{
int current_diff = INT_MAX;
int test_diff;
int divisor_index = 0;
int i;
for (i = 0; i < ARRAY_SIZE(dmic_divisors); i++) {
test_diff = abs(target_freq - (pclk / dmic_divisors[i]));
if (test_diff < current_diff) {
current_diff = test_diff;
divisor_index = i;
}
}
return divisor_index;
}
static int max98090_find_closest_pclk(int pclk)
{
int m1;
int m2;
int i;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/pm.h`, `linux/regmap.h`, `linux/slab.h`, `linux/acpi.h`.
- Detected declarations: `struct dmic_table`, `function max98090_volatile_register`, `function max98090_readable_register`, `function max98090_reset`, `function max98090_get_enab_tlv`, `function max98090_put_enab_tlv`, `function max98090_micinput_event`, `function max98090_shdn_event`, `function max98090_add_widgets`, `function max98090_configure_bclk`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.