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

Marcin Maka marcin.maka at linux.intel.com
Tue Jun 5 19:37:50 CEST 2018


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.

Marcin


More information about the Sound-open-firmware mailing list