[Sound-open-firmware] [PATCH] ASoC: SOF: topology: add handle to buffer type

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Jan 30 21:24:46 CET 2018


On Tue, 2018-01-30 at 15:29 +0800, Keyon Jie wrote:
> Align with SOFT topology and SOF, add handle to buffer type.
> 
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
>  include/uapi/sound/sof-ipc.h      | 7 +++++++
>  include/uapi/sound/sof-topology.h | 1 +
>  sound/soc/sof/topology.c          | 6 ++++--
>  3 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof-
> ipc.h
> index 741b412545b7..9a81896780ba 100644
> --- a/include/uapi/sound/sof-ipc.h
> +++ b/include/uapi/sound/sof-ipc.h
> @@ -521,10 +521,17 @@ struct sof_ipc_comp {
>   * Component Buffers
>   */
>  
> +/* types of buffer */
> +enum sof_buffer_type {
> +	SOF_BUFF_GENERAL = 0,
> +	SOF_BUFF_DMA = 1, /* dma buffer */

This type probably wont just be restricted to buffers so needs to
describe different memories in more detail.

enum sof_ipc_memory_type {

SOF_MEM_RAM = 0,
SOF_MEM_RAM_HP,
SOF_MEM_RAM_LP,
SOF_MEM_RAM_EXT

plus more in future

> +};
> +
>  /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
>  struct sof_ipc_buffer {
>  	struct sof_ipc_comp comp;
>  	uint32_t size;		/* buffer size in bytes */
> +	enum sof_buffer_type type;  /* buffer type */
>  } __attribute__((packed));
>  
>  
> diff --git a/include/uapi/sound/sof-topology.h
> b/include/uapi/sound/sof-topology.h
> index 6fe695c46386..e855ef48fd1a 100644
> --- a/include/uapi/sound/sof-topology.h
> +++ b/include/uapi/sound/sof-topology.h
> @@ -33,6 +33,7 @@
>  
>  /* buffers */
>  #define SOF_TKN_BUF_SIZE	 		100
> +#define SOF_TKN_BUF_TYPE			101
>  
>  /* DAI */
>  #define SOF_TKN_DAI_DMAC 			151
> diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
> index 2d813335f3d2..3f2e9d72fba5 100644
> --- a/sound/soc/sof/topology.c
> +++ b/sound/soc/sof/topology.c
> @@ -150,6 +150,8 @@ static int get_token_dai_type(void *elem ,void
> *object, u32 offset, u32 size)
>  static const struct sof_topology_token buffer_tokens[] = {
>  	{SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
> get_token_u32,
>  		offsetof(struct sof_ipc_buffer, size), 0},
> +	{SOF_TKN_BUF_TYPE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
> get_token_u32,
> +		offsetof(struct sof_ipc_buffer, type), 0},
>  };
>  
>  /* DAI */
> @@ -554,8 +556,8 @@ static int sof_widget_load_buffer(struct
> snd_soc_component *scomp, int index,
>  	sof_parse_tokens(scomp, &buffer, buffer_tokens,
>  		ARRAY_SIZE(buffer_tokens), private->array, private-
> >size);
>  
> -	dev_dbg(sdev->dev, "buffer %s: size %d\n",
> -		swidget->widget->name, buffer.size);
> +	dev_dbg(sdev->dev, "buffer %s: size %d, type %d\n",
> +		swidget->widget->name, buffer.size, buffer.type);
>  
>  	return sof_ipc_tx_message(sdev->ipc,
>  		buffer.comp.hdr.cmd, &buffer, sizeof(buffer), r,
> sizeof(*r));


More information about the Sound-open-firmware mailing list