* [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight
@ 2026-06-02 18:53 David Carlier
2026-06-05 8:05 ` Jacopo Mondi
2026-06-10 6:48 ` Dan Scally
0 siblings, 2 replies; 3+ messages in thread
From: David Carlier @ 2026-06-02 18:53 UTC (permalink / raw)
To: Daniel Scally, Jacopo Mondi
Cc: Mauro Carvalho Chehab, Nayden Kanchev, Hans Verkuil, linux-media,
linux-kernel, stable, David Carlier
The 15x15 AEC histogram metering grid has 225 per-zone weights, packed
by userspace as a u8 array. The driver writes the first 56 registers
(zones 0 through 223) in a loop, then handles the final register on its
own to keep static analysers from flagging the array access.
That separate path computes the address and value for the 225th weight
(the bottom-right zone) but never issues the register write, so the zone
keeps its stale or default weight. Any non-default weight userspace sets
for the last zone is silently ignored, skewing auto-exposure metering.
Both the AEXP_HIST_WEIGHTS and AEXP_IHIST_WEIGHTS blocks are affected as
they share this handler.
Issue the missing write, masking the value as the loop does.
Fixes: 01535ea08674 ("media: platform: Add mali-c55 parameters video node")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: David Carlier <devnexen@gmail.com>
---
drivers/media/platform/arm/mali-c55/mali-c55-params.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
index de0e9d898db7..33e2232ec8f5 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
@@ -212,6 +212,7 @@ mali_c55_params_aexp_hist_weights(struct mali_c55 *mali_c55,
val = params->zone_weights[MALI_C55_MAX_ZONES - 1];
addr = base + MALI_C55_AEXP_HIST_ZONE_WEIGHTS_OFFSET + (4 * 56);
+ mali_c55_ctx_write(mali_c55, addr, val & MALI_C55_AEXP_HIST_ZONE_WEIGHT_MASK);
}
static void mali_c55_params_digital_gain(struct mali_c55 *mali_c55,
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight
2026-06-02 18:53 [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight David Carlier
@ 2026-06-05 8:05 ` Jacopo Mondi
2026-06-10 6:48 ` Dan Scally
1 sibling, 0 replies; 3+ messages in thread
From: Jacopo Mondi @ 2026-06-05 8:05 UTC (permalink / raw)
To: David Carlier
Cc: Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
Nayden Kanchev, Hans Verkuil, linux-media, linux-kernel, stable
Hi David
On Tue, Jun 02, 2026 at 07:53:05PM +0100, David Carlier wrote:
> The 15x15 AEC histogram metering grid has 225 per-zone weights, packed
> by userspace as a u8 array. The driver writes the first 56 registers
> (zones 0 through 223) in a loop, then handles the final register on its
> own to keep static analysers from flagging the array access.
>
> That separate path computes the address and value for the 225th weight
> (the bottom-right zone) but never issues the register write, so the zone
> keeps its stale or default weight. Any non-default weight userspace sets
> for the last zone is silently ignored, skewing auto-exposure metering.
> Both the AEXP_HIST_WEIGHTS and AEXP_IHIST_WEIGHTS blocks are affected as
> they share this handler.
>
> Issue the missing write, masking the value as the loop does.
>
> Fixes: 01535ea08674 ("media: platform: Add mali-c55 parameters video node")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> drivers/media/platform/arm/mali-c55/mali-c55-params.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> index de0e9d898db7..33e2232ec8f5 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> @@ -212,6 +212,7 @@ mali_c55_params_aexp_hist_weights(struct mali_c55 *mali_c55,
>
> val = params->zone_weights[MALI_C55_MAX_ZONES - 1];
> addr = base + MALI_C55_AEXP_HIST_ZONE_WEIGHTS_OFFSET + (4 * 56);
> + mali_c55_ctx_write(mali_c55, addr, val & MALI_C55_AEXP_HIST_ZONE_WEIGHT_MASK);
Indeed!
You could also mask val with 0xf0 when assigning it if you prefer, as
we really only care about the lower byte for zone 255.
Shouldn't make any difference though
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Thanks
j
> }
>
> static void mali_c55_params_digital_gain(struct mali_c55 *mali_c55,
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight
2026-06-02 18:53 [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight David Carlier
2026-06-05 8:05 ` Jacopo Mondi
@ 2026-06-10 6:48 ` Dan Scally
1 sibling, 0 replies; 3+ messages in thread
From: Dan Scally @ 2026-06-10 6:48 UTC (permalink / raw)
To: David Carlier, Jacopo Mondi
Cc: Mauro Carvalho Chehab, Nayden Kanchev, Hans Verkuil, linux-media,
linux-kernel, stable
Hi David, thanks for the patch
On 02/06/2026 19:53, David Carlier wrote:
> The 15x15 AEC histogram metering grid has 225 per-zone weights, packed
> by userspace as a u8 array. The driver writes the first 56 registers
> (zones 0 through 223) in a loop, then handles the final register on its
> own to keep static analysers from flagging the array access.
>
> That separate path computes the address and value for the 225th weight
> (the bottom-right zone) but never issues the register write, so the zone
> keeps its stale or default weight. Any non-default weight userspace sets
> for the last zone is silently ignored, skewing auto-exposure metering.
> Both the AEXP_HIST_WEIGHTS and AEXP_IHIST_WEIGHTS blocks are affected as
> they share this handler.
>
> Issue the missing write, masking the value as the loop does.
>
> Fixes: 01535ea08674 ("media: platform: Add mali-c55 parameters video node")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
Oops! Change looks good to me:
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> drivers/media/platform/arm/mali-c55/mali-c55-params.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> index de0e9d898db7..33e2232ec8f5 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> @@ -212,6 +212,7 @@ mali_c55_params_aexp_hist_weights(struct mali_c55 *mali_c55,
>
> val = params->zone_weights[MALI_C55_MAX_ZONES - 1];
> addr = base + MALI_C55_AEXP_HIST_ZONE_WEIGHTS_OFFSET + (4 * 56);
> + mali_c55_ctx_write(mali_c55, addr, val & MALI_C55_AEXP_HIST_ZONE_WEIGHT_MASK);
> }
>
> static void mali_c55_params_digital_gain(struct mali_c55 *mali_c55,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 6:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 18:53 [PATCH] media: mali-c55: fix dropped last AEC histogram zone weight David Carlier
2026-06-05 8:05 ` Jacopo Mondi
2026-06-10 6:48 ` Dan Scally
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome