diff mbox series

ASoC: ak5558: Remove redundant snd_soc_component_read32 calls

Message ID 20181106093919.20740-1-axel.lin@ingics.com (mailing list archive)
State Accepted
Commit 39dfdf00c7a56b2a8c01c596f6522f089428b1c7
Headers show
Series ASoC: ak5558: Remove redundant snd_soc_component_read32 calls | expand

Commit Message

Axel Lin Nov. 6, 2018, 9:39 a.m. UTC
snd_soc_component_update_bits() will only update the mask bits,
so remove the redundant snd_soc_component_read32().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/ak5558.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

Comments

Daniel Baluta Nov. 6, 2018, 9:47 a.m. UTC | #1
On Ma, 2018-11-06 at 17:39 +0800, Axel Lin wrote:
> snd_soc_component_update_bits() will only update the mask bits,
> so remove the redundant snd_soc_component_read32().
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Thanks Axel! 

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
diff mbox series

Patch

diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c
index 60f1f12c81ea..8179512129d3 100644
--- a/sound/soc/codecs/ak5558.c
+++ b/sound/soc/codecs/ak5558.c
@@ -130,16 +130,12 @@  static int ak5558_hw_params(struct snd_pcm_substream *substream,
 	u8 bits;
 	int pcm_width = max(params_physical_width(params), ak5558->slot_width);
 
-	/* set master/slave audio interface */
-	bits = snd_soc_component_read32(component, AK5558_02_CONTROL1);
-	bits &= ~AK5558_BITS;
-
 	switch (pcm_width) {
 	case 16:
-		bits |= AK5558_DIF_24BIT_MODE;
+		bits = AK5558_DIF_24BIT_MODE;
 		break;
 	case 32:
-		bits |= AK5558_DIF_32BIT_MODE;
+		bits = AK5558_DIF_32BIT_MODE;
 		break;
 	default:
 		return -EINVAL;
@@ -168,18 +164,15 @@  static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	}
 
 	/* set master/slave audio interface */
-	format = snd_soc_component_read32(component, AK5558_02_CONTROL1);
-	format &= ~AK5558_DIF;
-
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
-		format |= AK5558_DIF_I2S_MODE;
+		format = AK5558_DIF_I2S_MODE;
 		break;
 	case SND_SOC_DAIFMT_LEFT_J:
-		format |= AK5558_DIF_MSB_MODE;
+		format = AK5558_DIF_MSB_MODE;
 		break;
 	case SND_SOC_DAIFMT_DSP_B:
-		format |= AK5558_DIF_MSB_MODE;
+		format = AK5558_DIF_MSB_MODE;
 		break;
 	default:
 		return -EINVAL;