Skip to contentSkip to conversation

Fix filter mode register issue

PATCH In review Rui Wang 3 participants 4 messages Dec 2, 2025 – Jan 5

Subsystems (3)
lore
Share & tools
lore

Rui Wang

author
#0 lore raw

cover Fix filter mode register issue

Hi,

This series contains a single patch that fixes an issue in the rkisp1 filter mode configuration logic.

The rkisp1_flt_config() function performs a direct write to the FILT_MODE register before the read/modify/write update. This write does not include the RKISP1_CIF_ISP_FLT_ENA bit, which clears the enable bit in hardware. After that, the read/modify/write sequence cannot restore the original enable state, causing the filter to be disabled unintentionally.

The patch removes the redundant direct write. The remaining read/modify/write sequence correctly updates the mode fields while preserving the existing enable bit.

Please review.

Thanks,
Rui Wang

Rui Wang (1):
media: rkisp1: Fix filter mode register configuration

 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 6 ------
 1 file changed, 6 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/1 media: rkisp1: Fix filter mode register configuration

The rkisp1_flt_config() function performs an initial direct write to RKISP1_CIF_ISP_FILT_MODE without including the RKISP1_CIF_ISP_FLT_ENA bit, which clears the filter enable bit in the hardware.

The subsequent read/modify/write sequence then reads back the register with the enable bit already cleared and cannot restore it, resulting in the filter being inadvertently disabled.

Remove the redundant direct write. The read/modify/write sequence alone correctly preserves the existing enable bit state while updating the DNR mode and filter configuration bits.

---
 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 -6
index c9f88635224c..6442436a5e42 100644
@@ -411,12 +411,6 @@ static void rkisp1_flt_config(struct rkisp1_params *params,
 	rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_LUM_WEIGHT,
 		     arg->lum_weight);
 
-	rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE,
-		     (arg->mode ? RKISP1_CIF_ISP_FLT_MODE_DNR : 0) |
-		     RKISP1_CIF_ISP_FLT_CHROMA_V_MODE(arg->chr_v_mode) |
-		     RKISP1_CIF_ISP_FLT_CHROMA_H_MODE(arg->chr_h_mode) |
-		     RKISP1_CIF_ISP_FLT_GREEN_STAGE1(arg->grn_stage1));
-
 	/* avoid to override the old enable value */
 	filt_mode = rkisp1_read(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE);
 	filt_mode &= RKISP1_CIF_ISP_FLT_ENA;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH v1 1/1] media: rkisp1: Fix filter mode register configuration

Hi Rui,

Thank you for the patch.

Quoting Rui Wang (2025-12-02 02:50:25)

Quoted 3 lines

The rkisp1_flt_config() function performs an initial direct write to RKISP1_CIF_ISP_FILT_MODE without including the RKISP1_CIF_ISP_FLT_ENA bit, which clears the filter enable bit in the hardware.

That sentence is a bit hard for me to understand. Maybe:

"The rkisp1_flt_config() function overwrites RKISP1_CIF_ISP_FILT_MODE without preserving the RKISP1_CIF_ISP_FLT_ENA bit thereby unconditionally disabling the hardware block on reconfiguration.

But as I'm no native speaker you could maybe wait for feedback from a native speaker.

Functionality wise the change is correct.

Best regards,
Stefan

Quoted 34 lines

The subsequent read/modify/write sequence then reads back the register with the enable bit already cleared and cannot restore it, resulting in the filter being inadvertently disabled.

Remove the redundant direct write. The read/modify/write sequence alone correctly preserves the existing enable bit state while updating the DNR mode and filter configuration bits.

---
 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 -6
index c9f88635224c..6442436a5e42 100644
@@ -411,12 +411,6 @@ static void rkisp1_flt_config(struct rkisp1_params *params,
        rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_LUM_WEIGHT,
                     arg->lum_weight);
 
-       rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE,
-                    (arg->mode ? RKISP1_CIF_ISP_FLT_MODE_DNR : 0) |
-                    RKISP1_CIF_ISP_FLT_CHROMA_V_MODE(arg->chr_v_mode) |
-                    RKISP1_CIF_ISP_FLT_CHROMA_H_MODE(arg->chr_h_mode) |
-                    RKISP1_CIF_ISP_FLT_GREEN_STAGE1(arg->grn_stage1));
-
        /* avoid to override the old enable value */
        filt_mode = rkisp1_read(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE);
        filt_mode &= RKISP1_CIF_ISP_FLT_ENA;
Signature · 1 line
2.43.0
Reviewed-by
#3 lore raw

Re: [PATCH v1 1/1] media: rkisp1: Fix filter mode register configuration

Quoting Stefan Klug (2025-12-02 06:42:36)

Quoted 9 lines

Hi Rui,

Thank you for the patch.

Quoting Rui Wang (2025-12-02 02:50:25)

Quoted 3 lines

The rkisp1_flt_config() function performs an initial direct write to RKISP1_CIF_ISP_FILT_MODE without including the RKISP1_CIF_ISP_FLT_ENA bit, which clears the filter enable bit in the hardware.

Quoted 5 lines

That sentence is a bit hard for me to understand. Maybe:

"The rkisp1_flt_config() function overwrites RKISP1_CIF_ISP_FILT_MODE without preserving the RKISP1_CIF_ISP_FLT_ENA bit thereby unconditionally disabling the hardware block on reconfiguration.

Stefan's proposal sounds good here.

Quoted 45 lines

But as I'm no native speaker you could maybe wait for feedback from a native speaker.

Functionality wise the change is correct.

Best regards,
Stefan

Quoted 34 lines

The subsequent read/modify/write sequence then reads back the register with the enable bit already cleared and cannot restore it, resulting in the filter being inadvertently disabled.

Remove the redundant direct write. The read/modify/write sequence alone correctly preserves the existing enable bit state while updating the DNR mode and filter configuration bits.

---
 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 -6
index c9f88635224c..6442436a5e42 100644
@@ -411,12 +411,6 @@ static void rkisp1_flt_config(struct rkisp1_params *params,
        rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_LUM_WEIGHT,
                     arg->lum_weight);
 
-       rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE,
-                    (arg->mode ? RKISP1_CIF_ISP_FLT_MODE_DNR : 0) |
-                    RKISP1_CIF_ISP_FLT_CHROMA_V_MODE(arg->chr_v_mode) |
-                    RKISP1_CIF_ISP_FLT_CHROMA_H_MODE(arg->chr_h_mode) |
-                    RKISP1_CIF_ISP_FLT_GREEN_STAGE1(arg->grn_stage1));
-
        /* avoid to override the old enable value */
        filt_mode = rkisp1_read(params->rkisp1, RKISP1_CIF_ISP_FILT_MODE);
        filt_mode &= RKISP1_CIF_ISP_FLT_ENA;
Signature · 1 line
2.43.0