-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OV7251 updates for libcamera compatibility. #4897
Conversation
It was incorrect, so the driver rejected it. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Add support for enumeration through ACPI to the ov7251 driver Signed-off-by: Daniel Scally <djrscally@gmail.com>
Move the endpoint checking from .probe() to a dedicated function, and additionally check that the firmware provided link frequencies are a match for those supported by the driver. Finally, return -EPROBE_DEFER if the endpoint is not available, as it could be built by the ipu3-cio2 driver if that probes later. Signed-off-by: Daniel Scally <djrscally@gmail.com>
Rather than having the pll settings hidden inside mode blobs, define them in structs and use a dedicated function to set them. This makes it simpler to extend the driver to support other external clock frequencies. Signed-off-by: Daniel Scally <djrscally@gmail.com>
The OV7251 sensor is used as the IR camera sensor on the Microsoft Surface line of tablets; this provides a 19.2MHz external clock. Add the ability to support that rate to the driver by defining a new set of PLL configs. Extend the clock handling in .probe() to check for either supported frequency. Signed-off-by: Daniel Scally <djrscally@gmail.com>
.probe() is quite busy for this driver; make it cleaner by moving the chip verification to a dedicated function. Signed-off-by: Daniel Scally <djrscally@gmail.com>
Add pm_runtime support to the ov7251 driver. Signed-off-by: Daniel Scally <djrscally@gmail.com>
The .s_power() callback is deprecated, and now that we have pm_runtime functionality in the driver there's no further use for it. Delete the function. Signed-off-by: Daniel Scally <djrscally@gmail.com> Reported-by: kernel test robot <lkp@intel.com>
"media: i2c: Remove .s_power() from ov7251" removed the call that sent ov7251_global_init_setting to the sensor. Send it when starting streaming. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The pixel rate doesn't actually change based on the mode, and can not be set by userspace. Fix the control. The control is already read only as set by the core. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The link frequency does not change with the mode, so remove the special handling for it. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Initialise ov7251->current_mode during probe to avoid the issue of a NULL dereference should get_frame_interval be called before set_frame_interval or set_format. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
HBLANK is a fixed value in this driver, so add as a fixed read-only control. The value is updated during set_format as the V4L2 control is depenedent on width, even though only one width is actually defined. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
There is no reaon why changing mode should reset the analogue gain of the sensor, and it's not the behaviour that userspace will be expecting. Remove the reset. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
If only one link frequency was configured, then ov7251_check_hwcfg failed as the conditions weren't checked in the appropriate places. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
…ROP_DEFAULT As required by libcamera, add get_selection handling for V4L2_SEL_TGT_NATIVE_SIZE, V4L2_SEL_TGT_CROP_DEFAULT, and V4L2_SEL_TGT_CROP_BOUNDS. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The driver did have a full copy of the registers for each of the 30, 60, and 90 fps modes. The main difference between them were registers 0x380e/f which set the total height of the frame (VTS). Remove the excess register settings, and Set that register value explicitly for each mode. This has dropped a change for the 30fps mode to registers 0x3016, 0x3017, 0x3018, 0x301a, 0x301b, and 0x301c. The data available doesn't describe these registers, but the sensor seems fully functional without the alternate settings. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The maximum exposure is dictated by VTS, so compute it rather than having the value in the mode table. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The modes and frame intervals are independent, therefore separate them into 2 structures. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This is a raw sensor so should be implementing V4L2_CID_VBLANK instead of the frame_interval ops, as per docs at https://www.kernel.org/doc/html/latest/driver-api/media/camera-sensor.html#frame-interval-configuration This driver already implemented the frame_interval ops, so removing them would be a regression. Implement V4L2_CID_VBLANK, with the frame_interval ops setting that control. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The control is specifically for analogue gain, therefore switch to using the control for that. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
We should have all the functionality required by now, so switch to using Media Controller so that it can be used with libcamera. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
@naushir and @davidplowman to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the typo in the commit message for 30a3d59 I couldn't spot any issues (it forward-ports cleanly).
@@ -37,6 +37,8 @@ | |||
#define OV7251_AEC_EXPO_2 0x3502 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the commit message - depenedent
.
Merged offline with the typo fixed. |
kernel: usb: xhci: add a quirk for Superspeed bulk OUT transfers on VL805 See: raspberrypi/linux#4893 kernel: Change vc4 DSI to being a bridge See: raspberrypi/linux#4878 kernel: Fix for the cursor corruption with KMS (again) See: raspberrypi/linux#4895 kernel: OV7251 updates for libcamera compatibility See: raspberrypi/linux#4897
kernel: usb: xhci: add a quirk for Superspeed bulk OUT transfers on VL805 See: raspberrypi/linux#4893 kernel: Change vc4 DSI to being a bridge See: raspberrypi/linux#4878 kernel: Fix for the cursor corruption with KMS (again) See: raspberrypi/linux#4895 kernel: OV7251 updates for libcamera compatibility See: raspberrypi/linux#4897
7 of the patches are from the linux-media mailing list. Minor changes were requested, and I've got a fixup on one of them, but they otherwise seem reasonable. I ought to submit the rest of my patches upstream.
Support requested by raspberrypi/rpicam-apps#235