Skip to contentSkip to conversation

media: mali-c55: Fix AEXP IHIST disable bit shift

PATCH In review David Carlier 3 participants 3 messages Jun 9 – Jun 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: mali-c55: Fix AEXP IHIST disable bit shift

The post-Iridix auto-exposure histogram disable bit in MALI_C55_REG_METERING_CONFIG is bit 16, but MALI_C55_AEXP_IHIST_DISABLE was defined with a shift of 12, copied from the AEXP_HIST definition above it. As the value is masked with the BIT(16) disable mask when it is programmed, the result is always zero and the disable bit is never set. The IHIST can therefore never be disabled, neither at ISP init nor via a parameters block flagged V4L2_ISP_PARAMS_FL_BLOCK_DISABLE, and the hardware keeps producing histogram statistics that userspace believes are switched off.

Use a shift of 16 so the disable request takes effect.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Assisted-by Claude:claude-opus-4-8
---
 drivers/media/platform/arm/mali-c55/mali-c55-registers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +1 -1
index f098effde..4cd13b702 100644
@@ -173,7 +173,7 @@ enum mali_c55_interrupts {
 #define MALI_C55_AEXP_HIST_SWITCH_MASK			GENMASK(14, 13)
 #define MALI_C55_AEXP_HIST_SWITCH(x)			((x) << 13)
 #define MALI_C55_AEXP_IHIST_DISABLE_MASK		BIT(16)
-#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 12)
+#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 16)
 #define MALI_C55_AEXP_SRC_MASK				BIT(24)
 
 #define MALI_C55_REG_TPG_CH0				0x18ed8
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi David

Quoted 25 lines · David Carlier

The post-Iridix auto-exposure histogram disable bit in MALI_C55_REG_METERING_CONFIG is bit 16, but MALI_C55_AEXP_IHIST_DISABLE was defined with a shift of 12, copied from the AEXP_HIST definition above it. As the value is masked with the BIT(16) disable mask when it is programmed, the result is always zero and the disable bit is never set. The IHIST can therefore never be disabled, neither at ISP init nor via a parameters block flagged V4L2_ISP_PARAMS_FL_BLOCK_DISABLE, and the hardware keeps producing histogram statistics that userspace believes are switched off.

Use a shift of 16 so the disable request takes effect.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Assisted-by Claude:claude-opus-4-8
---
 drivers/media/platform/arm/mali-c55/mali-c55-registers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +0 -0
index f098effde..4cd13b702 100644

drivers/media/platform/arm/mali-c55/mali-c55-registers.h enum mali_c55_interrupts { · line 176

Quoted 5 lines
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +1 -1
@@ -173,7 +173,7 @@ enum mali_c55_interrupts {
 #define MALI_C55_AEXP_HIST_SWITCH_MASK			GENMASK(14, 13)
 #define MALI_C55_AEXP_HIST_SWITCH(x)			((x) << 13)
 #define MALI_C55_AEXP_IHIST_DISABLE_MASK		BIT(16)
-#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 12)
+#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 16)

Thanks, this indeed was a bad copy and paste I presume

Quoted 6 lines
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +0 -1
 #define MALI_C55_AEXP_SRC_MASK				BIT(24)
 
 #define MALI_C55_REG_TPG_CH0				0x18ed8
--

2.53.0

maintainer Reviewed-by
#2 lore raw
Quoted 35 lines · Jacopo Mondi

Hi David

Quoted 25 lines · David Carlier

The post-Iridix auto-exposure histogram disable bit in MALI_C55_REG_METERING_CONFIG is bit 16, but MALI_C55_AEXP_IHIST_DISABLE was defined with a shift of 12, copied from the AEXP_HIST definition above it. As the value is masked with the BIT(16) disable mask when it is programmed, the result is always zero and the disable bit is never set. The IHIST can therefore never be disabled, neither at ISP init nor via a parameters block flagged V4L2_ISP_PARAMS_FL_BLOCK_DISABLE, and the hardware keeps producing histogram statistics that userspace believes are switched off.

Use a shift of 16 so the disable request takes effect.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Assisted-by Claude:claude-opus-4-8
---
  drivers/media/platform/arm/mali-c55/mali-c55-registers.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +0 -0
index f098effde..4cd13b702 100644

drivers/media/platform/arm/mali-c55/mali-c55-registers.h enum mali_c55_interrupts { · line 176

Quoted 5 lines
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +1 -1
@@ -173,7 +173,7 @@ enum mali_c55_interrupts {
  #define MALI_C55_AEXP_HIST_SWITCH_MASK			GENMASK(14, 13)
  #define MALI_C55_AEXP_HIST_SWITCH(x)			((x) << 13)
  #define MALI_C55_AEXP_IHIST_DISABLE_MASK		BIT(16)
-#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 12)
+#define MALI_C55_AEXP_IHIST_DISABLE			(0x01 << 16)

Thanks, this indeed was a bad copy and paste I presume

Quoted 1 line

Yup, looks like it to me

Quoted 7 lines
Quoted 7 lines
drivers/media/platform/arm/mali-c55/mali-c55-registers.h +0 -1
  #define MALI_C55_AEXP_SRC_MASK				BIT(24)
 
  #define MALI_C55_REG_TPG_CH0				0x18ed8
--

2.53.0