sound/soc/uniphier/aio-core.c
Source file repositories/reference/linux-study-clean/sound/soc/uniphier/aio-core.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/uniphier/aio-core.c- Extension
.c- Size
- 32054 bytes
- Lines
- 1267
- 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
linux/bitfield.hlinux/errno.hlinux/kernel.hlinux/module.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.haio.haio-reg.h
Detected Declarations
function rb_cntfunction rb_cnt_to_endfunction rb_spacefunction rb_space_to_endfunction aio_rb_cntfunction aio_rbt_cnt_to_endfunction aio_rb_spacefunction aio_rb_space_to_endfunction aio_iecout_set_enablefunction aio_chip_set_pllfunction aio_chip_initfunction aio_initfunction aio_port_resetfunction aio_port_set_chfunction hw_paramsfunction set_fmtfunction set_sysclkfunction aio_port_set_paramfunction aio_port_set_enablefunction aio_port_get_volumefunction aio_port_set_volumefunction aio_if_set_paramfunction aio_oport_set_stream_typefunction aio_src_resetfunction aio_src_set_paramfunction aio_srcif_set_paramfunction aio_srcch_set_paramfunction aio_srcch_set_enablefunction aiodma_ch_set_paramfunction aiodma_ch_set_enablefunction aiodma_rb_get_rpfunction aiodma_rb_set_rpfunction aiodma_rb_get_wpfunction aiodma_rb_set_wpfunction aiodma_rb_set_thresholdfunction aiodma_rb_set_bufferfunction aiodma_rb_syncfunction aiodma_rb_is_irqfunction aiodma_rb_clear_irq
Annotated Snippet
if (sub->swm->dir == PORT_DIR_INPUT) {
regmap_write(r, A2IIFNMAPCTR0(sub->swm->iif.hw),
MAPCTR0_EN | sub->swm->iif.map);
regmap_write(r, A2IPORTNMAPCTR0(sub->swm->iport.hw),
MAPCTR0_EN | sub->swm->iport.map);
} else {
regmap_write(r, A2OIFNMAPCTR0(sub->swm->oif.hw),
MAPCTR0_EN | sub->swm->oif.map);
regmap_write(r, A2OPORTNMAPCTR0(sub->swm->oport.hw),
MAPCTR0_EN | sub->swm->oport.map);
}
break;
case PORT_TYPE_CONV:
regmap_write(r, A2OIFNMAPCTR0(sub->swm->oif.hw),
MAPCTR0_EN | sub->swm->oif.map);
regmap_write(r, A2OPORTNMAPCTR0(sub->swm->oport.hw),
MAPCTR0_EN | sub->swm->oport.map);
regmap_write(r, A2CHNMAPCTR0(sub->swm->och.hw),
MAPCTR0_EN | sub->swm->och.map);
regmap_write(r, A2IIFNMAPCTR0(sub->swm->iif.hw),
MAPCTR0_EN | sub->swm->iif.map);
break;
default:
dev_err(dev, "Unknown port type %d.\n", sub->swm->type);
return -EINVAL;
}
return 0;
}
/**
* aio_port_reset - reset AIO port block
* @sub: the AIO substream pointer
*
* Resets the digital signal input/output port block of AIO.
*/
void aio_port_reset(struct uniphier_aio_sub *sub)
{
struct regmap *r = sub->aio->chip->regmap;
if (sub->swm->dir == PORT_DIR_OUTPUT) {
regmap_write(r, AOUTRSTCTR0, BIT(sub->swm->oport.map));
regmap_write(r, AOUTRSTCTR1, BIT(sub->swm->oport.map));
} else {
regmap_update_bits(r, IPORTMXRSTCTR(sub->swm->iport.map),
IPORTMXRSTCTR_RSTPI_MASK,
IPORTMXRSTCTR_RSTPI_RESET);
regmap_update_bits(r, IPORTMXRSTCTR(sub->swm->iport.map),
IPORTMXRSTCTR_RSTPI_MASK,
IPORTMXRSTCTR_RSTPI_RELEASE);
}
}
/**
* aio_port_set_ch - set channels of LPCM
* @sub: the AIO substream pointer, PCM substream only
*
* Set suitable slot selecting to input/output port block of AIO.
*
* This function may return error if non-PCM substream.
*
* Return: Zero if successful, otherwise a negative value on error.
*/
static int aio_port_set_ch(struct uniphier_aio_sub *sub)
{
struct regmap *r = sub->aio->chip->regmap;
static const u32 slotsel_2ch[] = {
0, 0, 0, 0, 0,
};
static const u32 slotsel_multi[] = {
OPORTMXTYSLOTCTR_SLOTSEL_SLOT0,
OPORTMXTYSLOTCTR_SLOTSEL_SLOT1,
OPORTMXTYSLOTCTR_SLOTSEL_SLOT2,
OPORTMXTYSLOTCTR_SLOTSEL_SLOT3,
OPORTMXTYSLOTCTR_SLOTSEL_SLOT4,
};
u32 mode;
const u32 *slotsel;
int i;
switch (params_channels(&sub->params)) {
case 8:
case 6:
mode = OPORTMXTYSLOTCTR_MODE;
slotsel = slotsel_multi;
break;
case 2:
mode = 0;
slotsel = slotsel_2ch;
break;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/errno.h`, `linux/kernel.h`, `linux/module.h`, `sound/core.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`.
- Detected declarations: `function rb_cnt`, `function rb_cnt_to_end`, `function rb_space`, `function rb_space_to_end`, `function aio_rb_cnt`, `function aio_rbt_cnt_to_end`, `function aio_rb_space`, `function aio_rb_space_to_end`, `function aio_iecout_set_enable`, `function aio_chip_set_pll`.
- 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.