All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Kate Hsuan <hpa@redhat.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-media@vger.kernel.org
Subject: [PATCH resend 4/5] media: ov2680: Add hblank control
Date: Mon, 15 Apr 2024 11:37:03 +0200	[thread overview]
Message-ID: <20240415093704.208175-5-hdegoede@redhat.com> (raw)
In-Reply-To: <20240415093704.208175-1-hdegoede@redhat.com>

Add hblank control so that the sensor has all the mandatory
controls for libcamera.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/ov2680.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index d44e1934b25a..14a5ac2bbf8b 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -130,6 +130,7 @@ struct ov2680_ctrls {
 	struct v4l2_ctrl *link_freq;
 	struct v4l2_ctrl *pixel_rate;
 	struct v4l2_ctrl *vblank;
+	struct v4l2_ctrl *hblank;
 };
 
 struct ov2680_mode {
@@ -684,6 +685,10 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
 	/* exposure range depends on vts which may have changed */
 	ov2680_exposure_update_range(sensor);
 
+	/* adjust hblank value for new width */
+	def = OV2680_PIXELS_PER_LINE - width;
+	__v4l2_ctrl_modify_range(sensor->ctrls.hblank, def, def, 1, def);
+
 unlock:
 	mutex_unlock(&sensor->lock);
 
@@ -984,6 +989,12 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)
 	ctrls->vblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_VBLANK,
 					  OV2680_MIN_VBLANK, max, 1, def);
 
+	def = OV2680_PIXELS_PER_LINE - OV2680_DEFAULT_WIDTH;
+	ctrls->hblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HBLANK,
+					  def, def, 1, def);
+	if (ctrls->hblank)
+		ctrls->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+
 	if (hdl->error) {
 		ret = hdl->error;
 		goto cleanup_entity;
-- 
2.44.0


  parent reply	other threads:[~2024-04-15  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  9:36 [PATCH resend 0/5] media: ov2680: Add all controls required by libcamera Hans de Goede
2024-04-15  9:37 ` [PATCH resend 1/5] media: ov2680: Stop sending more data then requested Hans de Goede
2024-04-15  9:37 ` [PATCH resend 2/5] media: ov2680: Drop hts, vts ov2680_mode struct members Hans de Goede
2024-04-15  9:37 ` [PATCH resend 3/5] media: ov2680: Add vblank control Hans de Goede
2024-04-15 11:32   ` Sakari Ailus
2024-04-15  9:37 ` Hans de Goede [this message]
2024-04-15  9:37 ` [PATCH resend 5/5] media: ov2680: Add camera orientation and sensor rotation controls Hans de Goede
2024-04-15 11:36   ` Sakari Ailus
2024-04-15 11:58     ` Hans de Goede
2024-04-15 12:17       ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240415093704.208175-5-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=hpa@redhat.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.