V4L/DVB (13331): mxl5005s: provide ability to override QAM gain for HVR-1600
authorDevin Heitmueller <dheitmueller@kernellabs.com>
Thu, 29 Oct 2009 02:10:16 +0000 (23:10 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:41:23 +0000 (18:41 -0200)
The HVR-1600 doesn't use the standard mechanism for computing the gain when
in QAM mode, instead always forcing it to be 0x02.  Provide the ability to
override the algorithm on a per-board basis.

This change results in an improvement of 0.4-0.6 dB for QAM tuning.

This work was sponsored by ONELAN Limited.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/mxl5005s.c
drivers/media/common/tuners/mxl5005s.h
drivers/media/video/cx18/cx18-dvb.c

index 0803dab..605e28b 100644 (file)
@@ -2789,7 +2789,10 @@ static u16 MXL_TuneRF(struct dvb_frontend *fe, u32 RF_Freq)
 
        /* add for 2.6.5 Special setting for QAM */
        if (state->Mod_Type == MXL_QAM) {
-               if (state->RF_IN < 680000000)
+               if (state->config->qam_gain != 0)
+                       status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN,
+                                                  state->config->qam_gain);
+               else if (state->RF_IN < 680000000)
                        status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3);
                else
                        status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 2);
index 7ac6815..fc8a1ff 100644 (file)
@@ -108,6 +108,10 @@ struct mxl5005s_config {
 #define MXL_LOW_IF  1
        u8 if_mode;
 
+       /* Some boards need to override the built-in logic for determining
+          the gain when in QAM mode (the HVR-1600 is one such case) */
+       u8 qam_gain;
+
        /* Stuff I don't know what to do with */
        u8 AgcMasterByte;
 };
index f402e79..54a6fd3 100644 (file)
@@ -61,6 +61,7 @@ static struct mxl5005s_config hauppauge_hvr1600_tuner = {
        .top             = MXL5005S_TOP_25P2,
        .mod_mode        = MXL_DIGITAL_MODE,
        .if_mode         = MXL_ZERO_IF,
+       .qam_gain        = 0x02,
        .AgcMasterByte   = 0x00,
 };