[alsa-devel] [PATCH 1/5] ASoC: rt5645: Prevent the pop sound of the headphone while rebooting or shutdowning
Add i2c shutdown function to prevent the pop sound of the headphone while the system is rebooting or shutdowning
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index e5fef8f..4189d5a 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3490,13 +3490,23 @@ static int rt5645_i2c_remove(struct i2c_client *i2c) return 0; }
+static void rt5645_i2c_shutdown(struct i2c_client *i2c) +{ + struct rt5645_priv *rt5645 = i2c_get_clientdata(i2c); + + regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, 0x0020, 0x0020); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, 0x0000); +} + static struct i2c_driver rt5645_i2c_driver = { .driver = { .name = "rt5645", .acpi_match_table = ACPI_PTR(rt5645_acpi_match), }, .probe = rt5645_i2c_probe, - .remove = rt5645_i2c_remove, + .remove = rt5645_i2c_remove, + .shutdown = rt5645_i2c_shutdown, .id_table = rt5645_i2c_id, }; module_i2c_driver(rt5645_i2c_driver);
Remove the original calibration function and modify the depop and calibration function to prevent the pop sound in the booting time.
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 111 +++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 79 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 4189d5a..828afa2 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -254,6 +254,7 @@ struct rt5645_priv {
int jack_type; bool en_button_func; + bool hp_on; };
static int rt5645_reset(struct snd_soc_codec *codec) @@ -1364,15 +1365,23 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) if (on) { if (hp_amp_power_count <= 0) { if (rt5645->codec_type == CODEC_TYPE_RT5650) { + snd_soc_write(codec, RT5645_DEPOP_M2, 0x3100); snd_soc_write(codec, RT5645_CHARGE_PUMP, 0x0e06); - snd_soc_write(codec, RT5645_DEPOP_M1, 0x001d); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x000d); + regmap_write(rt5645->regmap, RT5645_PR_BASE + + RT5645_HP_DCC_INT1, 0x9f01); + msleep(20); + snd_soc_update_bits(codec, RT5645_DEPOP_M1, + RT5645_HP_CO_MASK, RT5645_HP_CO_EN); regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x3e, 0x7400); snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); + mdelay(5); + rt5645->hp_on = true; } else { /* depop parameters */ snd_soc_update_bits(codec, RT5645_DEPOP_M2, @@ -1586,6 +1595,27 @@ static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, return 0; }
+static int rt5650_hp_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *k, int event) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); + + switch (event) { + case SND_SOC_DAPM_POST_PMU: + if (rt5645->hp_on) { + msleep(100); + rt5645->hp_on = false; + } + break; + + default: + return 0; + } + + return 0; +} + static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, RT5645_PWR_LDO2_BIT, 0, NULL, 0), @@ -1870,6 +1900,7 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("PDM1R"), SND_SOC_DAPM_OUTPUT("SPOL"), SND_SOC_DAPM_OUTPUT("SPOR"), + SND_SOC_DAPM_POST("DAPM_POST", rt5650_hp_event), };
static const struct snd_soc_dapm_widget rt5645_specific_dapm_widgets[] = { @@ -2721,77 +2752,6 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, return 0; }
-static int rt5650_calibration(struct rt5645_priv *rt5645) -{ - int val, i; - int ret = -1; - - regcache_cache_bypass(rt5645->regmap, true); - regmap_write(rt5645->regmap, RT5645_RESET, 0); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL3, 0x0800); - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_CHOP_DAC_ADC, - 0x3600); - regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x25, 0x7000); - regmap_write(rt5645->regmap, RT5645_I2S1_SDP, 0x8008); - /* headset type */ - regmap_write(rt5645->regmap, RT5645_GEN_CTRL1, 0x2061); - regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0006); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG1, 0x2012); - regmap_write(rt5645->regmap, RT5645_PWR_MIXER, 0x0002); - regmap_write(rt5645->regmap, RT5645_PWR_VOL, 0x0020); - regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL1, 0x0006); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL2, 0x1827); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL2, 0x0827); - msleep(400); - /* Inline command */ - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0001); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD2, 0xc000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD1, 0x0008); - /* Calbration */ - regmap_write(rt5645->regmap, RT5645_GLB_CLK, 0x8000); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD2, 0xc000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD1, 0x0008); - regmap_write(rt5645->regmap, RT5645_PWR_DIG2, 0x8800); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG1, 0xe8fa); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG2, 0x8c04); - regmap_write(rt5645->regmap, RT5645_DEPOP_M2, 0x3100); - regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06); - regmap_write(rt5645->regmap, RT5645_BASS_BACK, 0x8a13); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL3, 0x0820); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x000d); - /* Power on and Calbration */ - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_HP_DCC_INT1, - 0x9f01); - msleep(200); - for (i = 0; i < 5; i++) { - regmap_read(rt5645->regmap, RT5645_PR_BASE + 0x7a, &val); - if (val != 0 && val != 0x3f3f) { - ret = 0; - break; - } - msleep(50); - } - pr_debug("%s: PR-7A = 0x%x\n", __func__, val); - - /* mute */ - regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x3e, 0x7400); - regmap_write(rt5645->regmap, RT5645_DEPOP_M3, 0x0737); - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_MAMP_INT_REG2, - 0xfc00); - regmap_write(rt5645->regmap, RT5645_DEPOP_M2, 0x1140); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0000); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL2, 0x4020); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG2, 0x0006); - regmap_write(rt5645->regmap, RT5645_PWR_DIG2, 0x0000); - msleep(350); - - regcache_cache_bypass(rt5645->regmap, false); - - return ret; -} - static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, bool enable) { @@ -3319,13 +3279,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, goto err_enable; }
- if (rt5645->codec_type == CODEC_TYPE_RT5650) { - ret = rt5650_calibration(rt5645); - - if (ret < 0) - pr_err("calibration failed!\n"); - } - regmap_write(rt5645->regmap, RT5645_RESET, 0);
ret = regmap_register_patch(rt5645->regmap, init_list,
The patch
ASoC: rt5645: Modify the headphone depop and calibration function to prevent the pop sound in the booting time
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 588cd850f5089cb63e031e8d70e9c081b0d97ab2 Mon Sep 17 00:00:00 2001
From: Oder Chiou oder_chiou@realtek.com Date: Mon, 24 Aug 2015 20:32:56 +0800 Subject: [PATCH] ASoC: rt5645: Modify the headphone depop and calibration function to prevent the pop sound in the booting time
Remove the original calibration function and modify the depop and calibration function to prevent the pop sound in the booting time.
Signed-off-by: Oder Chiou oder_chiou@realtek.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5645.c | 111 +++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 79 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 2ee42781cc52..ac2f42f4e3a0 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -254,6 +254,7 @@ struct rt5645_priv {
int jack_type; bool en_button_func; + bool hp_on; };
static int rt5645_reset(struct snd_soc_codec *codec) @@ -1364,15 +1365,23 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) if (on) { if (hp_amp_power_count <= 0) { if (rt5645->codec_type == CODEC_TYPE_RT5650) { + snd_soc_write(codec, RT5645_DEPOP_M2, 0x3100); snd_soc_write(codec, RT5645_CHARGE_PUMP, 0x0e06); - snd_soc_write(codec, RT5645_DEPOP_M1, 0x001d); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x000d); + regmap_write(rt5645->regmap, RT5645_PR_BASE + + RT5645_HP_DCC_INT1, 0x9f01); + msleep(20); + snd_soc_update_bits(codec, RT5645_DEPOP_M1, + RT5645_HP_CO_MASK, RT5645_HP_CO_EN); regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x3e, 0x7400); snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); + mdelay(5); + rt5645->hp_on = true; } else { /* depop parameters */ snd_soc_update_bits(codec, RT5645_DEPOP_M2, @@ -1586,6 +1595,27 @@ static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, return 0; }
+static int rt5650_hp_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *k, int event) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); + + switch (event) { + case SND_SOC_DAPM_POST_PMU: + if (rt5645->hp_on) { + msleep(100); + rt5645->hp_on = false; + } + break; + + default: + return 0; + } + + return 0; +} + static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, RT5645_PWR_LDO2_BIT, 0, NULL, 0), @@ -1870,6 +1900,7 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("PDM1R"), SND_SOC_DAPM_OUTPUT("SPOL"), SND_SOC_DAPM_OUTPUT("SPOR"), + SND_SOC_DAPM_POST("DAPM_POST", rt5650_hp_event), };
static const struct snd_soc_dapm_widget rt5645_specific_dapm_widgets[] = { @@ -2721,77 +2752,6 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, return 0; }
-static int rt5650_calibration(struct rt5645_priv *rt5645) -{ - int val, i; - int ret = -1; - - regcache_cache_bypass(rt5645->regmap, true); - regmap_write(rt5645->regmap, RT5645_RESET, 0); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL3, 0x0800); - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_CHOP_DAC_ADC, - 0x3600); - regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x25, 0x7000); - regmap_write(rt5645->regmap, RT5645_I2S1_SDP, 0x8008); - /* headset type */ - regmap_write(rt5645->regmap, RT5645_GEN_CTRL1, 0x2061); - regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0006); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG1, 0x2012); - regmap_write(rt5645->regmap, RT5645_PWR_MIXER, 0x0002); - regmap_write(rt5645->regmap, RT5645_PWR_VOL, 0x0020); - regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL1, 0x0006); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL2, 0x1827); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL2, 0x0827); - msleep(400); - /* Inline command */ - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0001); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD2, 0xc000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD1, 0x0008); - /* Calbration */ - regmap_write(rt5645->regmap, RT5645_GLB_CLK, 0x8000); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD2, 0xc000); - regmap_write(rt5645->regmap, RT5650_4BTN_IL_CMD1, 0x0008); - regmap_write(rt5645->regmap, RT5645_PWR_DIG2, 0x8800); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG1, 0xe8fa); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG2, 0x8c04); - regmap_write(rt5645->regmap, RT5645_DEPOP_M2, 0x3100); - regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06); - regmap_write(rt5645->regmap, RT5645_BASS_BACK, 0x8a13); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL3, 0x0820); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x000d); - /* Power on and Calbration */ - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_HP_DCC_INT1, - 0x9f01); - msleep(200); - for (i = 0; i < 5; i++) { - regmap_read(rt5645->regmap, RT5645_PR_BASE + 0x7a, &val); - if (val != 0 && val != 0x3f3f) { - ret = 0; - break; - } - msleep(50); - } - pr_debug("%s: PR-7A = 0x%x\n", __func__, val); - - /* mute */ - regmap_write(rt5645->regmap, RT5645_PR_BASE + 0x3e, 0x7400); - regmap_write(rt5645->regmap, RT5645_DEPOP_M3, 0x0737); - regmap_write(rt5645->regmap, RT5645_PR_BASE + RT5645_MAMP_INT_REG2, - 0xfc00); - regmap_write(rt5645->regmap, RT5645_DEPOP_M2, 0x1140); - regmap_write(rt5645->regmap, RT5645_DEPOP_M1, 0x0000); - regmap_write(rt5645->regmap, RT5645_GEN_CTRL2, 0x4020); - regmap_write(rt5645->regmap, RT5645_PWR_ANLG2, 0x0006); - regmap_write(rt5645->regmap, RT5645_PWR_DIG2, 0x0000); - msleep(350); - - regcache_cache_bypass(rt5645->regmap, false); - - return ret; -} - static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, bool enable) { @@ -3319,13 +3279,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, goto err_enable; }
- if (rt5645->codec_type == CODEC_TYPE_RT5650) { - ret = rt5650_calibration(rt5645); - - if (ret < 0) - pr_err("calibration failed!\n"); - } - regmap_write(rt5645->regmap, RT5645_RESET, 0);
ret = regmap_register_patch(rt5645->regmap, init_list,
The patch corrects the sequence of the jack detection. It will prevent the pop sound while the jack plug in.
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 828afa2..2c1b56b 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2805,14 +2805,15 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) }
regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL1, 0x0006); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, + 0x0004); msleep(100); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x0000);
- msleep(450); + msleep(600); regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); val &= 0x7; dev_dbg(codec->dev, "val = %d\n", val); @@ -2828,9 +2829,17 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) rt5645->jack_type = SND_JACK_HEADPHONE; }
+ snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x001d); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x0001); } else { /* jack out */ rt5645->jack_type = 0;
+ regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, + 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, + 0x0000); + if (rt5645->en_button_func) rt5645_enable_push_button_irq(codec, false);
The patch
ASoC: rt5645: Modify the jack detection function to prevent the pop sound while the jack plug in
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 8db7f56ddf2c4571e33756b70a1a8f492c050449 Mon Sep 17 00:00:00 2001
From: Oder Chiou oder_chiou@realtek.com Date: Mon, 24 Aug 2015 20:32:57 +0800 Subject: [PATCH] ASoC: rt5645: Modify the jack detection function to prevent the pop sound while the jack plug in
The patch corrects the sequence of the jack detection. It will prevent the pop sound while the jack plug in.
Signed-off-by: Oder Chiou oder_chiou@realtek.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5645.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index ac2f42f4e3a0..bcb44de002c9 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2805,14 +2805,15 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) }
regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0); - regmap_write(rt5645->regmap, RT5645_IN1_CTRL1, 0x0006); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, + 0x0004); msleep(100); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x0000);
- msleep(450); + msleep(600); regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); val &= 0x7; dev_dbg(codec->dev, "val = %d\n", val); @@ -2828,9 +2829,17 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) rt5645->jack_type = SND_JACK_HEADPHONE; }
+ snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x001d); + snd_soc_write(codec, RT5645_DEPOP_M1, 0x0001); } else { /* jack out */ rt5645->jack_type = 0;
+ regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, + 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, + 0x0000); + if (rt5645->en_button_func) rt5645_enable_push_button_irq(codec, false);
The patch removes the incorrect setting of the JD mode. It will cause pop sound in the booting time.
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 2c1b56b..53d5894 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3375,8 +3375,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, RT5645_IRQ_CLK_GATE_CTRL, RT5645_IRQ_CLK_GATE_CTRL); - regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, - RT5645_CBJ_BST1_EN, RT5645_CBJ_BST1_EN); regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, RT5645_IRQ_CLK_INT, RT5645_IRQ_CLK_INT); regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
The patch
ASoC: rt5645: Remove the incorrect setting of the JD mode
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 4aed4c9efb30253483869c58236ab00bdfa45630 Mon Sep 17 00:00:00 2001
From: Oder Chiou oder_chiou@realtek.com Date: Mon, 24 Aug 2015 20:32:58 +0800 Subject: [PATCH] ASoC: rt5645: Remove the incorrect setting of the JD mode
The patch removes the incorrect setting of the JD mode. It will cause pop sound in the booting time.
Signed-off-by: Oder Chiou oder_chiou@realtek.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5645.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index bcb44de002c9..d9f34421414e 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3373,8 +3373,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, RT5645_IRQ_CLK_GATE_CTRL, RT5645_IRQ_CLK_GATE_CTRL); - regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, - RT5645_CBJ_BST1_EN, RT5645_CBJ_BST1_EN); regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, RT5645_IRQ_CLK_INT, RT5645_IRQ_CLK_INT); regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 53d5894..4917057 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -394,6 +394,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) case RT5645_DEPOP_M1: case RT5645_DEPOP_M2: case RT5645_DEPOP_M3: + case RT5645_CHARGE_PUMP: case RT5645_MICBIAS: case RT5645_A_JD_CTRL1: case RT5645_VAD_CTRL4:
The patch
ASoC: rt5645: Add the register RT5645_CHARGE_PUMP to readable check function
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From b1d42598cb654ce63b55ccf27da09dcd914781f3 Mon Sep 17 00:00:00 2001
From: Oder Chiou oder_chiou@realtek.com Date: Mon, 24 Aug 2015 20:32:59 +0800 Subject: [PATCH] ASoC: rt5645: Add the register RT5645_CHARGE_PUMP to readable check function
Signed-off-by: Oder Chiou oder_chiou@realtek.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5645.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index d9f34421414e..0a4cb6bc3433 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -394,6 +394,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) case RT5645_DEPOP_M1: case RT5645_DEPOP_M2: case RT5645_DEPOP_M3: + case RT5645_CHARGE_PUMP: case RT5645_MICBIAS: case RT5645_A_JD_CTRL1: case RT5645_VAD_CTRL4:
On Mon, Aug 24, 2015 at 08:32:55PM +0800, Oder Chiou wrote:
Add i2c shutdown function to prevent the pop sound of the headphone while the system is rebooting or shutdowning
- regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, 0x0020, 0x0020);
- regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000);
- regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, 0x0000);
Yay, magic numbers! What is the issue this is fixing? The core is supposed to power everything down to _BIAS_OFF before exiting, are we missing something here?
-----Original Message----- From: Mark Brown [mailto:broonie@kernel.org] Sent: Wednesday, August 26, 2015 1:57 AM To: Oder Chiou Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org; Flove; Bard Liao; John Lin; woojoo.lee@samsung.com Subject: Re: [PATCH 1/5] ASoC: rt5645: Prevent the pop sound of the headphone while rebooting or shutdowning
On Mon, Aug 24, 2015 at 08:32:55PM +0800, Oder Chiou wrote:
Add i2c shutdown function to prevent the pop sound of the headphone while the system is rebooting or shutdowning
- regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, 0x0020, 0x0020);
- regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000);
- regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004,
+0x0000);
Yay, magic numbers! What is the issue this is fixing? The core is supposed to power everything down to _BIAS_OFF before exiting, are we missing something here?
It de-initialed our jack detection function, and it cannot be turned off in _BIAS_OFF. If we didn't de-initial it, we will hear the pop sound in the situation of powering off, thanks.
On Wed, Aug 26, 2015 at 02:17:40AM +0000, Oder Chiou wrote:
It de-initialed our jack detection function, and it cannot be turned off in _BIAS_OFF. If we didn't de-initial it, we will hear the pop sound in the situation of powering off, thanks.
OK, can you add a comment explaining what the register writes do (or ideally move to using #defines for the register values so it's obvious just from looking at the writes)?
participants (2)
-
Mark Brown
-
Oder Chiou