sound/soc/mxs/mxs-saif.c
Source file repositories/reference/linux-study-clean/sound/soc/mxs/mxs-saif.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mxs/mxs-saif.c- Extension
.c- Size
- 21614 bytes
- Lines
- 898
- 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.
- 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/module.hlinux/init.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/dma-mapping.hlinux/clk.hlinux/clk-provider.hlinux/delay.hlinux/io.hlinux/time.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hmxs-saif.h
Detected Declarations
function __mxs_saif_put_mclkfunction __mxs_saif_get_mclkfunction mxs_saif_set_dai_sysclkfunction mxs_saif_set_clkfunction mxs_saif_put_mclkfunction mxs_saif_get_mclkfunction mxs_saif_set_dai_fmtfunction mxs_saif_startupfunction mxs_saif_shutdownfunction mxs_saif_hw_paramsfunction mxs_saif_preparefunction mxs_saif_triggerfunction mxs_saif_irqfunction mxs_saif_mclk_initfunction mxs_saif_probeexport mxs_saif_put_mclkexport mxs_saif_get_mclk
Annotated Snippet
switch (mclk / rate) {
case 32:
case 64:
case 128:
case 256:
case 512:
scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
ret = clk_set_rate(master_saif->clk, 512 * rate);
break;
case 48:
case 96:
case 192:
case 384:
scr |= BM_SAIF_CTRL_BITCLK_BASE_RATE;
ret = clk_set_rate(master_saif->clk, 384 * rate);
break;
default:
/* SAIF MCLK should be a sub-rate of 512x or 384x */
clk_disable_unprepare(master_saif->clk);
return -EINVAL;
}
} else {
ret = clk_set_rate(master_saif->clk, 512 * rate);
scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
}
clk_disable_unprepare(master_saif->clk);
if (ret)
return ret;
master_saif->cur_rate = rate;
if (!master_saif->mclk_in_use) {
__raw_writel(scr, master_saif->base + SAIF_CTRL);
return 0;
}
/*
* Program the over-sample rate for MCLK output
*
* The available MCLK range is 32x, 48x... 512x. The rate
* could be from 8kHz to 192kH.
*/
switch (mclk / rate) {
case 32:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(4);
break;
case 64:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(3);
break;
case 128:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(2);
break;
case 256:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(1);
break;
case 512:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(0);
break;
case 48:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(3);
break;
case 96:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(2);
break;
case 192:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(1);
break;
case 384:
scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(0);
break;
default:
return -EINVAL;
}
__raw_writel(scr, master_saif->base + SAIF_CTRL);
return 0;
}
/*
* Put and disable MCLK.
*/
int mxs_saif_put_mclk(unsigned int saif_id)
{
struct mxs_saif *saif = mxs_saif[saif_id];
u32 stat;
if (!saif)
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/dma-mapping.h`, `linux/clk.h`, `linux/clk-provider.h`.
- Detected declarations: `function __mxs_saif_put_mclk`, `function __mxs_saif_get_mclk`, `function mxs_saif_set_dai_sysclk`, `function mxs_saif_set_clk`, `function mxs_saif_put_mclk`, `function mxs_saif_get_mclk`, `function mxs_saif_set_dai_fmt`, `function mxs_saif_startup`, `function mxs_saif_shutdown`, `function mxs_saif_hw_params`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.