[alsa-devel] [PATCH 16/20] ASoC: OMAP: Use McBSP threshold again

Eduardo Valentin eduardo.valentin at nokia.com
Mon Aug 10 10:53:55 CEST 2009


Hi Jarkko,

On Wed, Aug 05, 2009 at 09:48:56AM +0200, ext Jarkko Nikula wrote:
> On Thu, 30 Jul 2009 15:49:39 +0300
> Eduardo Valentin <eduardo.valentin at nokia.com> wrote:
> 
> > Now this patch implements again the McBSP threshold
> > usage for OMAP ASoC.
> > 
> > We figured out that there is no need to have so much
> > SW control in order to have DMA in idle state during
> > audio streaming. Configuring McBSP threshold value
> > and DMA to FRAME_SYNC are sufficient.
> > 
> > Signed-off-by: Eduardo Valentin <eduardo.valentin at nokia.com>
> > ---
> >  sound/soc/omap/omap-pcm.c |   37 +++++++++++++++++++++++++++++++++++--
> >  1 files changed, 35 insertions(+), 2 deletions(-)
> > 
> > @@ -192,6 +203,12 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
> >  	case SNDRV_PCM_TRIGGER_RESUME:
> >  	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> >  		prtd->period_index = 0;
> > +		/* Configure McBSP internal buffer usage */
> > +		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> > +			omap_mcbsp_set_tx_threshold(bus_id, samples - 1);
> > +		else
> > +			omap_mcbsp_set_rx_threshold(bus_id, samples - 1);
> > +
> >  		omap_start_dma(prtd->dma_ch);
> >  		break;
> >  
> Oops, didn't notice this before. This will hard glue the DMA and McBSP
> together. Even currently there is only McBSP based DAI link driver,
> there can be others as well. EAC DAI for OMAP2420 would be necessary
> for instance if one wants to develop ASoC support for Nokia N800. Nokia
> N810 could use that too.

True. And the same comment is valid for the patch which adds op mode selection.
My idea to un-glue them is to put some callbacks in omap_mcbsp_data of omap-mcbsp.c,
and share it as something more generic, so that they can be called from omap-pcm.c.

Something like:

struct omap_dma_data {
	unsigned int			bus_id;
	unsigned int			fmt;
	/*
	 * Flags indicating is the bus already activated and configured by
	 * another substream
	 */
	int				active;
	int				configured;
	/* threshold callbacks can be added then here */
	void				*data; /* struct omap_mcbsp_reg_cfg	regs; can go here */
};

And this goes in omap-pcm.h.

what do you think??

> 
> 
> -- 
> Jarkko

-- 
Eduardo Valentin
--
To unsubscribe from this list: send the line "unsubscribe alsa-devel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the Alsa-devel mailing list