[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y76z7uYb2/2BUSfl@sirena.org.uk>
Date: Wed, 11 Jan 2023 13:04:46 +0000
From: Mark Brown <broonie@...nel.org>
To: Vijendar Mukunda <Vijendar.Mukunda@....com>
Cc: vkoul@...nel.org, alsa-devel@...a-project.org,
Basavaraj.Hiregoudar@....com, Sunil-kumar.Dommati@....com,
Mario.Limonciello@....com, Mastan.Katragadda@....com,
arungopal.kondaveeti@....com, Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Syed Saba Kareem <Syed.SabaKareem@....com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 08/19] ASoC: amd: ps: add soundwire dma driver dma ops
On Wed, Jan 11, 2023 at 02:32:11PM +0530, Vijendar Mukunda wrote:
> +static int acp63_sdw_dma_start(struct snd_pcm_substream *stream)
> +{
> + struct sdw_stream_instance *sdw_ins;
> + struct snd_soc_pcm_runtime *prtd;
> + u32 stream_id;
> + u32 sdw_dma_reg;
> + u32 sdw_dma_en_stat_reg;
> + u32 sdw_dma_stat;
> + u32 val;
> + int timeout = 0;
> +
> + sdw_ins = stream->runtime->private_data;
> + prtd = stream->private_data;
> + stream_id = sdw_ins->stream_id;
> + switch (stream_id) {
> + case ACP_SDW_AUDIO_TX:
> + sdw_dma_reg = ACP_SW_AUDIO_TX_EN;
> + sdw_dma_en_stat_reg = ACP_SW_AUDIO_TX_EN_STATUS;
> + break;
Not super urgent but if you're respinning then it looks like the
register selection here is the same in _dma_stop() so they could be
shared. Indeed it generally feels like it might be nicer to have a
table of structs listing the registers needed per stream so all these
switch statements can be more like
sdw_dma_reg = stream_registers[sdw_ins->stream_id];
That'd make each function smaller and I'd expect it'd be a bit easier to
add new streams for new hardware that way.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists