sound/soc/renesas/rcar/cmd.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/cmd.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/cmd.c- Extension
.c- Size
- 4023 bytes
- Lines
- 192
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rsnd.h
Detected Declarations
struct rsnd_cmdfunction rsnd_cmd_initfunction for_each_rsnd_daifunction rsnd_cmd_startfunction rsnd_cmd_stopfunction rsnd_cmd_debug_infofunction rsnd_cmd_attachfunction rsnd_cmd_probefunction for_each_rsnd_cmdfunction rsnd_cmd_removefunction for_each_rsnd_cmd
Annotated Snippet
struct rsnd_cmd {
struct rsnd_mod mod;
};
#define CMD_NAME "cmd"
#define rsnd_cmd_nr(priv) ((priv)->cmd_nr)
#define for_each_rsnd_cmd(pos, priv, i) \
for ((i) = 0; \
((i) < rsnd_cmd_nr(priv)) && \
((pos) = (struct rsnd_cmd *)(priv)->cmd + i); \
i++)
static int rsnd_cmd_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
struct device *dev = rsnd_priv_to_dev(priv);
u32 data;
static const u32 path[] = {
[1] = 1 << 0,
[5] = 1 << 8,
[6] = 1 << 12,
[9] = 1 << 15,
};
if (!mix && !dvc)
return 0;
if (ARRAY_SIZE(path) < rsnd_mod_id(mod) + 1)
return -ENXIO;
if (mix) {
struct rsnd_dai *rdai;
int i;
/*
* it is assuming that integrater is well understanding about
* data path. Here doesn't check impossible connection,
* like src2 + src5
*/
data = 0;
for_each_rsnd_dai(rdai, priv, i) {
struct rsnd_dai_stream *tio = &rdai->playback;
struct rsnd_mod *src = rsnd_io_to_mod_src(tio);
if (mix == rsnd_io_to_mod_mix(tio))
data |= path[rsnd_mod_id(src)];
tio = &rdai->capture;
src = rsnd_io_to_mod_src(tio);
if (mix == rsnd_io_to_mod_mix(tio))
data |= path[rsnd_mod_id(src)];
}
} else {
struct rsnd_mod *src = rsnd_io_to_mod_src(io);
static const u8 cmd_case[] = {
[0] = 0x3,
[1] = 0x3,
[2] = 0x4,
[3] = 0x1,
[4] = 0x2,
[5] = 0x4,
[6] = 0x1,
[9] = 0x2,
};
if (unlikely(!src))
return -EIO;
data = path[rsnd_mod_id(src)] |
cmd_case[rsnd_mod_id(src)] << 16;
}
dev_dbg(dev, "ctu/mix path = 0x%08x\n", data);
rsnd_mod_write(mod, CMD_ROUTE_SLCT, data);
rsnd_mod_write(mod, CMD_BUSIF_MODE, rsnd_get_busif_shift(io, mod) | 1);
rsnd_mod_write(mod, CMD_BUSIF_DALIGN, rsnd_get_dalign(mod, io));
rsnd_adg_set_cmd_timsel_gen2(mod, io);
return 0;
}
static int rsnd_cmd_start(struct rsnd_mod *mod,
Annotation
- Immediate include surface: `rsnd.h`.
- Detected declarations: `struct rsnd_cmd`, `function rsnd_cmd_init`, `function for_each_rsnd_dai`, `function rsnd_cmd_start`, `function rsnd_cmd_stop`, `function rsnd_cmd_debug_info`, `function rsnd_cmd_attach`, `function rsnd_cmd_probe`, `function for_each_rsnd_cmd`, `function rsnd_cmd_remove`.
- 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.