The patch number 9890 was added via Mauro Carvalho Chehab <mche...@redhat.com>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        v4l-dvb-maintai...@linuxtv.org

------

From: Mauro Carvalho Chehab  <mche...@redhat.com>
merge: http://linuxtv.org/hg/~pb/v4l-dvb/


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 linux/drivers/media/dvb/frontends/cx24113.c |   78 +++++++++++---------
 1 file changed, 43 insertions(+), 35 deletions(-)

diff -r 0aaf682b419c -r 2c4c547cb482 linux/drivers/media/dvb/frontends/cx24113.c
--- a/linux/drivers/media/dvb/frontends/cx24113.c       Sun Dec 14 20:39:03 
2008 -0200
+++ b/linux/drivers/media/dvb/frontends/cx24113.c       Sun Dec 14 21:53:32 
2008 -0200
@@ -1,5 +1,5 @@
 /*
- *  Driver for Conexant CX24113/CX24128 Tuner (Satelite)
+ *  Driver for Conexant CX24113/CX24128 Tuner (Satellite)
  *
  *  Copyright (C) 2007-8 Patrick Boettcher <p...@linuxtv.org>
  *
@@ -50,46 +50,46 @@ struct cx24113_state {
        u8 rev;
        u8 ver;
 
-    u8 icp_mode:1;
+       u8 icp_mode:1;
 
 #define ICP_LEVEL1 0
 #define ICP_LEVEL2 1
 #define ICP_LEVEL3 2
 #define ICP_LEVEL4 3
-    u8 icp_man:2;
-    u8 icp_auto_low:2;
-    u8 icp_auto_mlow:2;
-    u8 icp_auto_mhi:2;
-    u8 icp_auto_hi:2;
-    u8 icp_dig;
+       u8 icp_man:2;
+       u8 icp_auto_low:2;
+       u8 icp_auto_mlow:2;
+       u8 icp_auto_mhi:2;
+       u8 icp_auto_hi:2;
+       u8 icp_dig;
 
 #define LNA_MIN_GAIN 0
 #define LNA_MID_GAIN 1
 #define LNA_MAX_GAIN 2
-    u8 lna_gain:2;
-
-    u8 acp_on:1;
-
-    u8 vco_mode:2;
-    u8 vco_shift:1;
+       u8 lna_gain:2;
+
+       u8 acp_on:1;
+
+       u8 vco_mode:2;
+       u8 vco_shift:1;
 #define VCOBANDSEL_6 0x80
 #define VCOBANDSEL_5 0x01
 #define VCOBANDSEL_4 0x02
 #define VCOBANDSEL_3 0x04
 #define VCOBANDSEL_2 0x08
 #define VCOBANDSEL_1 0x10
-    u8 vco_band;
+       u8 vco_band;
 
 #define VCODIV4 4
 #define VCODIV2 2
        u8 vcodiv;
 
-    u8 bs_delay:4;
-    u16 bs_freqcnt:13;
-    u16 bs_rdiv;
-    u8 prescaler_mode:1;
-
-    u8 rfvga_bias_ctrl;
+       u8 bs_delay:4;
+       u16 bs_freqcnt:13;
+       u16 bs_rdiv;
+       u8 prescaler_mode:1;
+
+       u8 rfvga_bias_ctrl;
 
        s16 tuner_gain_thres;
        u8  gain_level;
@@ -345,12 +345,12 @@ static void cx24113_calc_pll_nf(struct c
        }
        F = freq_hz;
        F *= (u64) (R * vcodiv * 262144);
-    dprintk("1 N: %d, F: %lld, R: %d\n", N, F, R);
+       dprintk("1 N: %d, F: %lld, R: %d\n", N, F, R);
        do_div(F, state->config->xtal_khz*1000 * factor * 2);
-    dprintk("2 N: %d, F: %lld, R: %d\n", N, F, R);
+       dprintk("2 N: %d, F: %lld, R: %d\n", N, F, R);
        F -= (N + 32) * 262144;
 
-    dprintk("3 N: %d, F: %lld, R: %d\n", N, F, R);
+       dprintk("3 N: %d, F: %lld, R: %d\n", N, F, R);
 
        if (state->Fwindow_enabled) {
                if (F > (262144 / 2 - 1638))
@@ -392,21 +392,21 @@ static int cx24113_set_frequency(struct 
        u16 n = 6;
        s32 f = 0;
 
-    r = cx24113_readreg(state, 0x14);
+       r = cx24113_readreg(state, 0x14);
        cx24113_writereg(state, 0x14, r & 0x3f);
 
-    r = cx24113_readreg(state, 0x10);
-    cx24113_writereg(state, 0x10, r & 0xbf);
+       r = cx24113_readreg(state, 0x10);
+       cx24113_writereg(state, 0x10, r & 0xbf);
 
        state->frequency = frequency;
 
        dprintk("tuning to frequency: %d\n", frequency);
 
-    cx24113_calc_pll_nf(state, &n, &f);
-    cx24113_set_nfr(state, n, f, state->refdiv);
+       cx24113_calc_pll_nf(state, &n, &f);
+       cx24113_set_nfr(state, n, f, state->refdiv);
 
        r = cx24113_readreg(state, 0x18) & 0xbf;
-    if (state->vcodiv != VCODIV2)
+       if (state->vcodiv != VCODIV2)
                r |= 1 << 6;
        cx24113_writereg(state, 0x18, r);
 
@@ -527,7 +527,7 @@ static int cx24113_release(struct dvb_fr
 {
        struct cx24113_state *state = fe->tuner_priv;
        dprintk("\n");
-    fe->tuner_priv = NULL;
+       fe->tuner_priv = NULL;
        kfree(state);
        return 0;
 }
@@ -557,6 +557,7 @@ struct dvb_frontend *cx24113_attach(stru
        /* allocate memory for the internal state */
        struct cx24113_state *state =
                kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
+       int rc;
        if (state == NULL) {
                err("Unable to kmalloc\n");
                goto error;
@@ -572,15 +573,22 @@ struct dvb_frontend *cx24113_attach(stru
         * after power on */
        cx24113_readreg(state, 0x00);
 
-       switch (state->rev = cx24113_readreg(state, 0x00)) {
+       rc = cx24113_readreg(state, 0x00);
+       if (rc < 0) {
+               info("CX24113 not found.\n");
+               goto error;
+       }
+       state->rev = rc;
+
+       switch (rc) {
        case 0x43:
-               info("unknown device\n");
+               info("detected CX24113 variant\n");
                break;
        case REV_CX24113:
-               info("CX24113\n");
+               info("sucessfully detected\n");
                break;
        default:
-               err("unsupported revision: %x\n", state->rev);
+               err("unsupported device id: %x\n", state->rev);
                goto error;
        }
        state->ver = cx24113_readreg(state, 0x01);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/2c4c547cb4821620dcda6886d2403a2ad0beb2b1

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to