[Sound-open-firmware] [RFC PATCH 4/6] dma: use newly defined API for request DMAC

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Tue Jun 5 21:25:20 CEST 2018


On Tue, 2018-06-05 at 19:37 +0200, Marcin Maka wrote:
> On 6/5/2018 6:23 AM, Ranjani Sridharan wrote:
> >  #if !defined CONFIG_DMA_GW
> > -	hd->dma = dma_get(ipc_host->dmac_id);
> > +	/*
> > +	 * request DMAC with HOST_DMA user type, duplex copy
> > direction
> > +	 * and shared access flag
> > +	 */
> > +	hd->dma = dma_get(DMAC_USER_HOST_DMA, DMAC_DIR_DUPLEX,
> > +			  DMAC_FLAGS_SHARED);
> >  #else
> > -	if (ipc_host->direction == SOF_IPC_STREAM_PLAYBACK)
> > -		hd->dma = dma_get(DMA_HOST_OUT_DMAC);
> > -	else
> > -		hd->dma = dma_get(DMA_HOST_IN_DMAC);
> > +	if (ipc_host->direction == SOF_IPC_STREAM_PLAYBACK) {
> > +
> > +		/*
> > +		 * request DMAC with HOST_DMA user type, READ copy
> > direction
> > +		 * and shared access flag
> > +		 */
> > +		hd->dma = dma_get(DMAC_USER_HOST_DMA,
> > DMAC_DIR_READ,
> > +				  DMAC_FLAGS_SHARED);
> > +	} else {
> > +
> > +		/*
> > +		 * request DMAC with HOST_DMA user type, WRITE
> > copy direction
> > +		 * and shared access flag
> > +		 */
> > +		hd->dma = dma_get(DMAC_USER_HOST_DMA,
> > DMAC_DIR_WRITE,
> > +				  DMAC_FLAGS_SHARED);
> > +	}
> >  #endif
> 
> Is it possible to have a single implementation, the one inside #else
> that would
> call any dma_ops with either DMAC_DIR_READ or DMAC_DIR_WRITE
> depending on the
> direction? And remove #if-else-endif then.

Yes, Marcin. I just realized this #if-else-endif might not be needed
with the new changes. Thanks!
> 
> Marcin
> _______________________________________________
> Sound-open-firmware mailing list
> Sound-open-firmware at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware


More information about the Sound-open-firmware mailing list