From 1bf367e0531eeac715166461e25ed1780d2dc209 Mon Sep 17 00:00:00 2001 From: Shuming Fan Date: Mon, 28 Oct 2019 17:26:53 +0800 Subject: [PATCH 1/3] ASoC: rt700: fix pop noise while stopping playback Signed-off-by: Shuming Fan --- sound/soc/codecs/rt700.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c index d110e4526409a9..73911494711f14 100644 --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -717,6 +717,7 @@ static int rt700_hpo_mux_event(struct snd_soc_dapm_widget *w, val_l = (1 << RT700_MUTE_SFT); regmap_write(rt700->regmap, RT700_SET_GAIN_HP_H, (val_h << 8 | val_l)); + usleep_range(50000, 55000); break; } return 0; From 8aac7db3b0c1e70f066ab63e19b0cb0e35708013 Mon Sep 17 00:00:00 2001 From: Shuming Fan Date: Mon, 28 Oct 2019 17:27:06 +0800 Subject: [PATCH 2/3] ASoC: rt711: fix pop noise while stopping playback Signed-off-by: Shuming Fan --- sound/soc/codecs/rt711.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c index 96f9fe21d9a469..19bd118ae6964d 100644 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -383,7 +383,8 @@ static void rt711_jack_init(struct rt711_priv *rt711) RT711_JD2_2PORT_200K_DECODE_HP | RT711_HP_JD_SEL_JD2); rt711_index_update_bits(rt711->regmap, RT711_VENDOR_REG, - RT711_CC_DET1, RT711_HP_JD_FINAL_RESULT_CTL_JD12, + RT711_CC_DET1, + RT711_HP_JD_FINAL_RESULT_CTL_JD12, RT711_HP_JD_FINAL_RESULT_CTL_JD12); break; default: @@ -741,12 +742,13 @@ static int rt711_dac_surround_event(struct snd_soc_dapm_widget *w, RT711_SET_GAIN_HP_H, (val_h << 8 | val_l)); break; case SND_SOC_DAPM_PRE_PMD: - regmap_write(rt711->regmap, - RT711_SET_STREAMID_DAC2, 0x00); - val_l = (1 << RT711_MUTE_SFT); regmap_write(rt711->regmap, RT711_SET_GAIN_HP_H, (val_h << 8 | val_l)); + usleep_range(50000, 55000); + + regmap_write(rt711->regmap, + RT711_SET_STREAMID_DAC2, 0x00); break; } return 0; From 4b13a096fdc3b161299761b56526c49a3dd9cacf Mon Sep 17 00:00:00 2001 From: Shuming Fan Date: Mon, 28 Oct 2019 17:27:21 +0800 Subject: [PATCH 3/3] ASoC: rt1308-sdw: fix DC offset loading from EFUSE and increase DAC volume Fix the PVDD DC calibration parameters doesn't be loaded correctly. The DAC volume gain adjusts to the 0xe7 value which HW AE suggests. Signed-off-by: Shuming Fan --- sound/soc/codecs/rt1308-sdw.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index fac0fa20843eac..96afc7aa8291d9 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -175,6 +175,8 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) { struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev); int ret = 0; + unsigned int efuse_m_btl_l, efuse_m_btl_r, tmp; + unsigned int efuse_c_btl_l, efuse_c_btl_r; if (rt1308->hw_init) return 0; @@ -209,7 +211,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) /* read efuse */ regmap_write(rt1308->regmap, 0xc360, 0x01); - regmap_write(rt1308->regmap, 0xc360, 0x80); + regmap_write(rt1308->regmap, 0xc361, 0x80); regmap_write(rt1308->regmap, 0xc7f0, 0x04); regmap_write(rt1308->regmap, 0xc7f1, 0xfe); msleep(100); @@ -217,6 +219,27 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) msleep(20); regmap_write(rt1308->regmap, 0xc240, 0x10); + regmap_read(rt1308->regmap, 0xc861, &tmp); + efuse_m_btl_l = tmp; + regmap_read(rt1308->regmap, 0xc860, &tmp); + efuse_m_btl_l = efuse_m_btl_l | (tmp << 8); + regmap_read(rt1308->regmap, 0xc863, &tmp); + efuse_c_btl_l = tmp; + regmap_read(rt1308->regmap, 0xc862, &tmp); + efuse_c_btl_l = efuse_c_btl_l | (tmp << 8); + regmap_read(rt1308->regmap, 0xc871, &tmp); + efuse_m_btl_r = tmp; + regmap_read(rt1308->regmap, 0xc870, &tmp); + efuse_m_btl_r = efuse_m_btl_r | (tmp << 8); + regmap_read(rt1308->regmap, 0xc873, &tmp); + efuse_c_btl_r = tmp; + regmap_read(rt1308->regmap, 0xc872, &tmp); + efuse_c_btl_r = efuse_c_btl_r | (tmp << 8); + dev_info(&slave->dev, "%s m_btl_l=0x%x, m_btl_r=0x%x\n", __func__, + efuse_m_btl_l, efuse_m_btl_r); + dev_info(&slave->dev, "%s c_btl_l=0x%x, c_btl_r=0x%x\n", __func__, + efuse_c_btl_l, efuse_c_btl_r); + /* initial settings */ regmap_write(rt1308->regmap, 0xc103, 0xc0); regmap_write(rt1308->regmap, 0xc030, 0x17); @@ -241,8 +264,8 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) regmap_write(rt1308->regmap, 0xc0a1, 0x71); regmap_write(rt1308->regmap, 0xc210, 0x00); regmap_write(rt1308->regmap, 0xc070, 0x00); - regmap_write(rt1308->regmap, 0xc100, 0xaf); - regmap_write(rt1308->regmap, 0xc101, 0xaf); + regmap_write(rt1308->regmap, 0xc100, 0xe7); + regmap_write(rt1308->regmap, 0xc101, 0xe7); regmap_write(rt1308->regmap, 0xc310, 0x24); /* Mark Slave initialization complete */