[alsa-devel] [PATCH 1/2] ASoC: rt5645: Prevent the weird sound of the headphone while rebooting
The patch adds the codec reset setting in the shutdown function to prevent the weird sound of the headphone happened by rebooting.
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index f436f50..4c4fe6b 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3517,6 +3517,8 @@ static void rt5645_i2c_shutdown(struct i2c_client *i2c) RT5645_CBJ_MN_JD); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, RT5645_CBJ_BST1_EN, 0); + msleep(20); + regmap_write(rt5645->regmap, RT5645_RESET, 0); }
static struct i2c_driver rt5645_i2c_driver = {
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- include/sound/rt5645.h | 1 + sound/soc/codecs/rt5645.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++- sound/soc/codecs/rt5645.h | 5 ++++ 3 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h index a5cf615..cf944e4 100644 --- a/include/sound/rt5645.h +++ b/include/sound/rt5645.h @@ -23,6 +23,7 @@ struct rt5645_platform_data { unsigned int jd_mode; /* Invert JD when jack insert */ bool jd_invert; + unsigned int eq_mode; };
#endif diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 4c4fe6b..907ba9e 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -224,6 +224,36 @@ static const struct reg_default rt5645_reg[] = { { 0xff, 0x6308 }, };
+struct rt5647_eq_parameter { + unsigned int reg; + unsigned int val; +}; + +#define EQ_REG_NUM 56 +struct hweq_s { + struct rt5647_eq_parameter par[EQ_REG_NUM]; + unsigned int ctrl; +}; + +static const struct hweq_s hweq_param[] = { + { /* EQ_NONE */ + { + {0, 0}, + }, + 0x0000, + }, + { /* EQ_GOOGLE_CELES */ + { + {0x1c0, 0x04b8}, + {0x1c1, 0xfd02}, + {0x1c2, 0x04b8}, + {0x1c3, 0xfd02}, + {0, 0}, + }, + 0x0020, + }, +}; + static const char *const rt5645_supply_names[] = { "avdd", "cpvdd", @@ -631,6 +661,26 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
}
+int rt5645_update_eqmode(struct snd_soc_codec *codec, unsigned int mode) +{ + struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); + unsigned int i; + + for (i = 0; i < EQ_REG_NUM; i++) { + if (hweq_param[mode].par[i].reg) + regmap_write(rt5645->regmap, + hweq_param[mode].par[i].reg, + hweq_param[mode].par[i].val); + else + break; + } + + snd_soc_update_bits(codec, RT5645_EQ_CTRL2, 0x33fe, + hweq_param[mode].ctrl); + + return 0; +} + /** * rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters * @codec: SoC audio codec device. @@ -1532,9 +1582,11 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, 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: + rt5645_update_eqmode(codec, rt5645->pdata.eq_mode); snd_soc_update_bits(codec, RT5645_PWR_DIG1, RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | RT5645_PWR_CLS_D_L, @@ -1543,6 +1595,7 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w, break;
case SND_SOC_DAPM_PRE_PMD: + rt5645_update_eqmode(codec, EQ_NONE); snd_soc_update_bits(codec, RT5645_PWR_DIG1, RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | RT5645_PWR_CLS_D_L, 0); @@ -3205,6 +3258,20 @@ static int strago_quirk_cb(const struct dmi_system_id *id) return 1; }
+static struct rt5645_platform_data celes_platform_data = { + .dmic1_data_pin = RT5645_DMIC1_DISABLE, + .dmic2_data_pin = RT5645_DMIC_DATA_IN2P, + .jd_mode = 3, + .eq_mode = EQ_GOOGLE_CELES, +}; + +static int celes_quirk_cb(const struct dmi_system_id *id) +{ + rt5645_pdata = &celes_platform_data; + + return 1; +} + static const struct dmi_system_id dmi_platform_intel_braswell[] = { { .ident = "Intel Strago", @@ -3215,7 +3282,7 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = { }, { .ident = "Google Celes", - .callback = strago_quirk_cb, + .callback = celes_quirk_cb, .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), }, diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h index 13ac732..89f25b8 100644 --- a/sound/soc/codecs/rt5645.h +++ b/sound/soc/codecs/rt5645.h @@ -2187,6 +2187,11 @@ enum { RT5645_AD_MONO_R_FILTER = (0x1 << 5), };
+enum { + EQ_NONE, + EQ_GOOGLE_CELES, +}; + int rt5645_sel_asrc_clk_src(struct snd_soc_codec *codec, unsigned int filter_mask, unsigned int clk_src);
Hi Oder,
[auto build test WARNING on next-20151002 -- if it's inappropriate base, please ignore]
reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
sound/soc/codecs/rt5645.c:664:5: sparse: symbol 'rt5645_update_eqmode' was not declared. Should it be static?
Please review and possibly fold the followup patch.
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
The patch
ASoC: rt5645: Prevent the weird sound of the headphone while rebooting
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 a2c026cfec3fb84375785dd2d6ec80bd60c5120e Mon Sep 17 00:00:00 2001
From: Oder Chiou oder_chiou@realtek.com Date: Mon, 5 Oct 2015 19:34:16 +0800 Subject: [PATCH] ASoC: rt5645: Prevent the weird sound of the headphone while rebooting
The patch adds the codec reset setting in the shutdown function to prevent the weird sound of the headphone happened by rebooting.
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 insertions(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 66b7332e..cd1a4ec 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3514,6 +3514,8 @@ static void rt5645_i2c_shutdown(struct i2c_client *i2c) RT5645_CBJ_MN_JD); regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, RT5645_CBJ_BST1_EN, 0); + msleep(20); + regmap_write(rt5645->regmap, RT5645_RESET, 0); }
static struct i2c_driver rt5645_i2c_driver = {
participants (3)
-
kbuild test robot
-
Mark Brown
-
Oder Chiou