Re: [PATCH 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers
Frank Li <[email protected]> Thu, 30 Jul 2026 14:30:17 -0500
| Newsgroups | org.kernel.vger.dmaengine,org.kernel.vger.linux-iio |
|---|---|
| Message-ID | <amumSQ6dUoWnkg_Z@SMW015318> |
On Thu, Jul 30, 2026 at 03:23:14PM +0100, Nuno Sá via B4 Relay wrote: > [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > From: Nuno Sá <[email protected]> > > Use the dma_slave_caps bus width helpers instead of reading the legacy > src_addr_widths and dst_addr_widths masks directly. > > Keep the existing default assumption of 1, 2 and 4 byte widths when the > DMA channel does not report slave capabilities. > > Signed-off-by: Nuno Sá <[email protected]> > --- Reviewed-by: Frank Li <[email protected]> > sound/core/pcm_dmaengine.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c > index 1306b04be171..37468f4643bc 100644 > --- a/sound/core/pcm_dmaengine.c > +++ b/sound/core/pcm_dmaengine.c > @@ -409,15 +409,17 @@ int snd_dmaengine_pcm_refine_runtime_hwparams( > struct dma_chan *chan) > { > struct dma_slave_caps dma_caps; > - u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | > - BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | > - BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); > + DECLARE_DMA_BUS_WIDTHS(bus_widths) = {}; > snd_pcm_format_t i; > int ret = 0; > > if (!hw || !chan || !dma_data) > return -EINVAL; > > + __set_bit(DMA_SLAVE_BUSWIDTH_1_BYTE, bus_widths); > + __set_bit(DMA_SLAVE_BUSWIDTH_2_BYTES, bus_widths); > + __set_bit(DMA_SLAVE_BUSWIDTH_4_BYTES, bus_widths); > + > ret = dma_get_slave_caps(chan, &dma_caps); > if (ret == 0) { > if (dma_caps.cmd_pause && dma_caps.cmd_resume) > @@ -426,9 +428,9 @@ int snd_dmaengine_pcm_refine_runtime_hwparams( > hw->info |= SNDRV_PCM_INFO_BATCH; > > if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) > - addr_widths = dma_caps.dst_addr_widths; > + dma_slave_caps_copy_dst_widths(&dma_caps, bus_widths); > else > - addr_widths = dma_caps.src_addr_widths; > + dma_slave_caps_copy_src_widths(&dma_caps, bus_widths); > } > > /* > @@ -460,7 +462,7 @@ int snd_dmaengine_pcm_refine_runtime_hwparams( > case 24: > case 32: > case 64: > - if (addr_widths & (1 << (bits / 8))) > + if (test_bit(bits / 8, bus_widths)) > hw->formats |= pcm_format_to_bits(i); > break; > default: > > -- > 2.55.0 > >