diff mbox

ASoC: ssm4567: Keep TDM_BCLKS in ssm4567_set_dai_fmt

Message ID 1437515186-1961-1-git-send-email-benzh@chromium.org (mailing list archive)
State Accepted
Commit a6c2a32ac83567f15e9af3dcbc73148ce68b2ced
Headers show

Commit Message

Ben Zhang July 21, 2015, 9:46 p.m. UTC
The regmap_write in ssm4567_set_dai_fmt accidentally clears the
TDM_BCLKS field which was set earlier by ssm4567_set_tdm_slot.

This patch fixes it by using regmap_update_bits with proper mask.

Signed-off-by: Ben Zhang <benzh@chromium.org>
---
 sound/soc/codecs/ssm4567.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Lars-Peter Clausen July 21, 2015, 9:49 p.m. UTC | #1
On 07/21/2015 11:46 PM, Ben Zhang wrote:
> The regmap_write in ssm4567_set_dai_fmt accidentally clears the
> TDM_BCLKS field which was set earlier by ssm4567_set_tdm_slot.
>
> This patch fixes it by using regmap_update_bits with proper mask.
>
> Signed-off-by: Ben Zhang <benzh@chromium.org>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

Thanks.

> ---
>   sound/soc/codecs/ssm4567.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
> index 4662587..a757ab8 100644
> --- a/sound/soc/codecs/ssm4567.c
> +++ b/sound/soc/codecs/ssm4567.c
> @@ -315,7 +315,13 @@ static int ssm4567_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
>   	if (invert_fclk)
>   		ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC;
>
> -	return regmap_write(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1, ctrl1);
> +	return regmap_update_bits(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
> +			SSM4567_SAI_CTRL_1_BCLK |
> +			SSM4567_SAI_CTRL_1_FSYNC |
> +			SSM4567_SAI_CTRL_1_LJ |
> +			SSM4567_SAI_CTRL_1_TDM |
> +			SSM4567_SAI_CTRL_1_PDM,
> +			ctrl1);
>   }
>
>   static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
>
Anatol Pomozov July 21, 2015, 10:02 p.m. UTC | #2
Hi

On Tue, Jul 21, 2015 at 2:49 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> On 07/21/2015 11:46 PM, Ben Zhang wrote:
>>
>> The regmap_write in ssm4567_set_dai_fmt accidentally clears the
>> TDM_BCLKS field which was set earlier by ssm4567_set_tdm_slot.
>>
>> This patch fixes it by using regmap_update_bits with proper mask.
>>
>> Signed-off-by: Ben Zhang <benzh@chromium.org>
>
>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>

Acked-by: Anatol Pomozov <anatol.pomozov@gmail.com>

>
> Thanks.
>
>> ---
>>   sound/soc/codecs/ssm4567.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
>> index 4662587..a757ab8 100644
>> --- a/sound/soc/codecs/ssm4567.c
>> +++ b/sound/soc/codecs/ssm4567.c
>> @@ -315,7 +315,13 @@ static int ssm4567_set_dai_fmt(struct snd_soc_dai
>> *dai, unsigned int fmt)
>>         if (invert_fclk)
>>                 ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC;
>>
>> -       return regmap_write(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
>> ctrl1);
>> +       return regmap_update_bits(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
>> +                       SSM4567_SAI_CTRL_1_BCLK |
>> +                       SSM4567_SAI_CTRL_1_FSYNC |
>> +                       SSM4567_SAI_CTRL_1_LJ |
>> +                       SSM4567_SAI_CTRL_1_TDM |
>> +                       SSM4567_SAI_CTRL_1_PDM,
>> +                       ctrl1);
>>   }
>>
>>   static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
>>
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff mbox

Patch

diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
index 4662587..a757ab8 100644
--- a/sound/soc/codecs/ssm4567.c
+++ b/sound/soc/codecs/ssm4567.c
@@ -315,7 +315,13 @@  static int ssm4567_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	if (invert_fclk)
 		ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC;
 
-	return regmap_write(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1, ctrl1);
+	return regmap_update_bits(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
+			SSM4567_SAI_CTRL_1_BCLK |
+			SSM4567_SAI_CTRL_1_FSYNC |
+			SSM4567_SAI_CTRL_1_LJ |
+			SSM4567_SAI_CTRL_1_TDM |
+			SSM4567_SAI_CTRL_1_PDM,
+			ctrl1);
 }
 
 static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)