[PATCH] fix missing includes
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / drivers / media / dvb / frontends / stv0299.c
index cfa3928bb487bab6d61cb0991833dadf7326819a..889d9257215d733893d2deb16caed9ae66b4384d 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/moduleparam.h>
 #include <linux/string.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <asm/div64.h>
 
 #include "dvb_frontend.h"
@@ -63,12 +64,8 @@ struct stv0299_state {
        u32 tuner_frequency;
        u32 symbol_rate;
        fe_code_rate_t fec_inner;
-       int errmode;
 };
 
-#define STATUS_BER 0
-#define STATUS_UCBLOCKS 1
-
 static int debug;
 static int debug_legacy_dish_switch;
 #define dprintk(args...) \
@@ -481,7 +478,7 @@ static int stv0299_init (struct dvb_frontend* fe)
 
        if (state->config->pll_init) {
                stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater on stv0299  */
-               state->config->pll_init(fe);
+               state->config->pll_init(fe, state->i2c);
                stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c repeater on stv0299  */
        }
 
@@ -520,7 +517,8 @@ static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber)
 {
         struct stv0299_state* state = fe->demodulator_priv;
 
-       if (state->errmode != STATUS_BER) return 0;
+       stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x10);
+       msleep(100);
        *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e);
 
        return 0;
@@ -559,8 +557,9 @@ static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
 {
         struct stv0299_state* state = fe->demodulator_priv;
 
-       if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0;
-       else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e);
+       stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x30);
+       msleep(100);
+       *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e);
 
        return 0;
 }
@@ -603,7 +602,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
                } else {
                        /* A "normal" tune is requested */
                        stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater on stv0299  */
-                       state->config->pll_set(fe, p);
+                       state->config->pll_set(fe, state->i2c, p);
                        stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c repeater on stv0299  */
 
                        stv0299_writeregI(state, 0x32, 0x80);
@@ -615,7 +614,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
                }
        } else {
                stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater on stv0299  */
-               state->config->pll_set(fe, p);
+               state->config->pll_set(fe, state->i2c, p);
                stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c repeater on stv0299  */
 
                stv0299_set_FEC (state, p->u.qpsk.fec_inner);
@@ -709,7 +708,6 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
        state->tuner_frequency = 0;
        state->symbol_rate = 0;
        state->fec_inner = 0;
-       state->errmode = STATUS_BER;
 
        /* check if the demod is there */
        stv0299_writeregI(state, 0x02, 0x34); /* standby off */