public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: hans@jjverkuil.nl, laurent.pinchart@ideasonboard.com,
	Prabhakar <prabhakar.csengg@gmail.com>,
	"Kate Hsuan" <hpa@redhat.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Tommaso Merciai" <tomm.merciai@gmail.com>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Julien Massot" <julien.massot@collabora.com>,
	"Naushir Patuck" <naush@raspberrypi.com>,
	"Yan, Dongcheng" <dongcheng.yan@intel.com>,
	"Cao, Bingbu" <bingbu.cao@intel.com>,
	"Qiu, Tian Shu" <tian.shu.qiu@intel.com>,
	"Stefan Klug" <stefan.klug@ideasonboard.com>,
	"Mirela Rabulea" <mirela.rabulea@nxp.com>,
	"André Apitzsch" <git@apitzsch.eu>,
	"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	"Mehdi Djait" <mehdi.djait@linux.intel.com>,
	"Ricardo Ribalda Delgado" <ribalda@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Jacopo Mondi" <jacopo.mondi@ideasonboard.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	"David Plowman" <david.plowman@raspberrypi.com>,
	"Yu, Ong Hock" <ong.hock.yu@intel.com>,
	"Ng, Khai Wen" <khai.wen.ng@intel.com>,
	"Jai Luthra" <jai.luthra@ideasonboard.com>
Subject: [PATCH v3 03/22] media: imx219: Set horizontal blanking on mode change
Date: Wed, 25 Mar 2026 12:57:59 +0200	[thread overview]
Message-ID: <20260325105818.1176816-4-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20260325105818.1176816-1-sakari.ailus@linux.intel.com>

The driver UAPI is mode-based, allowing the user to choose a mode from a
small list based on the output size. The vertical blanking is set based on
the mode, do the same for horizontal blanking so the frame rate obtained
is constant.

Additinally, it's best to use a known-good horizontal blanking value as
choosing the value freely may affect image quality. While the minimum
value may not be the best value for horizontal blanking, at least it is
constant rather than a minimum value of a different configuration.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/imx219.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 89061dc1842d..62a23541b1dc 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -837,11 +837,9 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 	struct v4l2_mbus_framefmt *format;
 	struct v4l2_rect *crop;
 	u8 bin_h, bin_v, binning;
-	u32 prev_line_len;
 	int ret;
 
 	format = v4l2_subdev_state_get_format(state, 0);
-	prev_line_len = format->width + imx219->hblank->val;
 
 	/*
 	 * Adjust the requested format to match the closest mode. The Bayer
@@ -882,7 +880,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
 		int exposure_max;
 		int exposure_def;
-		int hblank, llp_min;
+		int llp_min;
 		int pixel_rate;
 
 		/* Update limits and set FPS to default */
@@ -924,15 +922,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 					       llp_min - mode->width);
 		if (ret)
 			return ret;
-		/*
-		 * Retain PPL setting from previous mode so that the
-		 * line time does not change on a mode change.
-		 * Limits have to be recomputed as the controls define
-		 * the blanking only, so PPL values need to have the
-		 * mode width subtracted.
-		 */
-		hblank = prev_line_len - mode->width;
-		ret = __v4l2_ctrl_s_ctrl(imx219->hblank, hblank);
+
+		ret = __v4l2_ctrl_s_ctrl(imx219->hblank, llp_min - mode->width);
 		if (ret)
 			return ret;
 
-- 
2.47.3


  parent reply	other threads:[~2026-03-25 10:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 10:57 [PATCH v3 00/22] Metadata series preparation Sakari Ailus
2026-03-25 10:57 ` [PATCH v3 01/22] media: imx219: Rename "PIXEL_ARRAY" as "VISIBLE" Sakari Ailus
2026-03-25 10:57 ` [PATCH v3 02/22] media: imx219: Fix maximum frame length in lines Sakari Ailus
2026-03-25 11:36   ` Dave Stevenson
2026-03-25 10:57 ` Sakari Ailus [this message]
2026-03-25 11:48   ` [PATCH v3 03/22] media: imx219: Set horizontal blanking on mode change Dave Stevenson
2026-03-25 12:20     ` Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 04/22] media: imx219: Scale the vblank limits according to rate_factor Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 05/22] media: imx219: Fix vertical blanking and exposure for analogue binning Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 06/22] media: imx219: Don't update exposure limits while setting format Sakari Ailus
2026-03-25 12:37   ` Dave Stevenson
2026-03-25 12:47     ` Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 07/22] media: imx219: Rename "binning" as "bin_hv" in imx219_set_pad_format Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 08/22] media: Documentation: Improve LINK_FREQ documentation Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 09/22] media: Documentation: Improve pixel rate calculation documentation Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 10/22] media: v4l2-subdev: Refactor returning routes Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 11/22] media: v4l2-subdev: Allow accessing routes with STREAMS client capability Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 12/22] media: mc: Simplify link processing in __media_pipeline_start() Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 13/22] media: mc: Separate single link validation into a new function Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 14/14] media: Improve enable_streams and disable_streams documentation Sakari Ailus
2026-03-25 12:34   ` Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 14/22] media: uapi: Bump the STREAMS bit a little Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 15/22] media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 16/22] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 17/22] media: Improve enable_streams and disable_streams documentation Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 18/22] media: v4l2-subdev: Move subdev client capabilities into a new struct Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 19/22] media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 20/22] media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state Sakari Ailus
2026-03-25 10:58 ` [PATCH v3 21/22] media: v4l2-subdev: Perform client info changes to i2c drivers 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=20260325105818.1176816-4-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bingbu.cao@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=david.plowman@raspberrypi.com \
    --cc=dongcheng.yan@intel.com \
    --cc=git@apitzsch.eu \
    --cc=hans@jjverkuil.nl \
    --cc=hansg@kernel.org \
    --cc=heimir.sverrisson@gmail.com \
    --cc=hpa@redhat.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=julien.massot@collabora.com \
    --cc=khai.wen.ng@intel.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=mirela.rabulea@nxp.com \
    --cc=naush@raspberrypi.com \
    --cc=ong.hock.yu@intel.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=ribalda@kernel.org \
    --cc=stefan.klug@ideasonboard.com \
    --cc=sylvain.petinot@foss.st.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tomm.merciai@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox