alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button
@ 2019-10-30  8:55 shumingf
  2019-10-30 13:59 ` Pierre-Louis Bossart
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: shumingf @ 2019-10-30  8:55 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, Shuming Fan, derek.fang,
	sathya.prakash.m.r, flove

From: Shuming Fan <shumingf@realtek.com>

The sensitivity could improve by decreasing the HW debounce time
and reduce the delay time of workequeue.
This patch added a device property for HW debounce time control.
We could change this value to tune the sensitivity of push button.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 include/sound/rt5682.h    |  1 +
 sound/soc/codecs/rt5682.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index bf2ee75aabb1..bc2c31734df1 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -31,6 +31,7 @@ struct rt5682_platform_data {
 	enum rt5682_dmic1_data_pin dmic1_data_pin;
 	enum rt5682_dmic1_clk_pin dmic1_clk_pin;
 	enum rt5682_jd_src jd_src;
+	unsigned int btndet_delay;
 };
 
 #endif
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index c50b75ce82e0..35dcec135c8a 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -44,6 +44,7 @@ static const struct rt5682_platform_data i2s_default_platform_data = {
 	.dmic1_data_pin = RT5682_DMIC1_DATA_GPIO2,
 	.dmic1_clk_pin = RT5682_DMIC1_CLK_GPIO3,
 	.jd_src = RT5682_JD1,
+	.btndet_delay = 16,
 };
 
 struct rt5682_priv {
@@ -1026,6 +1027,18 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
 		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
 			RT5682_JD1_EN_MASK | RT5682_JD1_POL_MASK,
 			RT5682_JD1_EN | RT5682_JD1_POL_NOR);
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_4,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_5,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_6,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_7,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
 		mod_delayed_work(system_power_efficient_wq,
 			   &rt5682->jack_detect_work, msecs_to_jiffies(250));
 		break;
@@ -2467,6 +2480,8 @@ static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 		&rt5682->pdata.dmic1_clk_pin);
 	device_property_read_u32(dev, "realtek,jd-src",
 		&rt5682->pdata.jd_src);
+	device_property_read_u32(dev, "realtek,btndet-delay",
+		&rt5682->pdata.btndet_delay);
 
 	rt5682->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
 		"realtek,ldo1-en-gpios", 0);
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button
  2019-10-30  8:55 [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button shumingf
@ 2019-10-30 13:59 ` Pierre-Louis Bossart
  2019-10-30 14:07 ` Mark Brown
  2019-10-30 14:16 ` [alsa-devel] Applied "ASoC: rt5682: improve the sensitivity of push button" to the asoc tree Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-30 13:59 UTC (permalink / raw)
  To: shumingf, broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, derek.fang,
	sathya.prakash.m.r, flove



On 10/30/19 3:55 AM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> The sensitivity could improve by decreasing the HW debounce time

could be improved

> and reduce the delay time of workequeue.

typo: work queue.

> This patch added a device property for HW debounce time control.
> We could change this value to tune the sensitivity of push button.

so for an Intel platform without DT, could we set this property in the 
machine driver as done for bytcr_rt5640/51?

> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> ---
>   include/sound/rt5682.h    |  1 +
>   sound/soc/codecs/rt5682.c | 15 +++++++++++++++
>   2 files changed, 16 insertions(+)
> 
> diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
> index bf2ee75aabb1..bc2c31734df1 100644
> --- a/include/sound/rt5682.h
> +++ b/include/sound/rt5682.h
> @@ -31,6 +31,7 @@ struct rt5682_platform_data {
>   	enum rt5682_dmic1_data_pin dmic1_data_pin;
>   	enum rt5682_dmic1_clk_pin dmic1_clk_pin;
>   	enum rt5682_jd_src jd_src;
> +	unsigned int btndet_delay;
>   };
>   
>   #endif
> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
> index c50b75ce82e0..35dcec135c8a 100644
> --- a/sound/soc/codecs/rt5682.c
> +++ b/sound/soc/codecs/rt5682.c
> @@ -44,6 +44,7 @@ static const struct rt5682_platform_data i2s_default_platform_data = {
>   	.dmic1_data_pin = RT5682_DMIC1_DATA_GPIO2,
>   	.dmic1_clk_pin = RT5682_DMIC1_CLK_GPIO3,
>   	.jd_src = RT5682_JD1,
> +	.btndet_delay = 16,
>   };
>   
>   struct rt5682_priv {
> @@ -1026,6 +1027,18 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
>   		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
>   			RT5682_JD1_EN_MASK | RT5682_JD1_POL_MASK,
>   			RT5682_JD1_EN | RT5682_JD1_POL_NOR);
> +		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_4,
> +			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
> +			rt5682->pdata.btndet_delay));
> +		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_5,
> +			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
> +			rt5682->pdata.btndet_delay));
> +		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_6,
> +			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
> +			rt5682->pdata.btndet_delay));
> +		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_7,
> +			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
> +			rt5682->pdata.btndet_delay));
>   		mod_delayed_work(system_power_efficient_wq,
>   			   &rt5682->jack_detect_work, msecs_to_jiffies(250));
>   		break;
> @@ -2467,6 +2480,8 @@ static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
>   		&rt5682->pdata.dmic1_clk_pin);
>   	device_property_read_u32(dev, "realtek,jd-src",
>   		&rt5682->pdata.jd_src);
> +	device_property_read_u32(dev, "realtek,btndet-delay",
> +		&rt5682->pdata.btndet_delay);
>   
>   	rt5682->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
>   		"realtek,ldo1-en-gpios", 0);
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button
  2019-10-30  8:55 [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button shumingf
  2019-10-30 13:59 ` Pierre-Louis Bossart
@ 2019-10-30 14:07 ` Mark Brown
  2019-10-30 14:16 ` [alsa-devel] Applied "ASoC: rt5682: improve the sensitivity of push button" to the asoc tree Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-10-30 14:07 UTC (permalink / raw)
  To: shumingf
  Cc: oder_chiou, jack.yu, alsa-devel, lars, lgirdwood, derek.fang,
	sathya.prakash.m.r, flove


[-- Attachment #1.1: Type: text/plain, Size: 218 bytes --]

On Wed, Oct 30, 2019 at 04:55:33PM +0800, shumingf@realtek.com wrote:

> +	device_property_read_u32(dev, "realtek,btndet-delay",
> +		&rt5682->pdata.btndet_delay);

This should have a matching binding document update.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [alsa-devel] Applied "ASoC: rt5682: improve the sensitivity of push button" to the asoc tree
  2019-10-30  8:55 [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button shumingf
  2019-10-30 13:59 ` Pierre-Louis Bossart
  2019-10-30 14:07 ` Mark Brown
@ 2019-10-30 14:16 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-10-30 14:16 UTC (permalink / raw)
  To: Shuming Fan
  Cc: oder_chiou, jack.yu, alsa-devel, lars, lgirdwood, Mark Brown,
	derek.fang, sathya.prakash.m.r, flove

The patch

   ASoC: rt5682: improve the sensitivity of push button

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5

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 e226445802cb2a51c3cb127fac31fba0a4330e87 Mon Sep 17 00:00:00 2001
From: Shuming Fan <shumingf@realtek.com>
Date: Wed, 30 Oct 2019 16:55:33 +0800
Subject: [PATCH] ASoC: rt5682: improve the sensitivity of push button

The sensitivity could improve by decreasing the HW debounce time
and reduce the delay time of workequeue.
This patch added a device property for HW debounce time control.
We could change this value to tune the sensitivity of push button.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191030085533.14299-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/rt5682.h    |  1 +
 sound/soc/codecs/rt5682.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index bf2ee75aabb1..bc2c31734df1 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -31,6 +31,7 @@ struct rt5682_platform_data {
 	enum rt5682_dmic1_data_pin dmic1_data_pin;
 	enum rt5682_dmic1_clk_pin dmic1_clk_pin;
 	enum rt5682_jd_src jd_src;
+	unsigned int btndet_delay;
 };
 
 #endif
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index c50b75ce82e0..35dcec135c8a 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -44,6 +44,7 @@ static const struct rt5682_platform_data i2s_default_platform_data = {
 	.dmic1_data_pin = RT5682_DMIC1_DATA_GPIO2,
 	.dmic1_clk_pin = RT5682_DMIC1_CLK_GPIO3,
 	.jd_src = RT5682_JD1,
+	.btndet_delay = 16,
 };
 
 struct rt5682_priv {
@@ -1026,6 +1027,18 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
 		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
 			RT5682_JD1_EN_MASK | RT5682_JD1_POL_MASK,
 			RT5682_JD1_EN | RT5682_JD1_POL_NOR);
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_4,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_5,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_6,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
+		regmap_update_bits(rt5682->regmap, RT5682_4BTN_IL_CMD_7,
+			0x7f7f, (rt5682->pdata.btndet_delay << 8 |
+			rt5682->pdata.btndet_delay));
 		mod_delayed_work(system_power_efficient_wq,
 			   &rt5682->jack_detect_work, msecs_to_jiffies(250));
 		break;
@@ -2467,6 +2480,8 @@ static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 		&rt5682->pdata.dmic1_clk_pin);
 	device_property_read_u32(dev, "realtek,jd-src",
 		&rt5682->pdata.jd_src);
+	device_property_read_u32(dev, "realtek,btndet-delay",
+		&rt5682->pdata.btndet_delay);
 
 	rt5682->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
 		"realtek,ldo1-en-gpios", 0);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-30 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30  8:55 [alsa-devel] [PATCH 1/3] ASoC: rt5682: improve the sensitivity of push button shumingf
2019-10-30 13:59 ` Pierre-Louis Bossart
2019-10-30 14:07 ` Mark Brown
2019-10-30 14:16 ` [alsa-devel] Applied "ASoC: rt5682: improve the sensitivity of push button" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).