Conversation
360282a to
cbc933f
Compare
Please note that this is NOT an official driver - just my tinkering. The fact it has been posted to linux-media means that the sensor meets the libcamera requirements of having had a driver posted, so the libcamera support for it can be posted now :-)
You can already test it. All Pull Requests get built by the CI system, and on Raspberry Pi OS you can then use
Seeing as you've edited your post I'm guessing you found there already was the |
|
Thank you so much for the reply!
I'm sorry that I’m still a complete beginner and not very familiar with how things work on the mailing list or the libcamera development side yet. I'm afraid I don't have enough expertise to follow all the technical details or provide professional feedback.
I had no idea it was this simple to install a specific PR kernel! I originally thought I would have to compile it myself, which seemed too daunting to try, so thank you so much for pointing that out. I’ve already tried sudo rpi-update pulls/7239 as you suggested, and it works! I can now successfully capture RAW files using v4l2-ctl on my Zero 2 W. This is a huge help for my project.
Yes, you’re right. I edited my post as soon as I realized the feature was already there. You caught me! :-) Since I haven't learned how to handle the ISP pipeline or post-process RAW data yet, I’ll probably just add a long-pass IR filter and treat it as a monochrome sensor for now as a workaround. It’s really exciting to see the progress being made on this sensor. I’ll be keeping an eye on the updates, and it would be amazing if one day I could get color images through Picamera2 thanks to efforts like yours. Thank you again for making this technology so accessible to us! |
No problem. Having folks just willing to test stuff is very valuable. This repo is what would be termed a Vendor kernel or Board Support Package (BSP). It's taken the mainline Linux kernel and added a number of patches to better support the Raspberry Pi hardware. A number of those patches will be upstreamed to the mainline Linux kernel, but also we benefit from non-platform specific drivers that are submitted to mainline, such as the one for IMX662. libcamera have a hard requirement that a driver must have been submitted to the mainline kernel mailing lists before support for any camera can be merged to libcamera. |
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
| vcm = <&vcm>, "status=okay", | ||
| <&cam_node>,"lens-focus:0=", <&vcm>; | ||
| 4lane = <0>, "+201+202"; | ||
| clock-frequency = <&clk_frag>,"clock-frequency:0", |
There was a problem hiding this comment.
Score one for the automated overlay checker:
* imx662: misused fragment label clk_frag
There was a problem hiding this comment.
I'd just been looking at why I couldn't set the clock frequency to 37.125MHz and scratching my head a bit.
Point the override at the right bit and it works.
Issue with register update latency on IMX662 driverHi 6by9, I'm currently trying to use the driver from this PR for an automatic long-exposure time-lapse script. # Keep the stream running and output raw data to a FIFO or pipe
v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=0 --stream-to=/tmp/sensor_pipe &
while true; do
# A. Update parameters via subdev
v4l2-ctl -d /dev/v4l-subdev0 -c horizontal_blanking=XXX,vertical_blanking=YYY,exposure=ZZZ,analogue_gain=34
# B. Read the very next frame (The "freshest" one available after the flush)
dd if=/tmp/sensor_pipe bs=EXACT_RAW_SIZE count=1 of=lights_01_....raw
# C. Perform AE calculation and repeat
done(T = exposure in ms, G = gain, Y = measured brightness, target Y ≈ 0.33): I let AI read your driver code. It seems REGHOLD is defined at 0x3001 but never actually used.It looks like the sensor is still using the old timing for several frames after the control is set. Full code: I’m not very familiar with V4L2 sensor drivers (most of the code was helped by AI), so my question might be naive. Thanks! |
|
@d4c00 REGHOLD is only an issue if you are updating multiple parameters close to the end of frame (when the new settings will be latched) and want to ensure that they are all written atomically rather than risking getting some and not others. Reading the datasheet, it implies that changes to register SHR0 (exposure) are adopted at the next CSI2 frame start. This should be reflected in the camera_sensor_properties for the sensor in libcamera. IMX662 is the follow on from IMX327/290/462, so I would have expected it to match those in https://github.com/raspberrypi/libcamera/blob/main/src/libcamera/sensor/camera_sensor_properties.cpp#L234-L243 which has a 2 frame delay for all controls. |
|
Closing as branch https://github.com/6by9/linux/tree/rpi-6.18.y-imx662-mainline has the more recent work with those looking to submit an IMX662 driver to mainline. I'll create a PR in due course. |
@6by9 Thanks for the pointers! Now I feel a bit embarrassed—I should have suspected my own script's buffering logic first. It seems I’ve been chasing a "ghost" that I created myself. Knowing that the hardware limit is strictly 2 frames is a huge help. It gives me a solid starting point to go back and clean up my messy code and figure out where those extra frames are piling up. Thanks again for your patience and for clearing this up for me!
That makes a lot of sense! It’s really helpful to see how libcamera handles this. I’ll try to mimic this behavior in my own script by adding a delay to my AE feedback loop. I think this might be the 'missing link' for my project. Thank you! |

Wanted for CI build artifacts.