This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: i2c: Add hblank control to ov8865
Author:  Daniel Scally <[email protected]>
Date:    Tue Nov 23 01:00:10 2021 +0100

Add a V4L2_CID_HBLANK control to the ov8865 driver. This is read only
with timing control intended to be done via vblanking alone.

Signed-off-by: Daniel Scally <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/i2c/ov8865.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

---

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index 27043b9426a1..f1ee0e425adf 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -677,6 +677,7 @@ struct ov8865_state {
 struct ov8865_ctrls {
        struct v4l2_ctrl *link_freq;
        struct v4l2_ctrl *pixel_rate;
+       struct v4l2_ctrl *hblank;
        struct v4l2_ctrl *vblank;
 
        struct v4l2_ctrl_handler handler;
@@ -2513,6 +2514,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor)
        const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops;
        const struct ov8865_mode *mode = &ov8865_modes[0];
        unsigned int vblank_max, vblank_def;
+       unsigned int hblank;
        int ret;
 
        v4l2_ctrl_handler_init(handler, 32);
@@ -2550,6 +2552,13 @@ static int ov8865_ctrls_init(struct ov8865_sensor 
*sensor)
                                     0, 0, ov8865_test_pattern_menu);
 
        /* Blanking */
+       hblank = mode->hts - mode->output_size_x;
+       ctrls->hblank = v4l2_ctrl_new_std(handler, ops, V4L2_CID_HBLANK, hblank,
+                                         hblank, 1, hblank);
+
+       if (ctrls->hblank)
+               ctrls->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+
        vblank_max = OV8865_TIMING_MAX_VTS - mode->output_size_y;
        vblank_def = mode->vts - mode->output_size_y;
        ctrls->vblank = v4l2_ctrl_new_std(handler, ops, V4L2_CID_VBLANK,
@@ -2696,6 +2705,7 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev,
        struct v4l2_mbus_framefmt *mbus_format = &format->format;
        const struct ov8865_mode *mode;
        u32 mbus_code = 0;
+       unsigned int hblank;
        unsigned int index;
        int ret = 0;
 
@@ -2740,6 +2750,10 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev,
                                 OV8865_TIMING_MAX_VTS - mode->output_size_y,
                                 1, mode->vts - mode->output_size_y);
 
+       hblank = mode->hts - mode->output_size_x;
+       __v4l2_ctrl_modify_range(sensor->ctrls.hblank, hblank, hblank, 1,
+                                hblank);
+
 complete:
        mutex_unlock(&sensor->mutex);
 

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to