Patch "ASoC: ssm2602: Add workaround for playback distortions" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: ssm2602: Add workaround for playback distortions

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-ssm2602-add-workaround-for-playback-distortions.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 93c10d28eb3f11c2962c41102669152b83612e47
Author: Paweł Anikiel <pan@xxxxxxxxxxxx>
Date:   Mon May 8 13:30:37 2023 +0200

    ASoC: ssm2602: Add workaround for playback distortions
    
    [ Upstream commit f63550e2b165208a2f382afcaf5551df9569e1d4 ]
    
    Apply a workaround for what appears to be a hardware quirk.
    
    The problem seems to happen when enabling "whole chip power" (bit D7
    register R6) for the very first time after the chip receives power. If
    either "output" (D4) or "DAC" (D3) aren't powered on at that time,
    playback becomes very distorted later on.
    
    This happens on the Google Chameleon v3, as well as on a ZYBO Z7-10:
    https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
    I suspect this happens only when using an external MCLK signal (which
    is the case for both of these boards).
    
    Here are some experiments run on a Google Chameleon v3. These were run
    in userspace using a wrapper around the i2cset utility:
    ssmset() {
            i2cset -y 0 0x1a $(($1*2)) $2
    }
    
    For each of the following sequences, we apply power to the ssm2603
    chip, set the configuration registers R0-R5 and R7-R8, run the selected
    sequence, and check for distortions on playback.
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x87 # out, dac
      ssmset 0x06 0x07 # chip
      OK
    
      (disable MCLK)
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x1f # chip
      ssmset 0x06 0x07 # out, dac
      (enable MCLK)
      OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x1f # chip
      ssmset 0x06 0x07 # out, dac
      NOT OK
    
      ssmset 0x06 0x1f # chip
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # out, dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x0f # chip, out
      ssmset 0x06 0x07 # dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x17 # chip, dac
      ssmset 0x06 0x07 # out
      NOT OK
    
    For each of the following sequences, we apply power to the ssm2603
    chip, run the selected sequence, issue a reset with R15, configure
    R0-R5 and R7-R8, run one of the NOT OK sequences from above, and check
    for distortions.
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      OK
    
      (disable MCLK)
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      (enable MCLK after reset)
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x17 # chip, dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x0f # chip, out
      NOT OK
    
      ssmset 0x06 0x07 # chip, out, dac
      NOT OK
    
    Signed-off-by: Paweł Anikiel <pan@xxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20230508113037.137627-8-pan@xxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 5e80867d09ef7..256e5af6690b7 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -67,6 +67,18 @@ static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = {
 	{ .reg = 0x09, .def = 0x0000 }
 };
 
+/*
+ * ssm2602 register patch
+ * Workaround for playback distortions after power up: activates digital
+ * core, and then powers on output, DAC, and whole chip at the same time
+ */
+
+static const struct reg_sequence ssm2602_patch[] = {
+	{ SSM2602_ACTIVE, 0x01 },
+	{ SSM2602_PWR,    0x07 },
+	{ SSM2602_RESET,  0x00 },
+};
+
 
 /*Appending several "None"s just for OSS mixer use*/
 static const char *ssm2602_input_select[] = {
@@ -577,6 +589,9 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
 		return ret;
 	}
 
+	regmap_register_patch(ssm2602->regmap, ssm2602_patch,
+			      ARRAY_SIZE(ssm2602_patch));
+
 	/* set the update bits */
 	regmap_update_bits(ssm2602->regmap, SSM2602_LINVOL,
 			    LINVOL_LRIN_BOTH, LINVOL_LRIN_BOTH);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux