sound/soc/renesas/rcar/src.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/src.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/src.c- Extension
.c- Size
- 18597 bytes
- Lines
- 871
- 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/of_irq.hrsnd.h
Detected Declarations
struct rsnd_srcstruct rsnd_src_ctrlfunction SRCfunction rsnd_src_haltfunction rsnd_src_convert_ratefunction rsnd_src_get_ratefunction rsnd_src_set_convert_ratefunction rsnd_src_init_convert_ratefunction rsnd_src_irqfunction rsnd_src_probe_function rsnd_src_status_clearfunction rsnd_src_error_occurredfunction rsnd_src_startfunction rsnd_src_stopfunction rsnd_src_initfunction rsnd_src_quitfunction __rsnd_src_interruptfunction scoped_guardfunction rsnd_src_interruptfunction rsnd_src_kctrl_accept_runtimefunction rsnd_src_probe_function rsnd_src_pcm_newfunction rsnd_src_debug_infofunction rsnd_src_probefunction rsnd_src_removefunction for_each_rsnd_srcfunction rsnd_src_suspendfunction rsnd_src_resume
Annotated Snippet
struct rsnd_src {
struct rsnd_mod mod;
struct rsnd_mod *dma;
struct rsnd_kctrl_cfg_s sen; /* sync convert enable */
struct rsnd_kctrl_cfg_s sync; /* sync convert */
u32 current_sync_rate;
int irq;
};
#define rsnd_src_get(priv, id) ((struct rsnd_src *)(priv->src) + id)
#define rsnd_src_nr(priv) ((priv)->src_nr)
#define rsnd_src_sync_is_enabled(mod) (rsnd_mod_to_src(mod)->sen.val)
#define rsnd_mod_to_src(_mod) \
container_of((_mod), struct rsnd_src, mod)
#define for_each_rsnd_src(pos, priv, i) \
for ((i) = 0; \
((i) < rsnd_src_nr(priv)) && \
((pos) = (struct rsnd_src *)(priv)->src + i); \
i++)
struct rsnd_src_ctrl {
struct clk *scu;
struct clk *scu_x2;
struct clk *scu_supply;
};
#define rsnd_priv_to_src_ctrl(priv) \
((struct rsnd_src_ctrl *)(priv)->src_ctrl)
/*
* image of SRC (Sampling Rate Converter)
*
* 96kHz <-> +-----+ 48kHz +-----+ 48kHz +-------+
* 48kHz <-> | SRC | <------> | SSI | <-----> | codec |
* 44.1kHz <-> +-----+ +-----+ +-------+
* ...
*
*/
static void rsnd_src_activation(struct rsnd_mod *mod)
{
rsnd_mod_write(mod, SRC_SWRSR, 0);
rsnd_mod_write(mod, SRC_SWRSR, 1);
}
static void rsnd_src_halt(struct rsnd_mod *mod)
{
rsnd_mod_write(mod, SRC_SRCIR, 1);
rsnd_mod_write(mod, SRC_SWRSR, 0);
}
static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
int is_play = rsnd_io_is_play(io);
return rsnd_dma_request_channel(rsnd_src_of_node(priv),
SRC_NAME, mod,
is_play ? "rx" : "tx");
}
static u32 rsnd_src_convert_rate(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
struct rsnd_src *src = rsnd_mod_to_src(mod);
u32 convert_rate;
if (!runtime)
return 0;
if (!rsnd_src_sync_is_enabled(mod))
return rsnd_io_converted_rate(io);
convert_rate = src->current_sync_rate;
if (!convert_rate)
convert_rate = rsnd_io_converted_rate(io);
if (!convert_rate)
convert_rate = runtime->rate;
return convert_rate;
}
unsigned int rsnd_src_get_rate(struct rsnd_priv *priv,
Annotation
- Immediate include surface: `linux/of_irq.h`, `rsnd.h`.
- Detected declarations: `struct rsnd_src`, `struct rsnd_src_ctrl`, `function SRC`, `function rsnd_src_halt`, `function rsnd_src_convert_rate`, `function rsnd_src_get_rate`, `function rsnd_src_set_convert_rate`, `function rsnd_src_init_convert_rate`, `function rsnd_src_irq`, `function rsnd_src_probe_`.
- 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.