[Sound-open-firmware] [RFC PATCH 1/6] platform: dma: consolidate dmac initialization

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Jun 5 11:14:29 CEST 2018


On Mon, 2018-06-04 at 21:23 -0700, Ranjani Sridharan wrote:
> This patch proposes to create a DMAC initialization routine in
> dma.c where it can access the platform DMAC definitions.
> 
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> ---
>  src/include/sof/dma.h              |  3 +++
>  src/platform/apollolake/dma.c      |  9 +++++++++
>  src/platform/apollolake/platform.c | 21 +--------------------
>  src/platform/baytrail/dma.c        |  9 +++++++++
>  src/platform/baytrail/platform.c   | 22 +---------------------
>  src/platform/cannonlake/dma.c      |  9 +++++++++
>  src/platform/cannonlake/platform.c | 21 +--------------------
>  src/platform/haswell/dma.c         |  9 +++++++++
>  src/platform/haswell/platform.c    | 16 +---------------
>  9 files changed, 43 insertions(+), 76 deletions(-)
> 
> diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h
> index 7ba1298..80ca880 100644
> --- a/src/include/sof/dma.h
> +++ b/src/include/sof/dma.h
> @@ -140,6 +140,9 @@ struct dma_int {
>  
>  struct dma *dma_get(int dmac_id);
>  
> +/* initialize all platform DMAC's */
> +void dmac_init(void);
> +
>  #define dma_set_drvdata(dma, data) \
>  	dma->private = data
>  #define dma_get_drvdata(dma) \
> diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c
> index 90dde96..001bb67 100644
> --- a/src/platform/apollolake/dma.c
> +++ b/src/platform/apollolake/dma.c
> @@ -181,3 +181,12 @@ struct dma *dma_get(int dmac_id)
>  
>  	return NULL;
>  }
> +
> +/* Initialize all platform DMAC's */
> +void dmac_init(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(dma); i++)
> +		dma_probe(&dma[i]);

Can you check for failure here and report it via trace_error. ditto for rest.

> 

Liam


More information about the Sound-open-firmware mailing list