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

Eduardo Valentin eduardo.valentin at nokia.com
Tue Aug 11 08:22:48 CEST 2009

On Tue, Aug 11, 2009 at 07:34:45AM +0200, ext Jarkko Nikula wrote:
> On Mon, 10 Aug 2009 11:53:55 +0300
> Eduardo Valentin <eduardo.valentin at nokia.com> wrote:
> > > 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.

Ok, I was wrong here. My point was to add new stuff in here:
struct omap_pcm_dma_data {
	char		*name;		/* stream identifier */
	int		dma_req;	/* DMA request line */
	unsigned long	port_addr;	/* transmit/receive register */

	/* additional things go here */

This one is already shared.

> > 
> > what do you think??
> > 
> I'm thinking is it just enough to share sync_mode between the
> omap-pcm.c and omap-mcbsp.c? For me it looks that both period_bytes_max
> (by using snd_pcm_hw_constraint_minmax) adjustment and threshold
> setting can be done in omap-mcbsp.c. Then there is no need to invent
> any callbacks to the omap_dma_data (for now) and omap-pcm.c remains
> cleanear as the threshold is not so much DMA programming specific.

True, that would become cleaner.

But, there are some points to re-think here. Max threshold value is
dependent on mcbsp instance (and possibly, on omap version as well,
if something change for next omap versions). The way max threshold is
implemented now, it comes first from board file, then you can query it
using new added function in this series.

So far nothing prevent us to move max threshold usage to omap-mcbsp.c.
But at open time, we add a restriction to make buffer size a multiple of
period size. And I think to properly make this, we need max threshold
value in advance, as we the idea is to bind periods with thresholds.

A similar issue may happen whilst setting current threshold value.
We want to set it before starting DMA. And that value must be bind to
chosen period size for that stream. In which place we can do that in omap-mcbsp.c?


> -- 
> 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