sound/soc/renesas/fsi.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/fsi.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/fsi.c- Extension
.c- Size
- 48317 bytes
- Lines
- 2180
- 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/delay.hlinux/dma-mapping.hlinux/pm_runtime.hlinux/io.hlinux/of.hlinux/scatterlist.hlinux/sh_dma.hlinux/slab.hlinux/module.hlinux/workqueue.hsound/soc.hsound/pcm_params.hsound/sh_fsi.h
Detected Declarations
struct fsi_stream_handlerstruct fsi_streamstruct fsi_clkstruct fsi_privstruct fsi_stream_handlerstruct fsi_corestruct fsi_masterfunction fsi_stream_is_playfunction __fsi_reg_writefunction __fsi_reg_readfunction __fsi_reg_mask_setfunction _fsi_master_readfunction _fsi_master_mask_setfunction fsi_versionfunction fsi_is_clk_masterfunction fsi_is_port_afunction fsi_is_spdiffunction fsi_is_enable_streamfunction fsi_is_playfunction fsi_get_port_shiftfunction fsi_frame2samplefunction fsi_sample2framefunction fsi_stream_is_workingfunction fsi_get_current_fifo_samplesfunction fsi_count_fifo_errfunction fsi_stream_xxfunction fsi_stream_initfunction fsi_stream_quitfunction fsi_stream_transferfunction fsi_stream_probefunction fsi_stream_removefunction fsi_format_bus_setupfunction fsi_irq_enablefunction fsi_irq_disablefunction fsi_irq_get_statusfunction fsi_irq_clear_statusfunction fsi_spdif_clk_ctrlfunction fsi_clk_validfunction fsi_clk_is_validfunction fsi_clk_preparefunction fsi_clk_unpreparefunction fsi_clk_enablefunction fsi_clk_disablefunction fsi_clk_set_ackbpffunction fsi_clk_set_rate_externalfunction fsi_clk_set_rate_cpgfunction fsi_clk_initfunction fsi_pointer_update
Annotated Snippet
struct fsi_stream {
/*
* these are initialized by fsi_stream_init()
*/
struct snd_pcm_substream *substream;
int fifo_sample_capa; /* sample capacity of FSI FIFO */
int buff_sample_capa; /* sample capacity of ALSA buffer */
int buff_sample_pos; /* sample position of ALSA buffer */
int period_samples; /* sample number / 1 period */
int period_pos; /* current period position */
int sample_width; /* sample width */
int uerr_num;
int oerr_num;
/*
* bus options
*/
u32 bus_option;
/*
* these are initialized by fsi_handler_init()
*/
const struct fsi_stream_handler *handler;
struct fsi_priv *priv;
/*
* these are for DMAEngine
*/
struct dma_chan *chan;
int dma_id;
};
struct fsi_clk {
/* see [FSI clock] */
struct clk *own;
struct clk *xck;
struct clk *ick;
struct clk *div;
int (*set_rate)(struct device *dev,
struct fsi_priv *fsi);
unsigned long rate;
unsigned int count;
};
struct fsi_priv {
void __iomem *base;
phys_addr_t phys;
struct fsi_master *master;
struct fsi_stream playback;
struct fsi_stream capture;
struct fsi_clk clock;
u32 fmt;
int chan_num:16;
unsigned int clk_master:1;
unsigned int clk_cpg:1;
unsigned int spdif:1;
unsigned int enable_stream:1;
unsigned int bit_clk_inv:1;
unsigned int lr_clk_inv:1;
};
struct fsi_stream_handler {
int (*init)(struct fsi_priv *fsi, struct fsi_stream *io);
int (*quit)(struct fsi_priv *fsi, struct fsi_stream *io);
int (*probe)(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev);
int (*transfer)(struct fsi_priv *fsi, struct fsi_stream *io);
int (*remove)(struct fsi_priv *fsi, struct fsi_stream *io);
int (*start_stop)(struct fsi_priv *fsi, struct fsi_stream *io,
int enable);
};
#define fsi_stream_handler_call(io, func, args...) \
(!(io) ? -ENODEV : \
!((io)->handler->func) ? 0 : \
(io)->handler->func(args))
struct fsi_core {
int ver;
u32 int_st;
u32 iemsk;
u32 imsk;
u32 a_mclk;
u32 b_mclk;
};
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/pm_runtime.h`, `linux/io.h`, `linux/of.h`, `linux/scatterlist.h`, `linux/sh_dma.h`, `linux/slab.h`.
- Detected declarations: `struct fsi_stream_handler`, `struct fsi_stream`, `struct fsi_clk`, `struct fsi_priv`, `struct fsi_stream_handler`, `struct fsi_core`, `struct fsi_master`, `function fsi_stream_is_play`, `function __fsi_reg_write`, `function __fsi_reg_read`.
- 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.