-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give users a chance to plug their headsets in #328
Conversation
The tip sense interrupt is quite trigger happy. There are instances where we kick off - and finish - headset detection before the user has had a chance to even finish plugging in the jack. This leads to misdetections, including detecting headsets as not having a microphone. The only way to fix this is to unplug the headset and plug it back in. Give the user 1.5 seconds to fully plug in their headset/headphones before running the headset/button detection logic. This reduces the chance of misdetections. Signed-off-by: James Calligeros <[email protected]>
Still works reliably. Makes up for some lost time due to new spurious connection handling. Signed-off-by: James Calligeros <[email protected]>
This should help address #294 |
@@ -840,6 +840,8 @@ static irqreturn_t cs42l84_irq_thread(int irq, void *data) | |||
cs42l84->plug_state = CS42L84_PLUG; | |||
dev_dbg(cs42l84->dev, "Plug event\n"); | |||
|
|||
/* Give the user time to fully seat the plug */ | |||
msleep(1500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please just increase the ring/tip sense debounce time in cs42l84_setup_plug_detect
instead. cs42l84 seems to use the same 3 bit linear scale from 0 to 1500ms. cl42l43 uses 500ms for ring sense debounce as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that. The issue is the timing after the interrupt is triggered and we try to detect what type of device is plugged in. You can still reliably reproduce the failure mode even with the long debounce because the issue is the time between detection starting and the plug being fully seated.
What we could do is shorten this delay and max out the debounce, but this delay is important to eliminate (or at least, materially reduce) the chance of misdetecting headsets as headphones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is something fundamentally wrong witht the jack detection. Aftyer actually trying this I can reproduce it but the increased delay only pampers over the the issue. The issue is that the detection routine is run when the plug is not fully seated. That detect headsets as Detected bare headphone (no mic)
. I would expect that there is a second irq once the jack is fully inserted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we only get interrupts on ring sense plug and unplug. I suppose tip sense plug and ing sense unplug would be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are only getting the interrupt on ring sense, then how is the plug detection even running? We set current_plug_status
based on the tip sense register only, and the detection logic only runs if tip sense says we're plugged in...
If tip sense isn't hit, then we would just clear the interrupt without doing anything right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind, that was the interrupt mask.
Looking at the not fully seated plug it's possible that the tip already makes contact. So maybe we would need to re-run hs_detect on ring sense irqs. I don't think any of the other cirrus jack codecs do that.
Superseded by #330 |
The trigger-happy tip sense interrupt fires off headset detection too fast. Sometimes, the jack might not be fully seated before it tries to figure out what is plugged in. This leads to misdetections.
Give the user a bunch of time to fully plug in their headset/headphones, and cut some of the existing delay out to make up that time.