Dear Ti staff,
We currently have a valid driver for OV ox05B sensor, but only the RGB channel can be adjusted. Our goal is to add the function of configuring the exposure and gain of the IR channel.
After analyzing the existing driver code, our thought are as follows:
1. struct ox05b should be expanded with more v4l2_ctrl member, such as *ir_exposure.
struct ox05b { struct device *dev; struct clk *clk; u32 clk_rate; struct i2c_client *client; struct regmap *regmap; struct gpio_desc *reset_gpio; struct v4l2_subdev sd; struct media_pad pad; struct v4l2_mbus_framefmt format; struct v4l2_async_notifier notifier; struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl *exposure; struct v4l2_ctrl *again; struct v4l2_ctrl *dgain; struct v4l2_ctrl *h_flip; struct v4l2_ctrl *v_flip; struct v4l2_ctrl *pixel_rate; u32 fps; /* * Mutex for serialized access: * Protect sensor module set pad format and start/stop streaming safely. */ struct mutex lock; bool streaming; };
2. adding corresponding controls for ir_exposure etc.
/* Add new controls */ ox05b->exposure = v4l2_ctrl_new_std(ctrl_hdr, &ox05b_ctrl_ops, V4L2_CID_EXPOSURE, 1, OX05B_EXPOSURE_MAX, 1, OX05B_EXPOSURE_DEFAULT); ox05b->again = v4l2_ctrl_new_std(ctrl_hdr, &ox05b_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, 0, OX05B_AGAIN_MAX, 1, OX05B_AGAIN_DEFAULT); ox05b->dgain = v4l2_ctrl_new_std(ctrl_hdr, &ox05b_ctrl_ops, V4L2_CID_DIGITAL_GAIN, 0, OX05B_DGAIN_MAX, 1, OX05B_DGAIN_DEFAULT);
3. implement lower level driver, passing the values into corresponding registers and utilizing the group hold and AB mode switching mechaism of the sensor to control its exposure and etc in both RGB and IR frame.
The main question here is that the available control ops needed in v4l2_ctrl_new_std() seems to be insufficient, for example for exposure there is only V4L2_CID_EXPOSURE defined in v4l2_controls.h. Should we try to add more control op definitions to fulfill our requirement?
As we are not familiar with the V4L2 framework, please provide us with some advice for this question.
By the way, we have also read your driver code for ov2312. The structure and methodology are very similiar to ox05B's , yet the driver for ov2312 can only configure the parameters for RGB frames.
Thank you for the support in advance and looking forward to your reply.
Huang Jingjie