public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mxl5005s: bad checks of state->Mode
@ 2010-01-20  2:20 Roel Kluin
  2010-01-20  3:23 ` Devin Heitmueller
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2010-01-20  2:20 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

Regardless of the state->Mode in both cases the same value was
written.
If state->Mode wasn't set, it is always 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 drivers/media/common/tuners/mxl5005s.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

Or were the ones and zeroes in these MXL_ControlWrite in the wrong place?

diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c
index 605e28b..3967412 100644
--- a/drivers/media/common/tuners/mxl5005s.c
+++ b/drivers/media/common/tuners/mxl5005s.c
@@ -1815,9 +1815,8 @@ static u16 MXL_BlockInit(struct dvb_frontend *fe)
 
 	/* Charge Pump Control Dig  Ana */
 	status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, state->Mode ? 5 : 8);
-	status += MXL_ControlWrite(fe,
-		RFSYN_EN_CHP_HIGAIN, state->Mode ? 1 : 1);
-	status += MXL_ControlWrite(fe, EN_CHP_LIN_B, state->Mode ? 0 : 0);
+	status += MXL_ControlWrite(fe, RFSYN_EN_CHP_HIGAIN, 1);
+	status += MXL_ControlWrite(fe, EN_CHP_LIN_B, 0);
 
 	/* AGC TOP Control */
 	if (state->AGC_Mode == 0) /* Dual AGC */ {
@@ -2161,7 +2160,7 @@ static u16 MXL_IFSynthInit(struct dvb_frontend *fe)
 		}
 	}
 
-	if (state->Mode || (state->Mode == 0 && state->IF_Mode == 0)) {
+	if (state->Mode || state->IF_Mode == 0) {
 		if (state->IF_LO == 57000000UL) {
 			status += MXL_ControlWrite(fe, IF_DIVVAL,   0x10);
 			status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);

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

* Re: [PATCH] mxl5005s: bad checks of state->Mode
  2010-01-20  2:20 [PATCH] mxl5005s: bad checks of state->Mode Roel Kluin
@ 2010-01-20  3:23 ` Devin Heitmueller
  0 siblings, 0 replies; 2+ messages in thread
From: Devin Heitmueller @ 2010-01-20  3:23 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

On Tue, Jan 19, 2010 at 9:20 PM, Roel Kluin <roel.kluin@gmail.com> wrote:
> Regardless of the state->Mode in both cases the same value was
> written.
> If state->Mode wasn't set, it is always 0.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  drivers/media/common/tuners/mxl5005s.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
>
> Or were the ones and zeroes in these MXL_ControlWrite in the wrong place?
>
> diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c
> index 605e28b..3967412 100644
> --- a/drivers/media/common/tuners/mxl5005s.c
> +++ b/drivers/media/common/tuners/mxl5005s.c
> @@ -1815,9 +1815,8 @@ static u16 MXL_BlockInit(struct dvb_frontend *fe)
>
>        /* Charge Pump Control Dig  Ana */
>        status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, state->Mode ? 5 : 8);
> -       status += MXL_ControlWrite(fe,
> -               RFSYN_EN_CHP_HIGAIN, state->Mode ? 1 : 1);
> -       status += MXL_ControlWrite(fe, EN_CHP_LIN_B, state->Mode ? 0 : 0);
> +       status += MXL_ControlWrite(fe, RFSYN_EN_CHP_HIGAIN, 1);
> +       status += MXL_ControlWrite(fe, EN_CHP_LIN_B, 0);
>
>        /* AGC TOP Control */
>        if (state->AGC_Mode == 0) /* Dual AGC */ {
> @@ -2161,7 +2160,7 @@ static u16 MXL_IFSynthInit(struct dvb_frontend *fe)
>                }
>        }
>
> -       if (state->Mode || (state->Mode == 0 && state->IF_Mode == 0)) {
> +       if (state->Mode || state->IF_Mode == 0) {
>                if (state->IF_LO == 57000000UL) {
>                        status += MXL_ControlWrite(fe, IF_DIVVAL,   0x10);
>                        status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);

Roel,

Thanks for pointing this out.

This patch should not be applied.

While I agree with Roel's assessment that the logic is incorrect,
removing the conditional logic and forcing the register writes to the
given value is almost certainly the incorrect fix.  I will have to
look at the datasheet and see what the logic is actually supposed to
be.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

end of thread, other threads:[~2010-01-20  3:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20  2:20 [PATCH] mxl5005s: bad checks of state->Mode Roel Kluin
2010-01-20  3:23 ` Devin Heitmueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox