[Sound-open-firmware] [RFC PATCH v2 4/8] dma: add API's to retrieve platform DMAC information

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Jun 7 16:50:58 CEST 2018


On Wed, 2018-06-06 at 16:09 -0700, Ranjani Sridharan wrote:
> This patch adds a couple of API's to retrieve platform DMAC
> information.
> 
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> ---
>  src/include/sof/dma.h         |  4 ++++
>  src/platform/apollolake/dma.c | 10 ++++++++++
>  src/platform/baytrail/dma.c   | 10 ++++++++++
>  src/platform/cannonlake/dma.c | 10 ++++++++++
>  src/platform/haswell/dma.c    | 10 ++++++++++
>  5 files changed, 44 insertions(+)
> 
> diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h
> index 2ae4225..8a6e645 100644
> --- a/src/include/sof/dma.h
> +++ b/src/include/sof/dma.h
> @@ -149,6 +149,10 @@ struct dma_int {
>  
>  struct dma *dma_get(int dmac_id);
>  
> +struct dma *get_platform_dmacs(void);
> +
> +int get_platform_num_dmacs(void);
> +
>  /* initialize all platform DMAC's */
>  void dmac_init(void);
>  
> diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c
> index f5e492c..396ad74 100644
> --- a/src/platform/apollolake/dma.c
> +++ b/src/platform/apollolake/dma.c
> @@ -203,3 +203,13 @@ void dmac_init(void)
>  			trace_error_value(ret);
>  	}
>  }
> +
> +struct dma *get_platform_dmacs(void)
> +{
> +	return &dma[0];
> +}
> +
> +int get_platform_num_dmacs(void)
> +{
> +	return ARRAY_SIZE(dma);
> +}

Can we just export struct dma *platform_dmac[PLATFORM_NUM_DMACS]; in
platform/dma.h ?


> diff --git a/src/platform/baytrail/dma.c b/src/platform/baytrail/dma.c
> index 95b836c..b05eaa6 100644
> --- a/src/platform/baytrail/dma.c
> +++ b/src/platform/baytrail/dma.c
> @@ -201,3 +201,13 @@ void dmac_init(void)
>  			trace_error_value(ret);
>  	}
>  }
> +
> +struct dma *get_platform_dmacs(void)
> +{
> +	return &dma[0];
> +}
> +
> +int get_platform_num_dmacs(void)
> +{
> +	return ARRAY_SIZE(dma);
> +}
> diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c
> index 1ad989f..49e2b71 100644
> --- a/src/platform/cannonlake/dma.c
> +++ b/src/platform/cannonlake/dma.c
> @@ -203,3 +203,13 @@ void dmac_init(void)
>  			trace_error_value(ret);
>  	}
>  }
> +
> +struct dma *get_platform_dmacs(void)
> +{
> +	return &dma[0];
> +}
> +
> +int get_platform_num_dmacs(void)
> +{
> +	return ARRAY_SIZE(dma);
> +}
> diff --git a/src/platform/haswell/dma.c b/src/platform/haswell/dma.c
> index ec48bc8..09f5f6b 100644
> --- a/src/platform/haswell/dma.c
> +++ b/src/platform/haswell/dma.c
> @@ -156,3 +156,13 @@ void dmac_init(void)
>  	io_reg_update_bits(SHIM_BASE + SHIM_IMRD,
>  			   SHIM_IMRD_DMAC1, 0);
>  }
> +
> +struct dma *get_platform_dmacs(void)
> +{
> +	return &dma[0];
> +}
> +
> +int get_platform_num_dmacs(void)
> +{
> +	return ARRAY_SIZE(dma);
> +}


More information about the Sound-open-firmware mailing list