diff mbox series

media: i2c: adv748x: Fix test pattern selection mask

Message ID 20250121204400.4184438-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series media: i2c: adv748x: Fix test pattern selection mask | expand

Commit Message

Niklas Söderlund Jan. 21, 2025, 8:44 p.m. UTC
The mask to select the test-pattern in register ADV748X_SDP_FRP is
incorrect, it's the lower 3 bits which controls the pattern. The
GENMASK() macro is used incorrectly and the generated mask is 0x0e
instead of 0x07.

The result is that not all test patterns are selectable, and that in
some cases the wrong test pattern is activated. Fix this my correcting
the GENMASK().

Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/i2c/adv748x/adv748x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Feb. 4, 2025, 11:24 p.m. UTC | #1
Quoting Niklas Söderlund (2025-01-21 20:44:00)
> The mask to select the test-pattern in register ADV748X_SDP_FRP is
> incorrect, it's the lower 3 bits which controls the pattern. The
> GENMASK() macro is used incorrectly and the generated mask is 0x0e
> instead of 0x07.
> 
> The result is that not all test patterns are selectable, and that in
> some cases the wrong test pattern is activated. Fix this my correcting
> the GENMASK().
> 
> Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Eeep, this was a long time ago - but indeed, pulling up the datasheet I
can see:

"free_run_pat_sel[2:0], SDP Main Map, Address 0x14[2:0]."

No idea how this ended up being put in as 3,1 before but good find!

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  drivers/media/i2c/adv748x/adv748x.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
> index 9bc0121d0eff..2c1db5968af8 100644
> --- a/drivers/media/i2c/adv748x/adv748x.h
> +++ b/drivers/media/i2c/adv748x/adv748x.h
> @@ -320,7 +320,7 @@ struct adv748x_state {
>  
>  /* Free run pattern select */
>  #define ADV748X_SDP_FRP                        0x14
> -#define ADV748X_SDP_FRP_MASK           GENMASK(3, 1)
> +#define ADV748X_SDP_FRP_MASK           GENMASK(2, 0)
>  
>  /* Saturation */
>  #define ADV748X_SDP_SD_SAT_U           0xe3    /* user_map_rw_reg_e3 */
> -- 
> 2.48.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index 9bc0121d0eff..2c1db5968af8 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -320,7 +320,7 @@  struct adv748x_state {
 
 /* Free run pattern select */
 #define ADV748X_SDP_FRP			0x14
-#define ADV748X_SDP_FRP_MASK		GENMASK(3, 1)
+#define ADV748X_SDP_FRP_MASK		GENMASK(2, 0)
 
 /* Saturation */
 #define ADV748X_SDP_SD_SAT_U		0xe3	/* user_map_rw_reg_e3 */