All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event
@ 2021-03-09  8:58 shumingf
  2021-03-09 18:38 ` Curtis Malainey
  2021-03-09 19:06 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: shumingf @ 2021-03-09  8:58 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, cujomalainey,
	jairaj.arava, derek.fang, sathyanarayana.nujella, Shuming Fan,
	flove

From: Shuming Fan <shumingf@realtek.com>

This patch keeps the delay time (50 ms) for jack detection and zero delay time for the button press.
This patch improves the reaction of the button press.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt5682-i2c.c | 2 +-
 sound/soc/codecs/rt5682-sdw.c | 2 +-
 sound/soc/codecs/rt5682.c     | 2 ++
 sound/soc/codecs/rt5682.h     | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 93c1603b42f1..8ea9f1d9fec0 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -78,7 +78,7 @@ static irqreturn_t rt5682_irq(int irq, void *data)
 	struct rt5682_priv *rt5682 = data;
 
 	mod_delayed_work(system_power_efficient_wq,
-		&rt5682->jack_detect_work, msecs_to_jiffies(250));
+		&rt5682->jack_detect_work, msecs_to_jiffies(rt5682->irq_work_delay_time));
 
 	return IRQ_HANDLED;
 }
diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index 5e097f776561..fed80c8f994f 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -677,7 +677,7 @@ static int rt5682_interrupt_callback(struct sdw_slave *slave,
 
 	if (status->control_port & 0x4) {
 		mod_delayed_work(system_power_efficient_wq,
-			&rt5682->jack_detect_work, msecs_to_jiffies(250));
+			&rt5682->jack_detect_work, msecs_to_jiffies(rt5682->irq_work_delay_time));
 	}
 
 	return 0;
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 559dc6db1f7c..0e2a10ed11da 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -1094,6 +1094,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
 			/* jack was out, report jack type */
 			rt5682->jack_type =
 				rt5682_headset_detect(rt5682->component, 1);
+			rt5682->irq_work_delay_time = 0;
 		} else if ((rt5682->jack_type & SND_JACK_HEADSET) ==
 			SND_JACK_HEADSET) {
 			/* jack is already in, report button event */
@@ -1139,6 +1140,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
 	} else {
 		/* jack out */
 		rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
+		rt5682->irq_work_delay_time = 50;
 	}
 
 	snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
index 1f9c51a5b9bf..74ff66767016 100644
--- a/sound/soc/codecs/rt5682.h
+++ b/sound/soc/codecs/rt5682.h
@@ -1439,6 +1439,7 @@ struct rt5682_priv {
 	int pll_out[RT5682_PLLS];
 
 	int jack_type;
+	int irq_work_delay_time;
 };
 
 extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];
-- 
2.29.0


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

* Re: [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event
  2021-03-09  8:58 [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event shumingf
@ 2021-03-09 18:38 ` Curtis Malainey
  2021-03-09 19:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Curtis Malainey @ 2021-03-09 18:38 UTC (permalink / raw)
  To: Shuming Fan
  Cc: Oder Chiou, Jack Yu, ALSA development, Lars-Peter Clausen,
	Liam Girdwood, Mark Brown, Derek [方德義],
	Nujella, Sathyanarayana, Arava, Jairaj, Flove(HsinFu)

On Tue, Mar 9, 2021 at 12:58 AM <shumingf@realtek.com> wrote:
>
> From: Shuming Fan <shumingf@realtek.com>
>
> This patch keeps the delay time (50 ms) for jack detection and zero delay time for the button press.
> This patch improves the reaction of the button press.
>
> Signed-off-by: Shuming Fan <shumingf@realtek.com>

Thanks for fixing this up

Tested-by Curtis Malainey <cujomalainey@chromium.org>

> ---
>  sound/soc/codecs/rt5682-i2c.c | 2 +-
>  sound/soc/codecs/rt5682-sdw.c | 2 +-
>  sound/soc/codecs/rt5682.c     | 2 ++
>  sound/soc/codecs/rt5682.h     | 1 +
>  4 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
> index 93c1603b42f1..8ea9f1d9fec0 100644
> --- a/sound/soc/codecs/rt5682-i2c.c
> +++ b/sound/soc/codecs/rt5682-i2c.c
> @@ -78,7 +78,7 @@ static irqreturn_t rt5682_irq(int irq, void *data)
>         struct rt5682_priv *rt5682 = data;
>
>         mod_delayed_work(system_power_efficient_wq,
> -               &rt5682->jack_detect_work, msecs_to_jiffies(250));
> +               &rt5682->jack_detect_work, msecs_to_jiffies(rt5682->irq_work_delay_time));
>
>         return IRQ_HANDLED;
>  }
> diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
> index 5e097f776561..fed80c8f994f 100644
> --- a/sound/soc/codecs/rt5682-sdw.c
> +++ b/sound/soc/codecs/rt5682-sdw.c
> @@ -677,7 +677,7 @@ static int rt5682_interrupt_callback(struct sdw_slave *slave,
>
>         if (status->control_port & 0x4) {
>                 mod_delayed_work(system_power_efficient_wq,
> -                       &rt5682->jack_detect_work, msecs_to_jiffies(250));
> +                       &rt5682->jack_detect_work, msecs_to_jiffies(rt5682->irq_work_delay_time));
>         }
>
>         return 0;
> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
> index 559dc6db1f7c..0e2a10ed11da 100644
> --- a/sound/soc/codecs/rt5682.c
> +++ b/sound/soc/codecs/rt5682.c
> @@ -1094,6 +1094,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
>                         /* jack was out, report jack type */
>                         rt5682->jack_type =
>                                 rt5682_headset_detect(rt5682->component, 1);
> +                       rt5682->irq_work_delay_time = 0;
>                 } else if ((rt5682->jack_type & SND_JACK_HEADSET) ==
>                         SND_JACK_HEADSET) {
>                         /* jack is already in, report button event */
> @@ -1139,6 +1140,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
>         } else {
>                 /* jack out */
>                 rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
> +               rt5682->irq_work_delay_time = 50;
>         }
>
>         snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
> index 1f9c51a5b9bf..74ff66767016 100644
> --- a/sound/soc/codecs/rt5682.h
> +++ b/sound/soc/codecs/rt5682.h
> @@ -1439,6 +1439,7 @@ struct rt5682_priv {
>         int pll_out[RT5682_PLLS];
>
>         int jack_type;
> +       int irq_work_delay_time;
>  };
>
>  extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];
> --
> 2.29.0
>

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

* Re: [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event
  2021-03-09  8:58 [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event shumingf
  2021-03-09 18:38 ` Curtis Malainey
@ 2021-03-09 19:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-03-09 19:06 UTC (permalink / raw)
  To: lgirdwood, shumingf
  Cc: oder_chiou, jack.yu, alsa-devel, jairaj.arava, cujomalainey,
	lars, derek.fang, sathyanarayana.nujella, flove

On Tue, 9 Mar 2021 16:58:27 +0800, shumingf@realtek.com wrote:
> This patch keeps the delay time (50 ms) for jack detection and zero delay time for the button press.
> This patch improves the reaction of the button press.

Applied to

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

Thanks!

[1/1] ASoC: rt5682: add delay time of workqueue to control next IRQ event
      commit: 113e7a60209aa8b54255a21c0acfc5000753ffff

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

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

end of thread, other threads:[~2021-03-09 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  8:58 [PATCH] ASoC: rt5682: add delay time of workqueue to control next IRQ event shumingf
2021-03-09 18:38 ` Curtis Malainey
2021-03-09 19:06 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.