05-24-2021, 12:28 PM
(05-24-2021, 11:21 AM)kqlnut Wrote: Thank you for the instructions, that made everything a lot easier than I had anticipated. I changed the patch and rebuilt the package on the Pinephone itself (took about 2:15 h in case anybody wonders). I increased the time to wait for the firmware to start to 10 times as much (2.5 seconds), but still the same problem unfortunately. So maybe it is faulty hardware. I will eventually order another camera module, but it'll take a while. I will report back if I have any news.
You're welcome and I'm glad that the instructions helped.
I'm sorry to hear that increasing the timeouts didn't help. After having a second look at the kernel autofocus patch, which by the way contains a chunk of code that's duplicated (lines 141-156 are the same as the lines 163-175), I can confirm that it follows the steps of the autofocus firmware initialization, described on page 8 of the OV5640 Embedded Firmware User Guide. There isn't much more that could be done from the software side, as far as I can see, but Martijn probably knows better.
What came to my mind is that the issue could be of a, so to speak, mechanical nature. See, the driver expects the autofocus firmware to reach the S_IDLE (0x70) status, which is described as "idle state, focus is released; lens is located at the furthest position". Another two statuses, S_FIRMWARE (0x7F, "firmware is downloaded and not run") and S_STARTUP (0x7E, "firmware is initializing"), are pretty much ignored while checking for a successful initialization of the autofocus feature, meaning that the lens has to physically move to the furthest position to declare the autofocus firmware initialization successful. However, you got this kernel message earlier:
Code:
[ 73.304696] ov5640 4-004c: uploaded firmware didn't start, got to 0x7f
This means that the autofocus firmware initialization reached the above-described S_FIRMWARE (0x7F) state, so the issue unfortunately doesn't seem to be of a mechanical nature. If the firmware initialization reached the S_STARTUP state instead, the root cause of the issue would have probably been a stuck lens, so tapping or knocking on the camera module, which is also known as "percussion maintenance", could probably resolve the issue. Anyway, it might be worth giving the camera module a knock or two; I had a phone with a built-in, motorized camera lens cover that sometimes got stuck and the camera refused to work, which was a known issue that was commonly resolved by applying some light "percussion maintenance" to the camera.
By the way, isn't it awesome to own a smartphone that, from the software side, can rather easily compile the very kernel it's running?