Skip to content

Commit f63550e

Browse files
Paweł Anikielbroonie
authored andcommitted
ASoC: ssm2602: Add workaround for playback distortions
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 <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]
1 parent efb2bfd commit f63550e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sound/soc/codecs/ssm2602.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = {
5353
{ .reg = 0x09, .def = 0x0000 }
5454
};
5555

56+
/*
57+
* ssm2602 register patch
58+
* Workaround for playback distortions after power up: activates digital
59+
* core, and then powers on output, DAC, and whole chip at the same time
60+
*/
61+
62+
static const struct reg_sequence ssm2602_patch[] = {
63+
{ SSM2602_ACTIVE, 0x01 },
64+
{ SSM2602_PWR, 0x07 },
65+
{ SSM2602_RESET, 0x00 },
66+
};
67+
5668

5769
/*Appending several "None"s just for OSS mixer use*/
5870
static const char *ssm2602_input_select[] = {
@@ -598,6 +610,9 @@ static int ssm260x_component_probe(struct snd_soc_component *component)
598610
return ret;
599611
}
600612

613+
regmap_register_patch(ssm2602->regmap, ssm2602_patch,
614+
ARRAY_SIZE(ssm2602_patch));
615+
601616
/* set the update bits */
602617
regmap_update_bits(ssm2602->regmap, SSM2602_LINVOL,
603618
LINVOL_LRIN_BOTH, LINVOL_LRIN_BOTH);

0 commit comments

Comments
 (0)