[Sound-open-firmware] [PATCH v2 6/7] dai: add stream_format to dai_data for codec stream

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Dec 22 12:31:17 CET 2016


On Thu, 2016-12-22 at 17:28 +0800, Keyon Jie wrote:
> add stream_format to indicate the stream format that the
> dai buffer is using.
> 
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
>  src/audio/dai.c                                   | 9 +++++++++
>  src/platform/baytrail/include/platform/platform.h | 3 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/src/audio/dai.c b/src/audio/dai.c
> index afa1be1..51ff093 100644
> --- a/src/audio/dai.c
> +++ b/src/audio/dai.c
> @@ -59,6 +59,7 @@ struct dai_data {
>  	struct dma_sg_config config;
>  
>  	int direction;
> +	uint32_t stream_format;
>  	struct dai *ssp;
>  	struct dma *dma;
>  
> @@ -162,6 +163,8 @@ static struct comp_dev *dai_new_ssp(uint32_t type, uint32_t index,
>  	if (dd->chan < 0)
>  		goto error;
>  
> +	dd->stream_format = PLATFORM_SSP_STREAM_FORMAT;
> +
>  	/* set up callback */
>  	//if (dd->ssp->plat_data.flags & DAI_FLAGS_IRQ_CB)
>  		dma_set_cb(dd->dma, dd->chan, DMA_IRQ_TYPE_LLIST, dai_dma_cb, dev);
> @@ -217,6 +220,9 @@ static int dai_playback_params(struct comp_dev *dev,
>  	dma_period_desc = &dma_buffer->desc.sink_period;
>  	dma_buffer->params = *params;
>  
> +	/* set it to dai stream format, for volume func correct mapping */
> +	dma_buffer->params.pcm.format = dd->stream_format;
> +
>  	if (list_is_empty(&config->elem_list)) {
>  		/* set up cyclic list of DMA elems */
>  		for (i = 0; i < dma_period_desc->number; i++) {
> @@ -275,6 +281,9 @@ static int dai_capture_params(struct comp_dev *dev,
>  	dma_period_desc = &dma_buffer->desc.source_period;
>  	dma_buffer->params = *params;
>  
> +	/* set it to dai stream format, for volume func correct mapping */
> +	dma_buffer->params.pcm.format = dd->stream_format;
> +
>  	if (list_is_empty(&config->elem_list)) {
>  		/* set up cyclic list of DMA elems */
>  		for (i = 0; i < dma_period_desc->number; i++) {
> diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h
> index bbf16d5..e8395a4 100644
> --- a/src/platform/baytrail/include/platform/platform.h
> +++ b/src/platform/baytrail/include/platform/platform.h
> @@ -38,6 +38,9 @@
>  /* default static pipeline SSP port - not used for dynamic pipes */
>  #define PLATFORM_SSP_PORT	2
>  
> +/* default SSP stream format - need aligned with codec setting*/
> +#define PLATFORM_SSP_STREAM_FORMAT	STREAM_FORMAT_S16_LE

24 bit ?

Again, we will revisit this once our IPC can pass this info.

> +
>  /* IPC Interrupt */
>  #define PLATFORM_IPC_INTERUPT	IRQ_NUM_EXT_IA
>  




More information about the Sound-open-firmware mailing list