Spurious headphone detection interrupts - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111) +--- Forum: Pinebook Pro Hardware and Accessories (https://forum.pine64.org/forumdisplay.php?fid=116) +--- Thread: Spurious headphone detection interrupts (/showthread.php?tid=12631) |
Spurious headphone detection interrupts - dsimic - 12-27-2020 Hello, I have observed generation of spurios headphone detection interrupts on my second-batch PineBook Pro. The interrupt count increases with no headphones being plugged in or out, which is obviously not the expected behavior. I have also verified that music playback through internal speakers does not cause the tnterrupt count to increase. You can check the above-described interrupt count by running something like this: Code: cat /proc/interrupts | grep Headphone This is what I get as the output for the command above, after about six hours of uptime: Code: 73: 6 0 0 0 0 0 rockchip_gpio_irq 8 Edge Headphone detection Of course, there should be a total of zero interrupts generated, instead of six as visible above. I already looked at the PineBook Pro schematic, board DTS file, and the ES8316 driver in the Linux kernel. However, I'd refrain from spending a lot of time digging into this, until we can establish it as a known, non-isolated issue. Could anyone, please, confirm the above-described issue? RE: Spurious headphone detection interrupts - dsimic - 01-07-2021 Anyone, please? @Arwen, @KC9UDX? RE: Spurious headphone detection interrupts - Arwen - 01-07-2021 One thought is if you have the headphone jack setup for serial console. Their is a switch inside to change function. The details are on the Wiki. Most of the time the Pinebook Pros come from the factory setup for headphones, not serial console. But, their have been other minor issues like this, (WiFi being disabled via the privacy switch...) Can you play music through the headphones? RE: Spurious headphone detection interrupts - dsimic - 01-07-2021 Yes, music playback works as expected through the headphones on my PineBook Pro. The issue is that the hardware sees headphone plug-in events (more precisely, the hardware generates the associated interrupts) that actually do not exist. Could you, please, use the command from my original post to check the interrupt count on your PineBook Pro? RE: Spurious headphone detection interrupts - KC9UDX - 01-07-2021 I think it's odd that all 6 are on CPU0. If you leave it go longer, are they always on CPU0? Frankly though, I don't know anything about interrupt control on this SOC, so maybe there's a reasonable explanation for this. Here's what I get. I see something completely different. I don't see an IRQ 73 at all. Please upload your full results. Code: pbp$ intrctl list Incidentally, this is after about ten minutes of uptime. RE: Spurious headphone detection interrupts - dsimic - 01-07-2021 I have no "irqbalance" daemon running, that's why the interrupts aren't distributed among CPU cores. Below is the full contents of "/proc/interrupts" from my PineBook Pro, which is running Manjaro ARM, after about 12 hours of uptime and only one actual headphones plug-in event. The remaining 22 are spurious. Code: $ cat /proc/interrupts My initial research points into the direction of a possible hardware issue, but I'll stay away from spending a lot of time and digging deeper until we actually have it confirmed as an issue. By the way, what does the "intrctl" utility actually do? I'm not familiar with it and a web search returns only NetBSD references? RE: Spurious headphone detection interrupts - KC9UDX - 01-07-2021 I'm running NetBSD. NetBSD doesn't have /proc/interrupts. We should be seeing the same thing though; your /proc/interrupts should be the same as my intrctl list. The hardware is the same. But again, I don't know how interrupts work on the PBP, at all. So, I can only surmise that the IRQ numbers are software-generated, not hardware-generated. Else we should have similar IRQ numbers. I suppose by comparing occurrences we could guess at which ones align between Manjaro and NetBSD. Code: pbp$ uptime Very odd; I booted at 0:00 UTC, completely by accident! Since I don't know anything about interrupts on these systems, I kind of wonder if they could be called by software. I suppose so; but I wonder if that would show up in the occurrence count; and I wonder why Manjaro would call that interrupt. I checking my wife's PBP running Manjaro. It has an uptime of over 12 days, and has 0 occurrences of the IRQ associated with headphone detection. I do notice that the IRQ numbers don't match yours or mine, and I also notice that yours have changed. So clearly the IRQ number is software generated. Mine (NetBSD) don't appear to change from boot to boot. Also significant: My PBP has the serial console enabled. My wife's does not. RE: Spurious headphone detection interrupts - dsimic - 01-07-2021 Thumbs up for running NetBSD on your PineBook Pro! Having an accidental midnight boot is quite funny. As you have already concluded, interrupt numbers are not fixed on Linux, and there's no need to have the same interrupts present (i.e., visible or handled) on Linux and NetBSD. For example, the headphones detection IRQ is received by a GPIO line on the RK3399 SoC, which is further mapped to the "simple-audio-card" Linux kernel driver, using the device tree file. On the other hand, there's no urgent need for NetBSD to handle this particular interrupt, it may safely go unhandled. Having zero headphone detection interrupts on your wife's PinBook Pro points into this being an isolated hardware issue on my PineBook Pro, but I'd like to have at least a couple more PineBook Pros checked, as different batches may behave differently. Could you, please, also try to connect headphones to your wife's PineBook Pro, just to make sure that the interrupts are actually generated and counted as expected? It should be worth checking. Thank you for checking! RE: Spurious headphone detection interrupts - KC9UDX - 01-07-2021 Prior to enabling the serial console, I did use the headphone jack for audio output to my Hi-Fi. Assuming that headphone/speaker switching is done in software (it must be) then NetBSD must be handling the interrupt; it just isn't annotated. What's interesting with intrctl, is that you can watch interrupts as they happen in real time. My wife does use headphones very often, so I am surprised that this interrupt hasn't occurred. But maybe she hasn't in the past 12 days. I'll see what happens when I plug them in. I checked my wife's PBP, and the interrupt count does go up one, on every plug and every unplug of the headphones. I must have made a mistake earlier because before I plugged in the headphones, I checked the count again and it was 5. So either she had the headphones plugged in when booting 12 days ago (maybe?) or it also has a spurious source of interrupts. Then I stupidly tried to see what would happen if I plugged the headphones into mine. Of course, I ended up at the DDB prompt with the system halted and no recourse, as I had no serial console handy. Given the number of spurious interrupts that you have over the time, I don't know that I'd be too concerned, although it is a mystery worth solving. I don't know how hard it is to find the interrupt line to check it with a scope though. The trouble with noise on an interrupt line though is that hooking up the scope will influence the noise, or lack thereof. I wonder if Wi-Fi or bluetooth activity affects it. Also food for thought: It may just be that you have a loose contact in the headphone jack. I wonder if tapping the case changes the count. I also wonder if you usually see even numbers. RE: Spurious headphone detection interrupts - dsimic - 01-08-2021 Thank you for checking it further! I'm sorry that you effectively panicked your laptop in the process. The remark on even numbers as the interrupt counts is a good one, but, for example, I currently have 33 as the interrupt count, which for some reason hasn't changed in the last few hours. I'll try to keep an eye on that. By the way, I don't use WiFi or Bluetooth, which consequently shouldn't be the root cause. I've just finished checking the PineBook Pro schematic, the DTS file and the source code of related Linux kernel drivers, and you're right, the disabling and enabling of the internal speakers is performed by the drivers, which use the headphones detection to turn off and on the amplifiers that power the internal speakers. Speaking of that, I do hear some faint popping/clicking noises coming randomly out of the internal speakers, which might be the result of the amplifiers being turned off and on, as a result of spurios headphones detection interrupts. I'll try to debug that further. I doubt that any percussion maintenance would actually help because the source of the headphones detection interrupt comes from the audio codec (which actually isn't documented exactly how), and the Linux kernel driver that handles the RK3399's associated GPIO line has also debouncing enabled on it. Anyway, I tried tapping the laptop case lightly near the headphones jack, and no new interrupts were generated. I'll also try inserting and removing the headphones jack a few more times, as the cause might be related to a not-so-great auxiliary connection inside the headphones jack, which is used to signal the absence of the headphones to the audio codec. Edit: I have also replied to the latest responses. |