FAILED: patch "[PATCH] media: microchip-isc: fix WB offset and gain register field masking" failed to apply to 5.10-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 6e9eaa3b93870e4edac1bd2539fe113c24663eaf
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 6e9eaa3b93870e4edac1bd2539fe113c24663eaf Mon Sep 17 00:00:00 2001
From: Balakrishnan Sambath <[email protected]>
Date: Mon, 17 Aug 2026 12:22:07 +0530
Subject: [PATCH] media: microchip-isc: fix WB offset and gain register field
masking
ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset sign-extends and corrupts the adjacent field. Add masks for the two fields and write them with FIELD_PREP(), which masks each value into its field, so sign extension can no longer bleed across.
--- .../platform/microchip/microchip-isc-base.c | 16 ++++++++-------- .../platform/microchip/microchip-isc-regs.h | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/media/platform/microchip/microchip-isc-base.c +8 -8
@@ -63,17 +63,17 @@ static inline void isc_update_awb_ctrls(struct isc_device *isc)/* In here we set our actual hw pipeline config */ regmap_write (isc->regmap,ISC_WB_O_RGR , - ((ctrls->offset[ISC_HIS_CFG_MODE_R ])) | - ((ctrls->offset[ISC_HIS_CFG_MODE_GR ]) <<16 )); +FIELD_PREP (ISC_WB_O_LO , ctrls->offset[ISC_HIS_CFG_MODE_R ]) | +FIELD_PREP (ISC_WB_O_HI , ctrls->offset[ISC_HIS_CFG_MODE_GR ]));regmap_write (isc->regmap,ISC_WB_O_BGB , - ((ctrls->offset[ISC_HIS_CFG_MODE_B ])) | - ((ctrls->offset[ISC_HIS_CFG_MODE_GB ]) <<16 )); +FIELD_PREP (ISC_WB_O_LO , ctrls->offset[ISC_HIS_CFG_MODE_B ]) | +FIELD_PREP (ISC_WB_O_HI , ctrls->offset[ISC_HIS_CFG_MODE_GB ]));regmap_write (isc->regmap,ISC_WB_G_RGR , - ctrls->gain[ISC_HIS_CFG_MODE_R ] | - (ctrls->gain[ISC_HIS_CFG_MODE_GR ] <<16 )); +FIELD_PREP (ISC_WB_G_LO , ctrls->gain[ISC_HIS_CFG_MODE_R ]) | +FIELD_PREP (ISC_WB_G_HI , ctrls->gain[ISC_HIS_CFG_MODE_GR ]));regmap_write (isc->regmap,ISC_WB_G_BGB , - ctrls->gain[ISC_HIS_CFG_MODE_B ] | - (ctrls->gain[ISC_HIS_CFG_MODE_GB ] <<16 )); +FIELD_PREP (ISC_WB_G_LO , ctrls->gain[ISC_HIS_CFG_MODE_B ]) | +FIELD_PREP (ISC_WB_G_HI , ctrls->gain[ISC_HIS_CFG_MODE_GB ])); }static inline void isc_reset_awb_ctrls (struct isc_device *isc)
drivers/media/platform/microchip/microchip-isc-regs.h +6 -0
@@ -149,6 +149,12 @@/* ISC White Balance Gain for B, GB Register */ #define ISC_WB_G_BGB 0x0000006c +/* Each WB offset/gain register packs two 13-bit fields, low and high */ +#define ISC_WB_O_LO GENMASK(12, 0)/* R or B offset [12:0] */ +#define ISC_WB_O_HI GENMASK(28, 16)/* GR or GB offset [28:16] */ +#define ISC_WB_G_LO GENMASK(12, 0)/* R or B gain [12:0] */ +#define ISC_WB_G_HI GENMASK(28, 16)/* GR or GB gain [28:16] */ +/* ISC Color Filter Array Control Register */ #define ISC_CFA_CTRL 0x00000070
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: microchip-isc: fix WB offset and gain register field masking
From: Balakrishnan Sambath <[email protected]>
[ Upstream commit 6e9eaa3b93870e4edac1bd2539fe113c24663eaf ]
ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset sign-extends and corrupts the adjacent field. Add masks for the two fields and write them with FIELD_PREP(), which masks each value into its field, so sign extension can no longer bleed across.
--- drivers/media/platform/atmel/atmel-isc-base.c | 17 +++++++++-------- drivers/media/platform/atmel/atmel-isc-regs.h | 6 ++++++ 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +9 -8
@@ -9,6 +9,7 @@* */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/clkdev.h> #include <linux/clk-provider.h>
@@ -248,17 +249,17 @@ static inline void isc_update_awb_ctrls(struct isc_device *isc)/* In here we set our actual hw pipeline config */ regmap_write (isc->regmap,ISC_WB_O_RGR , - ((ctrls->offset[ISC_HIS_CFG_MODE_R ])) | - ((ctrls->offset[ISC_HIS_CFG_MODE_GR ]) <<16 )); +FIELD_PREP (ISC_WB_O_LO , ctrls->offset[ISC_HIS_CFG_MODE_R ]) | +FIELD_PREP (ISC_WB_O_HI , ctrls->offset[ISC_HIS_CFG_MODE_GR ]));regmap_write (isc->regmap,ISC_WB_O_BGB , - ((ctrls->offset[ISC_HIS_CFG_MODE_B ])) | - ((ctrls->offset[ISC_HIS_CFG_MODE_GB ]) <<16 )); +FIELD_PREP (ISC_WB_O_LO , ctrls->offset[ISC_HIS_CFG_MODE_B ]) | +FIELD_PREP (ISC_WB_O_HI , ctrls->offset[ISC_HIS_CFG_MODE_GB ]));regmap_write (isc->regmap,ISC_WB_G_RGR , - ctrls->gain[ISC_HIS_CFG_MODE_R ] | - (ctrls->gain[ISC_HIS_CFG_MODE_GR ] <<16 )); +FIELD_PREP (ISC_WB_G_LO , ctrls->gain[ISC_HIS_CFG_MODE_R ]) | +FIELD_PREP (ISC_WB_G_HI , ctrls->gain[ISC_HIS_CFG_MODE_GR ]));regmap_write (isc->regmap,ISC_WB_G_BGB , - ctrls->gain[ISC_HIS_CFG_MODE_B ] | - (ctrls->gain[ISC_HIS_CFG_MODE_GB ] <<16 )); +FIELD_PREP (ISC_WB_G_LO , ctrls->gain[ISC_HIS_CFG_MODE_B ]) | +FIELD_PREP (ISC_WB_G_HI , ctrls->gain[ISC_HIS_CFG_MODE_GB ])); }static inline void isc_reset_awb_ctrls (struct isc_device *isc)
drivers/media/platform/atmel/atmel-isc-regs.h +6 -0
@@ -108,6 +108,12 @@/* ISC White Balance Gain for B, GB Register */ #define ISC_WB_G_BGB 0x0000006c +/* Each WB offset/gain register packs two 13-bit fields, low and high */ +#define ISC_WB_O_LO GENMASK(12, 0)/* R or B offset [12:0] */ +#define ISC_WB_O_HI GENMASK(28, 16)/* GR or GB offset [28:16] */ +#define ISC_WB_G_LO GENMASK(12, 0)/* R or B gain [12:0] */ +#define ISC_WB_G_HI GENMASK(28, 16)/* GR or GB gain [28:16] */ +/* ISC Color Filter Array Control Register */ #define ISC_CFA_CTRL 0x00000070
Signature · 1 line
2.53.0