]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/frontends/cx24110.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / frontends / cx24110.c
index ce3c7398bac9ffa74168145b9b67d4eccf519c02..b03d8283c37d93233dc0d4722dc1fb60a0c9989d 100644 (file)
@@ -1,4 +1,4 @@
-/*
+       /*
     cx24110 - Single Chip Satellite Channel Receiver driver module
 
     Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on
@@ -25,7 +25,6 @@
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 
 #include "dvb_frontend.h"
@@ -254,7 +253,7 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)
        if (srate<500000)
                srate=500000;
 
-       for(i=0;(i<sizeof(bands)/sizeof(bands[0]))&&(srate>bands[i]);i++)
+       for(i = 0; (i < ARRAY_SIZE(bands)) && (srate>bands[i]); i++)
                ;
        /* first, check which sample rate is appropriate: 45, 60 80 or 90 MHz,
           and set the PLL accordingly (R07[1:0] Fclk, R06[7:4] PLLmult,
@@ -311,16 +310,17 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)
 
 }
 
-int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
+static int _cx24110_pll_write (struct dvb_frontend* fe, u8 *buf, int len)
 {
        struct cx24110_state *state = fe->demodulator_priv;
 
+       if (len != 3)
+               return -EINVAL;
+
 /* tuner data is 21 bits long, must be left-aligned in data */
 /* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */
 /* FIXME (low): add error handling, avoid infinite loops if HW fails... */
 
-       dprintk("cx24110 debug: cx24108_write(%8.8x)\n",data);
-
        cx24110_writereg(state,0x6d,0x30); /* auto mode at 62kHz */
        cx24110_writereg(state,0x70,0x15); /* auto mode 21 bits */
 
@@ -329,19 +329,19 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
                cx24110_writereg(state,0x72,0);
 
        /* write the topmost 8 bits */
-       cx24110_writereg(state,0x72,(data>>24)&0xff);
+       cx24110_writereg(state,0x72,buf[0]);
 
        /* wait for the send to be completed */
        while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
                ;
 
        /* send another 8 bytes */
-       cx24110_writereg(state,0x72,(data>>16)&0xff);
+       cx24110_writereg(state,0x72,buf[1]);
        while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
                ;
 
        /* and the topmost 5 bits of this byte */
-       cx24110_writereg(state,0x72,(data>>8)&0xff);
+       cx24110_writereg(state,0x72,buf[2]);
        while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
                ;
 
@@ -360,7 +360,7 @@ static int cx24110_initfe(struct dvb_frontend* fe)
 
        dprintk("%s: init chip\n", __FUNCTION__);
 
-       for(i=0;i<sizeof(cx24110_regdata)/sizeof(cx24110_regdata[0]);i++) {
+       for(i = 0; i < ARRAY_SIZE(cx24110_regdata); i++) {
                cx24110_writereg(state, cx24110_regdata[i].reg, cx24110_regdata[i].data);
        };
 
@@ -642,6 +642,7 @@ static struct dvb_frontend_ops cx24110_ops = {
        .release = cx24110_release,
 
        .init = cx24110_initfe,
+       .write = _cx24110_pll_write,
        .set_frontend = cx24110_set_frontend,
        .get_frontend = cx24110_get_frontend,
        .read_status = cx24110_read_status,
@@ -664,4 +665,3 @@ MODULE_AUTHOR("Peter Hettkamp");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(cx24110_attach);
-EXPORT_SYMBOL(cx24110_pll_write);