All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: i2c: adv7180: fix reserved bit in Video Selection 2
@ 2022-05-12  8:08 Benjamin Marty
  2022-05-12  8:42 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Marty @ 2022-05-12  8:08 UTC (permalink / raw)
  To: linux-media; +Cc: Benjamin Marty

This bit is marked as reserved in the ADV Hardware Reference Manual.

Resetting this bit seems to cause increased video noise. Setting this bit according to the Hardware Reference Manual reduces the video noise immediately.

Signed-off-by: Benjamin Marty <info@benjaminmarty.ch>
---
 drivers/media/i2c/adv7180.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 4f5db195e66d..d99b22286b74 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1014,7 +1014,8 @@ static int adv7182_init(struct adv7180_state *state)
 
 static int adv7182_set_std(struct adv7180_state *state, unsigned int std)
 {
-	return adv7180_write(state, ADV7182_REG_INPUT_VIDSEL, std << 4);
+	return adv7180_write(state, ADV7182_REG_INPUT_VIDSEL,
+			     (std << 4) | (0x01 << 2));
 }
 
 enum adv7182_input_type {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: i2c: adv7180: fix reserved bit in Video Selection 2
  2022-05-12  8:08 [PATCH] media: i2c: adv7180: fix reserved bit in Video Selection 2 Benjamin Marty
@ 2022-05-12  8:42 ` Kieran Bingham
  0 siblings, 0 replies; 2+ messages in thread
From: Kieran Bingham @ 2022-05-12  8:42 UTC (permalink / raw)
  To: Benjamin Marty, linux-media; +Cc: Benjamin Marty

Hi Benjamin,

Thank you for your patch, and your investigation into this issue.

Quoting Benjamin Marty (2022-05-12 09:08:59)
> This bit is marked as reserved in the ADV Hardware Reference Manual.
> 
> Resetting this bit seems to cause increased video noise. Setting this bit according to the Hardware Reference Manual reduces the video noise immediately.

It's quite minor, but please try to wrap your commit messages:

> Resetting this bit seems to cause increased video noise. Setting this
> bit according to the Hardware Reference Manual reduces the video noise
> immediately.


> Signed-off-by: Benjamin Marty <info@benjaminmarty.ch>
> ---
>  drivers/media/i2c/adv7180.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index 4f5db195e66d..d99b22286b74 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -1014,7 +1014,8 @@ static int adv7182_init(struct adv7180_state *state)
>  
>  static int adv7182_set_std(struct adv7180_state *state, unsigned int std)
>  {
> -       return adv7180_write(state, ADV7182_REG_INPUT_VIDSEL, std << 4);
> +       return adv7180_write(state, ADV7182_REG_INPUT_VIDSEL,
> +                            (std << 4) | (0x01 << 2));

This should be defined using a macro and use BIT() to be clearer, for
instance:

 #define ADV7182_REG_INPUT_RESERVED BIT(2)

That definition should live near the defintion of
ADV7182_REG_INPUT_VIDSEL.

If the bit is documented with a better name, then use that of course,
otherwise perhaps even a comment in the code saying that failing to set
the bit increases visible noise would be suitable. (or that setting the
bit reduces noise, I guess it depends on if you think this bit is
performing noise reduction, or if not setting it is introducing noise)

--
Kieran



>  }
>  
>  enum adv7182_input_type {
> -- 
> 2.36.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-12  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  8:08 [PATCH] media: i2c: adv7180: fix reserved bit in Video Selection 2 Benjamin Marty
2022-05-12  8:42 ` Kieran Bingham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.