Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b03238a79295aff30afc3d9a82afa617fd33971
Commit:     2b03238a79295aff30afc3d9a82afa617fd33971
Parent:     18ff605a18b29ab1b52d31f96e2ecbaf7a042a3e
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 13 10:04:10 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:03:44 2008 -0200

    V4L/DVB (6821): s5h1409: fix IF frequency configuration
    
    On the s5h1409 demod, the IF frequency for VSB is limited to 44 / 5.38 MHz.
    
    Hardcode VSB IF frequency within the driver to 44 / 5.38 MHz.
    QAM IF frequency remains configurable via attach-time configuration.
    
    Acked-by: Steven Toth <[EMAIL PROTECTED]>
    Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/frontends/s5h1409.c     |   14 +++++++++++++-
 drivers/media/dvb/frontends/s5h1409.h     |    4 ++--
 drivers/media/video/cx23885/cx23885-dvb.c |    4 ++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb/frontends/s5h1409.c 
b/drivers/media/dvb/frontends/s5h1409.c
index 562d920..b80a3ee 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -42,6 +42,7 @@ struct s5h1409_state {
        fe_modulation_t current_modulation;
 
        u32 current_frequency;
+       int if_freq;
 
        u32 is_qam_locked;
        u32 qam_state;
@@ -348,6 +349,9 @@ static int s5h1409_softreset(struct dvb_frontend* fe)
        return 0;
 }
 
+#define S5H1409_VSB_IF_FREQ 5380
+#define S5H1409_QAM_IF_FREQ state->config->qam_if
+
 static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
 {
        struct s5h1409_state* state = fe->demodulator_priv;
@@ -369,6 +373,9 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int 
KHz)
                ret = -1;
        }
 
+       if (0 == ret)
+               state->if_freq = KHz;
+
        return ret;
 }
 
@@ -394,11 +401,15 @@ static int s5h1409_enable_modulation(struct dvb_frontend* 
fe,
        switch(m) {
        case VSB_8:
                dprintk("%s() VSB_8\n", __FUNCTION__);
+               if (state->if_freq != S5H1409_VSB_IF_FREQ)
+                       s5h1409_set_if_freq(fe, S5H1409_VSB_IF_FREQ);
                s5h1409_writereg(state, 0xf4, 0);
                break;
        case QAM_64:
        case QAM_256:
                dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__);
+               if (state->if_freq != S5H1409_QAM_IF_FREQ)
+                       s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ);
                s5h1409_writereg(state, 0xf4, 1);
                s5h1409_writereg(state, 0x85, 0x110);
                break;
@@ -571,7 +582,7 @@ static int s5h1409_init (struct dvb_frontend* fe)
                s5h1409_writereg(state, 0xab, 0x0); /* Parallel */
 
        s5h1409_set_spectralinversion(fe, state->config->inversion);
-       s5h1409_set_if_freq(fe, state->config->if_freq);
+       s5h1409_set_if_freq(fe, state->if_freq);
        s5h1409_set_gpio(fe, state->config->gpio);
        s5h1409_softreset(fe);
 
@@ -751,6 +762,7 @@ struct dvb_frontend* s5h1409_attach(const struct 
s5h1409_config* config,
        state->config = config;
        state->i2c = i2c;
        state->current_modulation = 0;
+       state->if_freq = S5H1409_VSB_IF_FREQ;
 
        /* check if the demod exists */
        if (s5h1409_readreg(state, 0x04) != 0x0066)
diff --git a/drivers/media/dvb/frontends/s5h1409.h 
b/drivers/media/dvb/frontends/s5h1409.h
index 20f9af1..b1f4339 100644
--- a/drivers/media/dvb/frontends/s5h1409.h
+++ b/drivers/media/dvb/frontends/s5h1409.h
@@ -39,8 +39,8 @@ struct s5h1409_config
 #define S5H1409_GPIO_ON  1
        u8 gpio;
 
-       /* IF Freq in KHz */
-       u16 if_freq;
+       /* IF Freq for QAM in KHz, VSB is hardcoded to 5380 */
+       u16 qam_if;
 
        /* Spectral Inversion */
 #define S5H1409_INVERSION_OFF 0
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c 
b/drivers/media/video/cx23885/cx23885-dvb.c
index eda8c05..96d7320 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -85,7 +85,7 @@ static struct s5h1409_config hauppauge_generic_config = {
        .demod_address = 0x32 >> 1,
        .output_mode   = S5H1409_SERIAL_OUTPUT,
        .gpio          = S5H1409_GPIO_ON,
-       .if_freq       = 44000,
+       .qam_if        = 44000,
        .inversion     = S5H1409_INVERSION_OFF,
        .status_mode   = S5H1409_DEMODLOCKING
 };
@@ -94,7 +94,7 @@ static struct s5h1409_config hauppauge_hvr1800lp_config = {
        .demod_address = 0x32 >> 1,
        .output_mode   = S5H1409_SERIAL_OUTPUT,
        .gpio          = S5H1409_GPIO_OFF,
-       .if_freq       = 44000,
+       .qam_if        = 44000,
        .inversion     = S5H1409_INVERSION_OFF,
        .status_mode   = S5H1409_DEMODLOCKING
 };
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to