06-04-2021, 02:26 AM
(05-25-2021, 02:56 AM)kqlnut Wrote: I looked at it again too and saw that maybe the firmware wasn't even uploaded correctly in the first place? I'm in no way experienced with this, but to my understanding it seems like the firmware is written (l. 126–129) without checking for errors. Then the autofocus registers are set, including the FW_STATUS register (0x7f – downloaded and not running). After that a system reset is done which is checked for errors, but that has nothing to do with the the autofocus firmware. If that was successful, we are informed that the firmware upload was successful. So maybe the firmware upload wasn't successful after all?
You're right, the for loop that writes the firmware to the camera MCU (lines 126–129 in the kernel autofocus patch) should be checking the return value of the ov5640_write_reg() function. Also, the code block that performs the MCU reset after completing the firmware loading (lines 132–139 in the patch) should be checking the return value of the same function. If you have time, maybe you could add some error checking there, recompile the kernel, and check the results?
(05-25-2021, 02:56 AM)kqlnut Wrote: Very interesting idea! I went Tito Puente on the camera and the firmware did in fact start successfully one time! Only one time though out of at least 10 I tried and I couldn't reproduce it. Unfortunately I was too quick to close Megapixels before I checked the dmesg output, so I couldn't try if it actually worked. So maybe that's it and something really is stuck badly in the camera. The camera always makes a clicking sound twice when starting it up and I was under the impression that this was the autofocus, so I thought it was physically working.
Those are interesting results, although the rate of success doesn't seem to indicate that the root cause is stuck lens. I also hear the clicks you've decribed; those should be the initial autofocus resets, which the camera seems to be doing on its own when powered up. The fact that you hear those "initialization" clicks probably means that the lens isn't stuck, so let's hope that the issue is fixable in the kernel driver.