sound/soc/renesas/rcar/adg.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/adg.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/adg.c- Extension
.c- Size
- 21726 bytes
- Lines
- 982
- 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.
- 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-provider.hlinux/clkdev.hrsnd.h
Detected Declarations
struct rsnd_adgfunction rsnd_adg_calculate_brgxfunction rsnd_adg_ssi_ws_timing_gen2function __rsnd_adg_get_timesel_ratiofunction rsnd_adg_get_timesel_ratiofunction rsnd_adg_set_cmd_timsel_gen2function rsnd_adg_set_src_timesel_gen2function rsnd_adg_set_ssi_clkfunction rsnd_adg_clk_queryfunction rsnd_adg_ssi_clk_stopfunction rsnd_adg_ssi_clk_try_startfunction rsnd_adg_ssi_clk_preparefunction rsnd_adg_ssi_clk_unpreparefunction rsnd_adg_clk_controlfunction for_each_rsnd_clkinfunction rsnd_adg_clk_enablefunction rsnd_adg_null_clk_cleanfunction rsnd_adg_get_clkinfunction rsnd_adg_unregister_clkoutfunction rsnd_adg_get_clkoutfunction dbg_msgfunction rsnd_adg_clk_dbg_infofunction rsnd_adg_get_ssi_clksfunction rsnd_adg_probefunction rsnd_adg_removefunction rsnd_adg_suspendfunction rsnd_adg_resume
Annotated Snippet
struct rsnd_adg {
struct clk *adg;
struct clk *clkin[CLKINMAX];
struct clk *clkout[CLKOUTMAX];
/* RZ/G3E: per-SSI ADG clocks (adg-ssi-0 through adg-ssi-9) */
struct clk *clk_adg_ssi[ADG_SSI_MAX];
struct clk *clk_ssif_supply;
struct clk *null_clk;
struct clk_onecell_data onecell;
struct rsnd_mod mod;
int clkin_rate[CLKINMAX];
bool ssi_clk_prepared;
int clkin_size;
int clkout_size;
u32 ckr;
u32 brga;
u32 brgb;
int brg_rate[ADG_HZ_SIZE]; /* BRGA / BRGB */
};
#define for_each_rsnd_clkin(pos, adg, i) \
for (i = 0; \
(i < adg->clkin_size) && \
((pos) = adg->clkin[i]); \
i++)
#define for_each_rsnd_clkout(pos, adg, i) \
for (i = 0; \
(i < adg->clkout_size) && \
((pos) = adg->clkout[i]); \
i++)
#define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg)
static const char * const clkin_name_gen4[] = {
[CLKA] = "clkin",
};
static const char * const clkin_name_gen2[] = {
[CLKA] = "clk_a",
[CLKB] = "clk_b",
[CLKC] = "clk_c",
[CLKI] = "clk_i",
};
static const char * const clkin_name_rzg3e[] = {
[CLKA] = "audio-clka",
[CLKB] = "audio-clkb",
[CLKC] = "audio-clkc",
[CLKI] = "audio-clki",
};
static const char * const clkout_name_gen2[] = {
[CLKOUT] = "audio_clkout",
[CLKOUT1] = "audio_clkout1",
[CLKOUT2] = "audio_clkout2",
[CLKOUT3] = "audio_clkout3",
};
static u32 rsnd_adg_calculate_brgx(unsigned long div)
{
int i;
if (!div)
return 0;
for (i = 3; i >= 0; i--) {
int ratio = 2 << (i * 2);
if (0 == (div % ratio))
return (u32)((i << 8) | ((div / ratio) - 1));
}
return ~0;
}
static u32 rsnd_adg_ssi_ws_timing_gen2(struct rsnd_dai_stream *io)
{
struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
int id = rsnd_mod_id(ssi_mod);
int ws = id;
if (rsnd_ssi_is_pin_sharing(io)) {
switch (id) {
case 1:
case 2:
case 9:
ws = 0;
break;
case 4:
ws = 3;
break;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/clkdev.h`, `rsnd.h`.
- Detected declarations: `struct rsnd_adg`, `function rsnd_adg_calculate_brgx`, `function rsnd_adg_ssi_ws_timing_gen2`, `function __rsnd_adg_get_timesel_ratio`, `function rsnd_adg_get_timesel_ratio`, `function rsnd_adg_set_cmd_timsel_gen2`, `function rsnd_adg_set_src_timesel_gen2`, `function rsnd_adg_set_ssi_clk`, `function rsnd_adg_clk_query`, `function rsnd_adg_ssi_clk_stop`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
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.