]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB (13334): stv6110: add configurable gain
authorAbylay Ospan <aospan@netup.ru>
Sat, 17 Oct 2009 11:23:00 +0000 (08:23 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:41:23 +0000 (18:41 -0200)
It has positive effect for NetUP Dual DVB-S2 CI card.

Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stv6110.c
drivers/media/dvb/frontends/stv6110.h
drivers/media/video/cx23885/cx23885-dvb.c

index dcf1b21ea9741971e15ad314dd59ecfcf7743cf8..bef0cc83847129e25a87f83bcc13c5a39935ba2f 100644 (file)
@@ -37,6 +37,7 @@ struct stv6110_priv {
 
        u32 mclk;
        u8 clk_div;
+       u8 gain;
        u8 regs[8];
 };
 
@@ -255,7 +256,7 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency)
        u8 ret = 0x04;
        u32 divider, ref, p, presc, i, result_freq, vco_freq;
        s32 p_calc, p_calc_opt = 1000, r_div, r_div_opt = 0, p_val;
-       s32 srate; u8 gain;
+       s32 srate;
 
        dprintk("%s, freq=%d kHz, mclk=%d Hz\n", __func__,
                                                frequency, priv->mclk);
@@ -273,15 +274,8 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency)
        } else
                srate = 15000000;
 
-       if (srate >= 15000000)
-               gain = 3; /* +6 dB */
-       else if (srate >= 5000000)
-               gain = 3; /* +6 dB */
-       else
-               gain = 3; /* +6 dB */
-
        priv->regs[RSTV6110_CTRL2] &= ~0x0f;
-       priv->regs[RSTV6110_CTRL2] |= (gain & 0x0f);
+       priv->regs[RSTV6110_CTRL2] |= (priv->gain & 0x0f);
 
        if (frequency <= 1023000) {
                p = 1;
@@ -436,6 +430,7 @@ struct dvb_frontend *stv6110_attach(struct dvb_frontend *fe,
        priv->i2c = i2c;
        priv->mclk = config->mclk;
        priv->clk_div = config->clk_div;
+       priv->gain = config->gain;
 
        memcpy(&priv->regs, &reg0[1], 8);
 
index 9db2402410f63b0b740697d8e39915102392ce7c..fe71bba6a26e0d39a6d6fa5ab149b3f10619aea9 100644 (file)
@@ -41,6 +41,7 @@
 struct stv6110_config {
        u8 i2c_address;
        u32 mclk;
+       u8 gain;
        u8 clk_div;     /* divisor value for the output clock */
 };
 
index f4f046cd81a5354df9d78e73e3bd100dd52a0b72..0180b75d1f3dbf5d9f1541af2294601c1782046d 100644 (file)
@@ -414,12 +414,14 @@ static struct stv6110_config netup_stv6110_tunerconfig_a = {
        .i2c_address = 0x60,
        .mclk = 16000000,
        .clk_div = 1,
+       .gain = 8, /* +16 dB  - maximum gain */
 };
 
 static struct stv6110_config netup_stv6110_tunerconfig_b = {
        .i2c_address = 0x63,
        .mclk = 16000000,
        .clk_div = 1,
+       .gain = 8, /* +16 dB  - maximum gain */
 };
 
 static int tbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)