The more I think about it, the more I think about that jack. I'd be inclined to disconnect it and see if the problem goes away.
But then I look at the schematic, and the headphone jack is not of a conventional design with a switch. It uses the plug ring as a switch, at least according to the schematic. The reference voltage comes from a GPIO output on the codec. I don't really understand why, and I don't know what controls the codec. If for some reason the GPIO on the codec turns off, or becomes an input, "insertion" will be detected.
Now that I know how it works, I'm pretty sure the headphone jack can't be at fault unless there is debris or something like tin whiskers in it.
My edit didn't work as expected!
Here's a strange thought, too. You shouldn't get audio out of the speakers if that count is an odd number. So whilst it's at 33, maybe play something and see if that comes out the speakers.
But then I look at the schematic, and the headphone jack is not of a conventional design with a switch. It uses the plug ring as a switch, at least according to the schematic. The reference voltage comes from a GPIO output on the codec. I don't really understand why, and I don't know what controls the codec. If for some reason the GPIO on the codec turns off, or becomes an input, "insertion" will be detected.
Now that I know how it works, I'm pretty sure the headphone jack can't be at fault unless there is debris or something like tin whiskers in it.
My edit didn't work as expected!
Here's a strange thought, too. You shouldn't get audio out of the speakers if that count is an odd number. So whilst it's at 33, maybe play something and see if that comes out the speakers.