FAILED: patch "[PATCH] media: imx219: The horizontal blanking step is 8" failed to apply to 6.18-stable tree
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 47576c541e9b473841742bd0686d4940f5c93564
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 47576c541e9b473841742bd0686d4940f5c93564 Mon Sep 17 00:00:00 2001
From: Sakari Ailus <[email protected]>
Date: Mon, 22 Jun 2026 14:23:40 +0300
Subject: [PATCH] media: imx219: The horizontal blanking step is 8
The step for the LINE_LENGTH_A register on imx219 is 8. Take this into account in creating and modifying the horizontal blanking control. The minimum line length in pixels as well as the horizontal blanking values are already divisible by 8.
--- drivers/media/i2c/imx219.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/i2c/imx219.c +5 -2
@@ -78,6 +78,7 @@#define IMX219_LLP_MIN 0x0d78#define IMX219_BINNED_LLP_MIN 0x0de8#define IMX219_LLP_MAX 0x7ff0 +#define IMX219_LLP_STEP 8#define IMX219_REG_X_ADD_STA_A CCI_REG16(0x0164)#define IMX219_REG_X_ADD_END_A CCI_REG16(0x0166)
@@ -593,7 +594,8 @@ static int imx219_init_controls(struct imx219 *imx219) imx219->hblank =v4l2_ctrl_new_std (ctrl_hdlr, &imx219_ctrl_ops,V4L2_CID_HBLANK ,IMX219_LLP_MIN - mode->width, -IMX219_LLP_MAX - mode->width,1 , +IMX219_LLP_MAX - mode->width, +IMX219_LLP_STEP ,IMX219_LLP_MIN - mode->width); exposure_max = mode->fll_def -IMX219_EXPOSURE_OFFSET ; exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
@@ -935,7 +937,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, IMX219_BINNED_LLP_MIN :IMX219_LLP_MIN ; ret =__v4l2_ctrl_modify_range (imx219->hblank, llp_min - mode->width, -IMX219_LLP_MAX - mode->width,1 , +IMX219_LLP_MAX - mode->width, +IMX219_LLP_STEP , llp_min - mode->width);if (ret)return ret;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/2 media: i2c: imx219: Propagate errors from control range updates
From: Tarang Raval <[email protected]>
[ Upstream commit dff10c7044e8777bd14bba99444ff8a69d9bb2fe ]
Propagate return values from __v4l2_ctrl_modify_range() and __v4l2_ctrl_s_ctrl() in imx219_set_ctrl() and imx219_set_pad_format(). This ensures proper error handling instead of ignoring possible failures. Also return the result of imx219_set_pad_format() from imx219_init_state().
Stable-dep-of: 47576c541e9b ("media: imx219: The horizontal blanking step is 8")
--- drivers/media/i2c/imx219.c | 61 +++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 21 deletions(-)
drivers/media/i2c/imx219.c +40 -21
@@ -463,10 +463,14 @@ static int imx219_set_ctrl(struct v4l2_ctrl *ctrl) exposure_max = format->height + ctrl->val -4 ; exposure_def = (exposure_max <IMX219_EXPOSURE_DEFAULT ) ? exposure_max :IMX219_EXPOSURE_DEFAULT ; -__v4l2_ctrl_modify_range (imx219->exposure, - imx219->exposure->minimum, - exposure_max, imx219->exposure->step, - exposure_def); + ret =__v4l2_ctrl_modify_range (imx219->exposure, + imx219->exposure->minimum, + exposure_max, + imx219->exposure->step, + exposure_def); +if (ret) +return ret; + }/*
@@ -858,6 +862,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,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;
@@ -893,19 +898,28 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,int pixel_rate;/* Update limits and set FPS to default */ -__v4l2_ctrl_modify_range (imx219->vblank,IMX219_VBLANK_MIN , -IMX219_FLL_MAX - mode->height,1 , + ret =__v4l2_ctrl_modify_range (imx219->vblank,IMX219_VBLANK_MIN , +IMX219_FLL_MAX - mode->height,1 , + mode->fll_def - mode->height); +if (ret) +return ret; + + ret =__v4l2_ctrl_s_ctrl (imx219->vblank, mode->fll_def - mode->height); -__v4l2_ctrl_s_ctrl (imx219->vblank, - mode->fll_def - mode->height); +if (ret) +return ret; +/* Update max exposure while meeting expected vblanking */ exposure_max = mode->fll_def -4 ; exposure_def = (exposure_max <IMX219_EXPOSURE_DEFAULT ) ? exposure_max :IMX219_EXPOSURE_DEFAULT ; -__v4l2_ctrl_modify_range (imx219->exposure, - imx219->exposure->minimum, - exposure_max, imx219->exposure->step, - exposure_def); + ret =__v4l2_ctrl_modify_range (imx219->exposure, + imx219->exposure->minimum, + exposure_max, + imx219->exposure->step, + exposure_def); +if (ret) +return ret;/* * With analog binning the default minimum line length of 3448
@@ -916,9 +930,12 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,imx219_get_binning (state, &bin_h, &bin_v); llp_min = (bin_h & bin_v) ==IMX219_BINNING_X2_ANALOG ?IMX219_BINNED_LLP_MIN :IMX219_LLP_MIN ; -__v4l2_ctrl_modify_range (imx219->hblank, llp_min - mode->width, -IMX219_LLP_MAX - mode->width,1 , - llp_min - mode->width); + ret =__v4l2_ctrl_modify_range (imx219->hblank, + llp_min - mode->width, +IMX219_LLP_MAX - mode->width,1 , + 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.
@@ -927,13 +944,17 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,* mode width subtracted. */ hblank = prev_line_len - mode->width; -__v4l2_ctrl_s_ctrl (imx219->hblank, hblank); + ret =__v4l2_ctrl_s_ctrl (imx219->hblank, hblank); +if (ret) +return ret;/* Scale the pixel rate based on the mode specific factor */ pixel_rate =imx219_get_pixel_rate (imx219) *imx219_get_rate_factor (state); -__v4l2_ctrl_modify_range (imx219->pixel_rate, pixel_rate, - pixel_rate,1 , pixel_rate); + ret =__v4l2_ctrl_modify_range (imx219->pixel_rate, pixel_rate, + pixel_rate,1 , pixel_rate); +if (ret) +return ret; }return 0 ;
@@ -982,9 +1003,7 @@ static int imx219_init_state(struct v4l2_subdev *sd, }, }; -imx219_set_pad_format (sd, state, &fmt); - -return 0 ; +return imx219_set_pad_format (sd, state, &fmt); }static const struct v4l2_subdev_video_ops imx219_video_ops = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 media: imx219: The horizontal blanking step is 8
From: Sakari Ailus <[email protected]>
[ Upstream commit 47576c541e9b473841742bd0686d4940f5c93564 ]
The step for the LINE_LENGTH_A register on imx219 is 8. Take this into account in creating and modifying the horizontal blanking control. The minimum line length in pixels as well as the horizontal blanking values are already divisible by 8.
--- drivers/media/i2c/imx219.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/i2c/imx219.c +5 -2
@@ -77,6 +77,7 @@#define IMX219_LLP_MIN 0x0d78#define IMX219_BINNED_LLP_MIN 0x0de8#define IMX219_LLP_MAX 0x7ff0 +#define IMX219_LLP_STEP 8#define IMX219_REG_X_ADD_STA_A CCI_REG16(0x0164)#define IMX219_REG_X_ADD_END_A CCI_REG16(0x0166)
@@ -587,7 +588,8 @@ static int imx219_init_controls(struct imx219 *imx219) imx219->hblank =v4l2_ctrl_new_std (ctrl_hdlr, &imx219_ctrl_ops,V4L2_CID_HBLANK ,IMX219_LLP_MIN - mode->width, -IMX219_LLP_MAX - mode->width,1 , +IMX219_LLP_MAX - mode->width, +IMX219_LLP_STEP ,IMX219_LLP_MIN - mode->width); exposure_max = mode->fll_def -4 ; exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
@@ -932,7 +934,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, IMX219_BINNED_LLP_MIN :IMX219_LLP_MIN ; ret =__v4l2_ctrl_modify_range (imx219->hblank, llp_min - mode->width, -IMX219_LLP_MAX - mode->width,1 , +IMX219_LLP_MAX - mode->width, +IMX219_LLP_STEP , llp_min - mode->width);if (ret)return ret;
Signature · 1 line
2.53.0