05-25-2021, 02:56 AM
(05-24-2021, 12:28 PM)dsimic Wrote: 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.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?
(The duplicated lines are for resetting the MCU and then retrying to start the firmware.)
(05-24-2021, 12:28 PM)dsimic Wrote: 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 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.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.
(05-24-2021, 12:28 PM)dsimic Wrote: 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?I was thinking the same thing when it was compiling. That is awesome indeed!