ASoC: rt5682: remove jack detect delay
Subsystems (3)
PATCH 1/1 ASoC: rt5682: remove jack detect delay
There is a 250ms delay on the jack detect interrupt currently, this delay is observable to users who are using inline controls. It can also mask multiple presses which is a negative experience.
--- sound/soc/codecs/rt5682-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5682-i2c.c +1 -1
@@ -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,0 );return IRQ_HANDLED ; }
Signature · 1 line
2.30.0.478.g8a0d178c01-goog
Hello Realtek
+Arava, Jairaj <[email protected]>
Quoted 17 lines · Curtis Malainey
There is a 250ms delay on the jack detect interrupt currently, this delay is observable to users who are using inline controls. It can also mask multiple presses which is a negative experience.
Cc Bard liao <[email protected]>Cc Shuming Fan <[email protected]>Signed-off-by Curtis Malainey <[email protected]>--- sound/soc/codecs/rt5682-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/codecs/rt5682-i2c.c +0
-0
sound/soc/codecs/rt5682-i2c.c static irqreturn_t rt5682_irq(int irq, void *data) · line 83
Quoted 7 lines
sound/soc/codecs/rt5682-i2c.c +1
-1@@ -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,0 );
This change is posted to start a discussion as to the purpose of this delay, we are seeing noticeable UI delay and button masking. Is there an electro/mechanical purpose to it? If not I think I should post a V2 to remove the workqueue since this is a threaded irq. Please advise, thanks.
Quoted 6 lines
sound/soc/codecs/rt5682-i2c.c +0
-0return IRQ_HANDLED ;}
--
2.30.0.478.g8a0d178c01-goog
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · Shuming [范書銘]
Quoted 20 lines
There is a 250ms delay on the jack detect interrupt currently, this delay is observable to users who are using inline controls. It can also mask multiple presses which is a negative experience.
Cc Bard liao <[email protected]>Cc Shuming Fan <[email protected]>Signed-off-by Curtis Malainey <[email protected]>--- sound/soc/codecs/rt5682-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/codecs/rt5682-i2c.c +0
-0@@ -78,7 +78,7 @@ static irqreturn_t rt5682_irq(int irq, void *data)struct rt5682_priv *rt5682 = data;
Quoted 6 lines
sound/soc/codecs/rt5682-i2c.c static irqreturn_t rt5682_irq(int irq, void *data) · line 81
Quoted 3 lines
sound/soc/codecs/rt5682-i2c.c +1
-1mod_delayed_work (system_power_efficient_wq, - &rt5682->jack_detect_work,msecs_to_jiffies (250 )); + &rt5682->jack_detect_work,0 );How about using the device property to adjust the delay time?
I think it should keep the workqueue to do the jack/button detection because the jack type detection will take some times to do.
One might check twice (or more) if it's not certain, too. That is, check the jack immediately, and if the jack state really changed, report it so. OTOH, if the jack state doesn't change from the old state, it can retry after some delay.
thanks,
Takashi
Thanks Takashi and Shuming
Quoted 25 lines · Takashi Iwai
Quoted 2 lines · Shuming [范書銘]
Quoted 2 lines
There is a 250ms delay on the jack detect interrupt currently, this
delay is
Quoted 1 line
Quoted 1 line
observable to users who are using inline controls. It can also mask
multiple
Quoted 11 lines
Review
Quoted 11 lines
presses which is a negative experience.
Cc Bard liao <[email protected]>Cc Shuming Fan <[email protected]>Signed-off-by Curtis Malainey <[email protected]>--- sound/soc/codecs/rt5682-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/sound/soc/codecs/rt5682-i2c.cQuoted 6 lines
Quoted 6 lines
index
93c1603b42f1..b15c3e7d1f59100644sound/soc/codecs/rt5682-i2c.c +0
-0@@ -78,7 +78,7 @@ static irqreturn_t rt5682_irq(int irq, void *data)struct rt5682_priv *rt5682 = data;
Quoted 8 lines
Quoted 6 lines
sound/soc/codecs/rt5682-i2c.c static irqreturn_t rt5682_irq(int irq, void *data) · line 81
Quoted 3 lines
sound/soc/codecs/rt5682-i2c.c +1
-1mod_delayed_work (system_power_efficient_wq, - &rt5682->jack_detect_work,msecs_to_jiffies (250 )); + &rt5682->jack_detect_work,0 );How about using the device property to adjust the delay time? I think it should keep the workqueue to do the jack/button detection
because the jack type detection will take some times to do.
I am trying to understand the purpose of this delay currently, won't the press already be registered since we have an interrupt? Or does it need to stabilize? The reason is 250ms is well within human perception or even double tap time, which results in users possibly double tapping buttons but only seeing one press come through.
Quoted 6 lines
One might check twice (or more) if it's not certain, too. That is, check the jack immediately, and if the jack state really changed, report it so. OTOH, if the jack state doesn't change from the old state, it can retry after some delay.
I feel like this logic would cause more problems with fast presses unless the window was restricted down to sub 50ms.
Quoted 6 lines
thanks,
Takashi
Mark Brown
maintainerQuoted 5 lines · Curtis Malainey
I am trying to understand the purpose of this delay currently, won't the press already be registered since we have an interrupt? Or does it need to stabilize? The reason is 250ms is well within human perception or even double tap time, which results in users possibly double tapping buttons but only seeing one press come through.
It's quite common to have lots of issues with debounce on jacks, especially around insert/removal - it looks like this delay covers both insert/removal and button presses so it may well be needed for robust handling of the actual jack insert.
Quoted 10 lines · Mark Brown
Quoted 2 lines · Curtis Malainey
I am trying to understand the purpose of this delay currently, won't the press already be registered since we have an interrupt? Or does it
need
Quoted 2 lines
to stabilize? The reason is 250ms is well within human perception or even double tap time, which results in users possibly double tapping buttons
but
Quoted 1 line
only seeing one press come through.
Would a acceptable solution to everyone be
if inserted && buttonAction
respond now
else
run workqueue
Quoted 6 lines
It's quite common to have lots of issues with debounce on jacks, especially around insert/removal - it looks like this delay covers both insert/removal and button presses so it may well be needed for robust handling of the actual jack insert.
Mark Brown
maintainerQuoted 4 lines · Curtis Malainey
if inserted && buttonAction
respond now
else
run workqueue
Are you sure that *zero* debounce is needed for the button presses? 250ms does look like a lot of time but zero might be going from one extreme to the other.
Quoted 4 lines
Are you sure that *zero* debounce is needed for the button presses? 250ms does look like a lot of time but zero might be going from one extreme to the other.
Fair point, I was looking at some other codecs and why they respond so quickly, it appears they have no fixed delay and just call schedule work. That being said, I can easily double tap <100ms. So Ideally i would like to keep this on the order of ~50ms at most. I am guessing Realtek will want to keep the 250ms for jack detect still.
Would queueing two separate jobs with two different delays be the simple way to go? Realtek does this sound fine to you?
Curtis
Mark Brown
maintainerQuoted 9 lines · Curtis Malainey
Quoted 3 lines
Are you sure that *zero* debounce is needed for the button presses? 250ms does look like a lot of time but zero might be going from one extreme to the other.
Fair point, I was looking at some other codecs and why they respond so quickly, it appears they have no fixed delay and just call schedule work. That being said, I can easily double tap <100ms. So Ideally i would like to keep this on the order of ~50ms at most. I am guessing Realtek will want to keep the 250ms for jack detect still.
Those feel like plausible numbers to me assuming there's no hardware debounce.
Quoted 2 lines
Would queueing two separate jobs with two different delays be the simple way to go? Realtek does this sound fine to you?
Possibly just queuing the same job with different timeouts? I don't have particularly strong feelings assuming the resulting code make sense.
Quoted 7 lines
Quoted 3 lines
Would queueing two separate jobs with two different delays be the simple way to go? Realtek does this sound fine to you?
Possibly just queuing the same job with different timeouts? I don't have particularly strong feelings assuming the resulting code make sense.
And just track how we were last scheduled so we only check the correct thing? Sure that works too.