[alsa-devel] [PATCH] ASoC: rt5670: add set_bclk_ratio in dai ops
Takashi Iwai
tiwai at suse.de
Tue Sep 12 09:13:50 CEST 2017
On Tue, 12 Sep 2017 08:20:05 +0200,
Bard Liao wrote:
>
> We need to set a specific bit for 50 bclk rate. So add set_bclk_ratio
> function to set the bit.
>
> Signed-off-by: Bard Liao <bardliao at realtek.com>
> ---
> sound/soc/codecs/rt5670.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
> index 9545764..dbdd01c 100644
> --- a/sound/soc/codecs/rt5670.c
> +++ b/sound/soc/codecs/rt5670.c
> @@ -2582,6 +2582,22 @@ static int rt5670_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
> return 0;
> }
>
> +static int rt5670_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
> +{
> + struct snd_soc_codec *codec = dai->codec;
> +
> + dev_dbg(codec->dev, "%s ratio=%d\n", __func__, ratio);
> + if (dai->id != RT5670_AIF1)
> + return 0;
> +
> + if (ratio == 50)
> + snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x0800, 0x0800);
> + else
> + snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x0800, 0x0);
Better to define some proper constant for 0x0800 bit.
thanks,
Takashi
More information about the Alsa-devel
mailing list