Skip to contentSkip to conversation

ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls

PATCH Applied Axel Lin 4 participants 4 messages Oct 21, 2011 – Oct 22, 2011

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls

Ensure all mask bits are clear before setting new value.

---
I don't have this hardware, I'd appreciate if someone can test this patch.

Thanks,
Axel

 sound/soc/codecs/sgtl5000.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/sgtl5000.c +6 -6
index 32b5bbd..d15695d 100644
@@ -723,7 +723,9 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	snd_soc_update_bits(codec, SGTL5000_CHIP_I2S_CTRL, i2s_ctl, i2s_ctl);
+	snd_soc_update_bits(codec, SGTL5000_CHIP_I2S_CTRL,
+			    SGTL5000_I2S_DLEN_MASK | SGTL5000_I2S_SCLKFREQ_MASK,
+			    i2s_ctl);
 
 	return 0;
 }
@@ -1146,8 +1148,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
 		vag = (vag - SGTL5000_ANA_GND_BASE) / SGTL5000_ANA_GND_STP;
 
 	snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
-			vag << SGTL5000_ANA_GND_SHIFT,
-			vag << SGTL5000_ANA_GND_SHIFT);
+			SGTL5000_ANA_GND_MASK, vag << SGTL5000_ANA_GND_SHIFT);
 
 	/* set line out VAG to vddio / 2, in range (0.8v, 1.675v) */
 	vag = vddio / 2;
@@ -1161,9 +1162,8 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
 		    SGTL5000_LINE_OUT_GND_STP;
 
 	snd_soc_update_bits(codec, SGTL5000_CHIP_LINE_OUT_CTRL,
-			vag << SGTL5000_LINE_OUT_GND_SHIFT |
-			SGTL5000_LINE_OUT_CURRENT_360u <<
-				SGTL5000_LINE_OUT_CURRENT_SHIFT,
+			SGTL5000_LINE_OUT_CURRENT_MASK |
+			SGTL5000_LINE_OUT_GND_MASK,
 			vag << SGTL5000_LINE_OUT_GND_SHIFT |
 			SGTL5000_LINE_OUT_CURRENT_360u <<
 				SGTL5000_LINE_OUT_CURRENT_SHIFT);
Signature · 1 line
1.7.5.4
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Axel Lin
Sent: Friday, October 21, 2011 9:55 AM
To: [email protected]
Cc: Dong Aisheng-B29396; Wolfram Sang; Liam Girdwood; Mark Brown; alsa- [email protected]
Subject: [PATCH] ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls

Ensure all mask bits are clear before setting new value.

Quoted 8 lines

---
I don't have this hardware, I'd appreciate if someone can test this patch.

Thanks,
Axel

 sound/soc/codecs/sgtl5000.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

It runs ok at my side.

Quoted 46 lines
sound/soc/codecs/sgtl5000.c +3 -1
index 32b5bbd..d15695d 100644
@@ -723,7 +723,9 @@ static int sgtl5000_pcm_hw_params(struct
 snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	snd_soc_update_bits(codec, SGTL5000_CHIP_I2S_CTRL, i2s_ctl,
 i2s_ctl);
+	snd_soc_update_bits(codec, SGTL5000_CHIP_I2S_CTRL,
+			    SGTL5000_I2S_DLEN_MASK | SGTL5000_I2S_SCLKFREQ_MASK,
+			    i2s_ctl);
 
sound/soc/codecs/sgtl5000.c +1 -2
 	return 0;
 }
@@ -1146,8 +1148,7 @@ static int sgtl5000_set_power_regs(struct
 snd_soc_codec *codec)
 		vag = (vag - SGTL5000_ANA_GND_BASE) / SGTL5000_ANA_GND_STP;
 
 	snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
-			vag << SGTL5000_ANA_GND_SHIFT,
-			vag << SGTL5000_ANA_GND_SHIFT);
+			SGTL5000_ANA_GND_MASK, vag << SGTL5000_ANA_GND_SHIFT);
 
 	/* set line out VAG to vddio / 2, in range (0.8v, 1.675v) */
sound/soc/codecs/sgtl5000.c +2 -3
 	vag = vddio / 2;
@@ -1161,9 +1162,8 @@ static int sgtl5000_set_power_regs(struct
 snd_soc_codec *codec)
 		    SGTL5000_LINE_OUT_GND_STP;
 
 	snd_soc_update_bits(codec, SGTL5000_CHIP_LINE_OUT_CTRL,
-			vag << SGTL5000_LINE_OUT_GND_SHIFT |
-			SGTL5000_LINE_OUT_CURRENT_360u <<
-				SGTL5000_LINE_OUT_CURRENT_SHIFT,
+			SGTL5000_LINE_OUT_CURRENT_MASK |
+			SGTL5000_LINE_OUT_GND_MASK,
 			vag << SGTL5000_LINE_OUT_GND_SHIFT |
 			SGTL5000_LINE_OUT_CURRENT_360u <<

SGTL5000_LINE_OUT_CURRENT_SHIFT);
--
1.7.5.4

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#2 lore raw
Quoted 16 lines · On 21 October 2011 08:36, Dong Aisheng-B29396 <[email protected]> wrote:
Quoted 16 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Axel Lin
Sent: Friday, October 21, 2011 9:55 AM
To: [email protected]
Cc: Dong Aisheng-B29396; Wolfram Sang; Liam Girdwood; Mark Brown; alsa- [email protected]
Subject: [PATCH] ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls

Ensure all mask bits are clear before setting new value.

---
I don't have this hardware, I'd appreciate if someone can test this patch.

Quoted 8 lines
Quoted 4 lines

Thanks,
Axel
 sound/soc/codecs/sgtl5000.c |   12 ++++++------

 1 files changed, 6 insertions(+), 6 deletions(-)

It runs ok at my side.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel