Difference between revisions of "PinePhone Pro/IMX258 Camera Debugging"

Jump to navigation Jump to search
(More debugging, add some links)
(Add fix from Megi!)
Line 141: Line 141:
* Whether the DMA of frames to memory actually happens, regardless of (lack of) emission of the interrupt that tells us when said DMA finishes a frame.
* Whether the DMA of frames to memory actually happens, regardless of (lack of) emission of the interrupt that tells us when said DMA finishes a frame.
* Whether the regulator messages we see during boot are actually significant. I don't know enough about the Linux regulator framework to say whether these being not-found means power is not correctly supplied, or if Linux just isn't being properly informed of the power supply requirements for precise tracking/power-saving when the camera is off.
* Whether the regulator messages we see during boot are actually significant. I don't know enough about the Linux regulator framework to say whether these being not-found means power is not correctly supplied, or if Linux just isn't being properly informed of the power supply requirements for precise tracking/power-saving when the camera is off.
== Megi saves the day ==
<pre>
[I] <megi> you might be interested in this https://megous.com/dl/tmp/0ae6ba03a17a3d53.png
[I] <megi> https://megous.com/git/linux/tag/?h=orange-pi-5.18-20220521-1759
</pre>
Turns out, the .dts had the wrong ISP connected to the sensor!
Apply [https://github.com/megous/linux/commit/9afd884f8b36121fb6097e77b6d35fe46ab48ad9 this commit] ([https://github.com/megous/linux/commit/9afd884f8b36121fb6097e77b6d35fe46ab48ad9.patch patch]) to your kernel tree, rebuild, and reinstall. Now, the following should produce an image (<code>frame.jpg</code>):
<pre>
"media-ctl" "-d" "platform:rkisp1" "-r"
"media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"imx258 1-001a":0 [fmt:SGRBG10_1X10/1048x780]'
"media-ctl" "-d" "platform:rkisp1" "-l" "'imx258 1-001a':0 -> 'rkisp1_isp':0 [1]"
"media-ctl" "-d" "platform:rkisp1" "-l" "'rkisp1_isp':2 -> 'rkisp1_resizer_selfpath':0 [1]"
"media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_isp":0 [fmt:SGRBG10_1X10/1048x780 crop:(0,0)/1048x780]'
"media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_isp":2 [fmt:YUYV8_2X8/1048x780 crop:(0,0)/1048x780]'
"v4l2-ctl" "-z" "platform:rkisp1" "-d" "rkisp1_selfpath" "-v" "width=1048,height=780,"
"media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_resizer_selfpath":0 [fmt:YUYV8_2X8/1048x780 crop:(0,0)/1048x780]'
"v4l2-ctl" "-z" "platform:rkisp1" "-d" "rkisp1_selfpath" "-v" "width=1048,height=780,pixelformat=422P"
"v4l2-ctl" "-z" "platform:rkisp1" "-d" "rkisp1_selfpath" "--stream-mmap" "--stream-count" "1" "--stream-file=frame.raw"
ffmpeg -y -s:v 1048x780 -pix_fmt yuv422p -i frame.raw frame.jpg
</pre>
=== What's left? ===
libcamera and megapixels still don't work. Megapixels appears to need support for debayering YUYV, and both appear to be configuring the rkisp1 pipeline wrong.


== Useful links ==  
== Useful links ==