[Sound-open-firmware] [PATCH 16/25] volume: volume_params(): set the sink buffer params depending on its sink

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Feb 8 13:07:53 CET 2017


On Tue, 2017-02-07 at 22:03 +0800, Keyon Jie wrote:
> If its sink is host, we need set it to 16bit(hard coded ATM);
> if its sink is dai, we need set it to 32bit SSP format;
> otherwise, for internal component, we uses STREAM_FORMAT_S32_LE.
> 
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
>  src/audio/volume.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/src/audio/volume.c b/src/audio/volume.c
> index 24a9d11..ddab23b 100644
> --- a/src/audio/volume.c
> +++ b/src/audio/volume.c
> @@ -341,8 +341,26 @@ static void volume_free(struct comp_dev *dev)
>  /* set component audio stream paramters */
>  static int volume_params(struct comp_dev *dev, struct stream_params *params)
>  {
> +	struct stream_params sink_params = *params;
> +	struct comp_buffer *sink;
> +
> +	/* volume components will only ever have 1 source and 1 sink buffer */
> +	sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
> +
> +	/* hard coded now */

/* hard coded until new IPC is ready */ 

> +	if (sink->sink->is_host) {
> +		sink_params.pcm.format = STREAM_FORMAT_S16_LE;
> +		sink_params.frame_size = 2 * params->channels; /* 16bit container */
> +	} else if (sink->sink->is_dai) {
> +		sink_params.pcm.format = PLATFORM_SSP_STREAM_FORMAT;
> +		sink_params.frame_size = 4 * params->channels; /* 32bit container */
> +	} else {
> +		sink_params.pcm.format = STREAM_FORMAT_S32_LE;
> +		sink_params.frame_size = 4 * params->channels; /* 32bit container */
> +	}
> +
>  	/* dont do any data transformation */
> -	comp_set_sink_params(dev, params);
> +	comp_set_sink_params(dev, &sink_params);
>  
>  	return 0;
>  }




More information about the Sound-open-firmware mailing list