sound/soc/renesas/rcar/dvc.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/dvc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/dvc.c- Extension
.c- Size
- 8868 bytes
- Lines
- 404
- 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_dvcfunction rsnd_dvc_activationfunction rsnd_dvc_haltfunction rsnd_kctrl_valsfunction rsnd_dvc_volume_initfunction rsnd_dvc_volume_updatefunction rsnd_dvc_probe_function rsnd_dvc_initfunction rsnd_dvc_quitfunction rsnd_dvc_pcm_newfunction rsnd_dvc_debug_infofunction rsnd_dvc_probefunction rsnd_dvc_removefunction for_each_rsnd_dvcfunction rsnd_dvc_suspendfunction rsnd_dvc_resume
Annotated Snippet
struct rsnd_dvc {
struct rsnd_mod mod;
struct rsnd_kctrl_cfg_m volume;
struct rsnd_kctrl_cfg_m mute;
struct rsnd_kctrl_cfg_s ren; /* Ramp Enable */
struct rsnd_kctrl_cfg_s rup; /* Ramp Rate Up */
struct rsnd_kctrl_cfg_s rdown; /* Ramp Rate Down */
};
#define rsnd_dvc_get(priv, id) ((struct rsnd_dvc *)(priv->dvc) + id)
#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
#define rsnd_mod_to_dvc(_mod) \
container_of((_mod), struct rsnd_dvc, mod)
#define for_each_rsnd_dvc(pos, priv, i) \
for ((i) = 0; \
((i) < rsnd_dvc_nr(priv)) && \
((pos) = (struct rsnd_dvc *)(priv)->dvc + i); \
i++)
static void rsnd_dvc_activation(struct rsnd_mod *mod)
{
rsnd_mod_write(mod, DVC_SWRSR, 0);
rsnd_mod_write(mod, DVC_SWRSR, 1);
}
static void rsnd_dvc_halt(struct rsnd_mod *mod)
{
rsnd_mod_write(mod, DVC_DVUIR, 1);
rsnd_mod_write(mod, DVC_SWRSR, 0);
}
#define rsnd_dvc_get_vrpdr(dvc) (rsnd_kctrl_vals(dvc->rup) << 8 | \
rsnd_kctrl_vals(dvc->rdown))
#define rsnd_dvc_get_vrdbr(dvc) (0x3ff - (rsnd_kctrl_valm(dvc->volume, 0) >> 13))
static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
u32 val[RSND_MAX_CHANNELS];
int i;
/* Enable Ramp */
if (rsnd_kctrl_vals(dvc->ren))
for (i = 0; i < RSND_MAX_CHANNELS; i++)
val[i] = rsnd_kctrl_max(dvc->volume);
else
for (i = 0; i < RSND_MAX_CHANNELS; i++)
val[i] = rsnd_kctrl_valm(dvc->volume, i);
/* Enable Digital Volume */
for (i = 0; i < RSND_MAX_CHANNELS; i++)
rsnd_mod_write(mod, DVC_VOLxR(i), val[i]);
}
static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
u32 adinr = 0;
u32 dvucr = 0;
u32 vrctr = 0;
u32 vrpdr = 0;
u32 vrdbr = 0;
adinr = rsnd_get_adinr_bit(mod, io) |
rsnd_runtime_channel_after_ctu(io);
/* Enable Digital Volume, Zero Cross Mute Mode */
dvucr |= 0x101;
/* Enable Ramp */
if (rsnd_kctrl_vals(dvc->ren)) {
dvucr |= 0x10;
/*
* FIXME !!
* use scale-downed Digital Volume
* as Volume Ramp
* 7F FFFF -> 3FF
*/
vrctr = 0xff;
vrpdr = rsnd_dvc_get_vrpdr(dvc);
vrdbr = rsnd_dvc_get_vrdbr(dvc);
}
/* Initialize operation */
rsnd_mod_write(mod, DVC_DVUIR, 1);
Annotation
- Immediate include surface: `rsnd.h`.
- Detected declarations: `struct rsnd_dvc`, `function rsnd_dvc_activation`, `function rsnd_dvc_halt`, `function rsnd_kctrl_vals`, `function rsnd_dvc_volume_init`, `function rsnd_dvc_volume_update`, `function rsnd_dvc_probe_`, `function rsnd_dvc_init`, `function rsnd_dvc_quit`, `function rsnd_dvc_pcm_new`.
- 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.