[PATCH 22/25] ASoC: soc-dai.c: use helper function

Amadeusz Sławiński amadeuszx.slawinski at linux.intel.com
Fri Jan 20 09:00:55 CET 2023


On 1/20/2023 8:03 AM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 
> Current ASoC has many helper function.
> This patch use it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
>   sound/soc/soc-dai.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
> index 29a75fdf90e0..e01b87ea04d4 100644
> --- a/sound/soc/soc-dai.c
> +++ b/sound/soc/soc-dai.c
> @@ -267,6 +267,11 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
>   			     int slots, int slot_width)
>   {
>   	int ret = -ENOTSUPP;
> +	int stream;
> +	unsigned int tdm_mask[] = {
> +		tx_mask,
> +		rx_mask,
> +	};
>   
>   	if (dai->driver->ops &&
>   	    dai->driver->ops->xlate_tdm_slot_mask)
> @@ -275,8 +280,8 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
>   	else
>   		snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
>   
> -	dai->tx_mask = tx_mask;
> -	dai->rx_mask = rx_mask;
> +	for_each_pcm_streams(stream)
> +		snd_soc_dai_tdm_mask_set(dai, stream, tdm_mask[stream]);

Does this work? There are functions earlier which modify the values of 
tx_mask/rx_mask and you copy their old values on tdm_mask[] init?

>   
>   	if (dai->driver->ops &&
>   	    dai->driver->ops->set_tdm_slot)



More information about the Alsa-devel mailing list