Spurious headphone detection interrupts
A few extra interrupts here and there for this (causing minor polling) aren't objectionable in my opinion. But I agree that all of this is strange. I didn't check with music playing. But with no audio, detection is always 1 interrupt plugging in, 1 unplugging. If I get a chance I'll have to check with audio.

I don't see either, how detection even works. I can hardly believe that the GPIO input would work reliably with audio or no audio. The only thing that makes sense to me is either a DC bias, or an ultrasonic background signal, both of which are very problematic. Based on what you're reporting though, DC bias whenever there's no audio seems plausible, though irresponsible!
I agree, having a few extra interrupts on anything that's related to electromechanical stuff is rather acceptable.  In the end, no debouncing is 100% perfect, at least not all the time.  However, the overall behavior is really strange.

Could it be that the analog switch used in the PineBook Pro to switch between the serial console and the headphones jack is experiencing the same issues as the another analog switch used for the same purpose in the PinePhone?
I suppose it's possible. I was going to recommend switching it and seeing what happens. Maybe you'll randomly end up in DDB Smile
If the PineBook Pro's analog switch IC works (i.e., misbehaves) similarly to the one in PinePhone, that would actually be the source of DC bias on the headphones jack.  Furthermore, that might actually be the reason why the headphones detection works at all, or at least why it works when there's no music playback.

I would really like to have a few other PineBook Pro owners to check the interrupt counts and post their results here.  If we confirm this as a hardware issue, we can add it to the wishlist for the next PineBook Pro revision.
I confirmed that stereo separation exists on my wife's PBP.

Her headphones aren't marked LEFT and RIGHT so I couldn't confirm proper channels. I also had one heck of a time finding audio specifically for testing this which wasn't in *mono*. Good grief.

So I'd say something is amiss with your headphone jack. Though of course please make sure to rule out software.
Thank you very much for checking!  I'll try playing with the ALSA mixer settings, and see if that affects the separation of left and right headphone channels.  I'll also try different headphones, it's worth a try.

By the way, I've used this YouTube video for testing.
Yep that's what I ended up using. The music is annoying but it works. I'll have to make my own test again one of these days.
Regarding the lack of separation beween the left and right channels, it was up to the ALSA mixer setting named "DAC Stereo Enhancement", which defaulted to 100%.  Apparently, this setting was implemented to allow better support for ES8316-equipped devices that have a single speaker.

With this setting at 0%, there's zero "mirroring" of the left channel to the right channel and vice versa, and at 100% there's almost complete "mirroring" between the channels.  Having it at anything over 0% produces somewhat "fuller" sound, but the sound image becomes very distorted, which can be appreciated only when comparing the effects of 0% and 100% directly.

The above-described behavior applies to both the built-in speakers and the headphones, but it was much less noticable when using speakers.  By the way, speaker-test is a very useful utility; for example, run it as "speaker-test -t wav -c 2".

Long story short, this resolves one of the open issues, and may also help in achieving better sound quality on PineBook Pro. Smile

Could you, please, check the generation of headphone detection interrupts on your wife's PineBook Pro, while there's music playback?  Are there multiple interrupts generated upon unplugging the headphones, with active music playback?

Edit: I've also updated the PineBook Pro wiki to include a reference to this post, as the provided information may be helpful to other users.
I'll have a look next time I get a chance, maybe as soon as tomorrow night. I should've thought to check that today.
If you could confirm that there are multiple interrupts generated upon unplugging the headphones on your wife's PineBook Pro, while there is music playback, we should be certain, if you agree, that the headphones plug-in detection circuit has some issues at the hardware level.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Microphone in through headphone jack SageFox 1 1,514 03-26-2020, 12:27 PM
Last Post: zaius

Forum Jump:

Users browsing this thread: 2 Guest(s)