sound/soc/fsl/fsl_esai.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/fsl_esai.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/fsl_esai.c- Extension
.c- Size
- 33500 bytes
- Lines
- 1212
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk.hlinux/dmaengine.hlinux/module.hlinux/of_irq.hlinux/of_platform.hlinux/pm_runtime.hsound/dmaengine_pcm.hsound/pcm_params.hfsl_esai.himx-pcm.h
Detected Declarations
struct fsl_esai_soc_datastruct fsl_esaifunction esai_isrfunction set_dai_sysclkfunction fsl_esai_set_dai_sysclkfunction fsl_esai_set_bclkfunction fsl_esai_set_dai_tdm_slotfunction fsl_esai_set_dai_fmtfunction fsl_esai_startupfunction fsl_esai_hw_paramsfunction fsl_esai_hw_initfunction fsl_esai_register_restorefunction fsl_esai_trigger_startfunction fsl_esai_trigger_stopfunction fsl_esai_hw_resetfunction fsl_esai_triggerfunction fsl_esai_dai_probefunction fsl_esai_readable_regfunction fsl_esai_volatile_regfunction fsl_esai_writeable_regfunction fsl_esai_probefunction fsl_esai_removefunction fsl_esai_runtime_resumefunction fsl_esai_runtime_suspend
Annotated Snippet
struct fsl_esai_soc_data {
bool reset_at_xrun;
};
/**
* struct fsl_esai - ESAI private data
* @dma_params_rx: DMA parameters for receive channel
* @dma_params_tx: DMA parameters for transmit channel
* @pdev: platform device pointer
* @regmap: regmap handler
* @coreclk: clock source to access register
* @extalclk: esai clock source to derive HCK, SCK and FS
* @fsysclk: system clock source to derive HCK, SCK and FS
* @spbaclk: SPBA clock (optional, depending on SoC design)
* @work: work to handle the reset operation
* @soc: soc specific data
* @lock: spin lock between hw_reset() and trigger()
* @fifo_depth: depth of tx/rx FIFO
* @slot_width: width of each DAI slot
* @slots: number of slots
* @tx_mask: slot mask for TX
* @rx_mask: slot mask for RX
* @channels: channel num for tx or rx
* @hck_rate: clock rate of desired HCKx clock
* @sck_rate: clock rate of desired SCKx clock
* @hck_dir: the direction of HCKx pads
* @sck_div: if using PSR/PM dividers for SCKx clock
* @consumer_mode: if fully using DAI clock consumer mode
* @synchronous: if using tx/rx synchronous mode
* @name: driver name
*/
struct fsl_esai {
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct platform_device *pdev;
struct regmap *regmap;
struct clk *coreclk;
struct clk *extalclk;
struct clk *fsysclk;
struct clk *spbaclk;
struct work_struct work;
const struct fsl_esai_soc_data *soc;
spinlock_t lock; /* Protect hw_reset and trigger */
u32 fifo_depth;
u32 slot_width;
u32 slots;
u32 tx_mask;
u32 rx_mask;
u32 channels[2];
u32 hck_rate[2];
u32 sck_rate[2];
bool hck_dir[2];
bool sck_div[2];
bool consumer_mode;
bool synchronous;
char name[32];
};
static struct fsl_esai_soc_data fsl_esai_vf610 = {
.reset_at_xrun = true,
};
static struct fsl_esai_soc_data fsl_esai_imx35 = {
.reset_at_xrun = true,
};
static struct fsl_esai_soc_data fsl_esai_imx6ull = {
.reset_at_xrun = false,
};
static irqreturn_t esai_isr(int irq, void *devid)
{
struct fsl_esai *esai_priv = (struct fsl_esai *)devid;
struct platform_device *pdev = esai_priv->pdev;
u32 esr;
u32 saisr;
regmap_read(esai_priv->regmap, REG_ESAI_ESR, &esr);
regmap_read(esai_priv->regmap, REG_ESAI_SAISR, &saisr);
if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) &&
esai_priv->soc->reset_at_xrun) {
dev_dbg(&pdev->dev, "reset module for xrun\n");
regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR,
ESAI_xCR_xEIE_MASK, 0);
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR,
ESAI_xCR_xEIE_MASK, 0);
schedule_work(&esai_priv->work);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dmaengine.h`, `linux/module.h`, `linux/of_irq.h`, `linux/of_platform.h`, `linux/pm_runtime.h`, `sound/dmaengine_pcm.h`, `sound/pcm_params.h`.
- Detected declarations: `struct fsl_esai_soc_data`, `struct fsl_esai`, `function esai_isr`, `function set_dai_sysclk`, `function fsl_esai_set_dai_sysclk`, `function fsl_esai_set_bclk`, `function fsl_esai_set_dai_tdm_slot`, `function fsl_esai_set_dai_fmt`, `function fsl_esai_startup`, `function fsl_esai_hw_params`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.