sound/soc/renesas/rcar/gen.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/gen.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/gen.c- Extension
.c- Size
- 22317 bytes
- Lines
- 676
- 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
rsnd.h
Detected Declarations
struct rsnd_genstruct rsnd_regmap_field_conffunction rsnd_is_accessible_regfunction rsnd_mod_id_cmdfunction rsnd_mod_readfunction rsnd_mod_writefunction rsnd_mod_bsetfunction rsnd_gen_get_phy_addrfunction _rsnd_gen_regmap_initfunction rsnd_gen4_probefunction rsnd_gen2_probefunction rsnd_gen1_probefunction rsnd_rzg3e_probefunction rsnd_gen_probe
Annotated Snippet
struct rsnd_gen {
struct rsnd_gen_ops *ops;
/* RSND_BASE_MAX base */
void __iomem *base[RSND_BASE_MAX];
phys_addr_t res[RSND_BASE_MAX];
struct regmap *regmap[RSND_BASE_MAX];
/* RSND_REG_MAX base */
struct regmap_field *regs[REG_MAX];
const char *reg_name[REG_MAX];
};
#define rsnd_priv_to_gen(p) ((struct rsnd_gen *)(p)->gen)
#define rsnd_reg_name(gen, id) ((gen)->reg_name[id])
struct rsnd_regmap_field_conf {
int idx;
unsigned int reg_offset;
unsigned int id_offset;
const char *reg_name;
};
#define RSND_REG_SET(id, offset, _id_offset, n) \
{ \
.idx = id, \
.reg_offset = offset, \
.id_offset = _id_offset, \
.reg_name = n, \
}
/* single address mapping */
#define RSND_GEN_S_REG(id, offset) \
RSND_REG_SET(id, offset, 0, #id)
/* multi address mapping */
#define RSND_GEN_M_REG(id, offset, _id_offset) \
RSND_REG_SET(id, offset, _id_offset, #id)
/*
* basic function
*/
static int rsnd_is_accessible_reg(struct rsnd_priv *priv,
struct rsnd_gen *gen, enum rsnd_reg reg)
{
if (!gen->regs[reg]) {
struct device *dev = rsnd_priv_to_dev(priv);
dev_err(dev, "unsupported register access %x\n", reg);
return 0;
}
return 1;
}
static int rsnd_mod_id_cmd(struct rsnd_mod *mod)
{
if (mod->ops->id_cmd)
return mod->ops->id_cmd(mod);
return rsnd_mod_id(mod);
}
u32 rsnd_mod_read(struct rsnd_mod *mod, enum rsnd_reg reg)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
u32 val;
if (!rsnd_is_accessible_reg(priv, gen, reg))
return 0;
regmap_fields_read(gen->regs[reg], rsnd_mod_id_cmd(mod), &val);
dev_dbg(dev, "r %s - %-18s (%4d) : %08x\n",
rsnd_mod_name(mod),
rsnd_reg_name(gen, reg), reg, val);
return val;
}
void rsnd_mod_write(struct rsnd_mod *mod,
enum rsnd_reg reg, u32 data)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
if (!rsnd_is_accessible_reg(priv, gen, reg))
return;
Annotation
- Immediate include surface: `rsnd.h`.
- Detected declarations: `struct rsnd_gen`, `struct rsnd_regmap_field_conf`, `function rsnd_is_accessible_reg`, `function rsnd_mod_id_cmd`, `function rsnd_mod_read`, `function rsnd_mod_write`, `function rsnd_mod_bset`, `function rsnd_gen_get_phy_addr`, `function _rsnd_gen_regmap_init`, `function rsnd_gen4_probe`.
- 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.