sound/soc/renesas/rz-ssi.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rz-ssi.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rz-ssi.c- Extension
.c- Size
- 33667 bytes
- Lines
- 1315
- 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/io.hlinux/iopoll.hlinux/module.hlinux/pm_runtime.hlinux/reset.hsound/pcm_params.hsound/soc.h
Detected Declarations
struct rz_ssi_privstruct rz_ssi_streamstruct rz_ssi_privfunction rz_ssi_reg_writelfunction rz_ssi_reg_readlfunction rz_ssi_reg_mask_setlfunction rz_ssi_stream_is_playfunction rz_ssi_stream_getfunction rz_ssi_is_dma_enabledfunction rz_ssi_set_substreamfunction rz_ssi_stream_is_validfunction rz_ssi_is_stream_runningfunction rz_ssi_stream_initfunction rz_ssi_stream_quitfunction rz_ssi_clk_setupfunction rz_ssi_set_idlefunction rz_ssi_startfunction rz_ssi_swresetfunction rz_ssi_stopfunction rz_ssi_pointer_updatefunction rz_ssi_pio_recvfunction rz_ssi_pio_sendfunction rz_ssi_interruptfunction rz_ssi_dma_slave_configfunction rz_ssi_dma_transferfunction rz_ssi_dma_completefunction rz_ssi_release_dma_channelsfunction rz_ssi_dma_requestfunction rz_ssi_trigger_resumefunction rz_ssi_dai_triggerfunction rz_ssi_dai_set_fmtfunction rz_ssi_startupfunction rz_ssi_shutdownfunction rz_ssi_is_valid_hw_paramsfunction rz_ssi_cache_hw_paramsfunction rz_ssi_dai_hw_paramsfunction rz_ssi_pcm_openfunction rz_ssi_pcm_pointerfunction rz_ssi_pcm_newfunction rz_ssi_probefunction rz_ssi_removefunction rz_ssi_runtime_suspendfunction rz_ssi_runtime_resume
Annotated Snippet
struct rz_ssi_stream {
struct rz_ssi_priv *priv;
struct snd_pcm_substream *substream;
int fifo_sample_size; /* sample capacity of SSI FIFO */
int dma_buffer_pos; /* The address for the next DMA descriptor */
int completed_dma_buf_pos; /* The address of the last completed DMA descriptor. */
int period_counter; /* for keeping track of periods transferred */
int buffer_pos; /* current frame position in the buffer */
int running; /* 0=stopped, 1=running */
int uerr_num;
int oerr_num;
struct dma_chan *dma_ch;
int (*transfer)(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm);
};
struct rz_ssi_priv {
void __iomem *base;
struct reset_control *rstc;
struct device *dev;
struct clk *sfr_clk;
struct clk *clk;
phys_addr_t phys;
int irq_int;
int irq_tx;
int irq_rx;
int irq_rt;
spinlock_t lock;
/*
* The SSI supports full-duplex transmission and reception.
* However, if an error occurs, channel reset (both transmission
* and reception reset) is required.
* So it is better to use as half-duplex (playing and recording
* should be done on separate channels).
*/
struct rz_ssi_stream playback;
struct rz_ssi_stream capture;
/* clock */
unsigned long audio_mck;
unsigned long audio_clk_1;
unsigned long audio_clk_2;
bool lrckp_fsync_fall; /* LR clock polarity (SSICR.LRCKP) */
bool bckp_rise; /* Bit clock polarity (SSICR.BCKP) */
bool dma_rt;
struct {
bool tx_active;
bool rx_active;
bool one_stream_triggered;
} dup;
/* Full duplex communication support */
struct {
unsigned int rate;
unsigned int channels;
unsigned int sample_width;
unsigned int sample_bits;
} hw_params_cache;
};
static void rz_ssi_dma_complete(void *data);
static void rz_ssi_reg_writel(struct rz_ssi_priv *priv, uint reg, u32 data)
{
writel(data, (priv->base + reg));
}
static u32 rz_ssi_reg_readl(struct rz_ssi_priv *priv, uint reg)
{
return readl(priv->base + reg);
}
static void rz_ssi_reg_mask_setl(struct rz_ssi_priv *priv, uint reg,
u32 bclr, u32 bset)
{
u32 val;
val = readl(priv->base + reg);
val = (val & ~bclr) | bset;
writel(val, (priv->base + reg));
}
static inline bool rz_ssi_stream_is_play(struct snd_pcm_substream *substream)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dmaengine.h`, `linux/io.h`, `linux/iopoll.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/reset.h`, `sound/pcm_params.h`.
- Detected declarations: `struct rz_ssi_priv`, `struct rz_ssi_stream`, `struct rz_ssi_priv`, `function rz_ssi_reg_writel`, `function rz_ssi_reg_readl`, `function rz_ssi_reg_mask_setl`, `function rz_ssi_stream_is_play`, `function rz_ssi_stream_get`, `function rz_ssi_is_dma_enabled`, `function rz_ssi_set_substream`.
- 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.