include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / media / dvb / frontends / stb0899_drv.c
index 2caa192..8e38fce 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 
 #include <linux/dvb/frontend.h>
@@ -31,7 +32,7 @@
 #include "stb0899_priv.h"
 #include "stb0899_reg.h"
 
-static unsigned int verbose = 5;
+static unsigned int verbose = 0;//1;
 module_param(verbose, int, 0644);
 
 /* C/N in dB/10, NIRM/NIRL */
@@ -134,7 +135,7 @@ static const struct stb0899_tab stb0899_dvbs2rf_tab[] = {
 };
 
 /* DVB-S2 Es/N0 quant in dB/100 vs read value * 100*/
-struct stb0899_tab stb0899_quant_tab[] = {
+static struct stb0899_tab stb0899_quant_tab[] = {
        {    0,     0 },
        {    0,   100 },
        {  600,   200 },
@@ -177,7 +178,7 @@ struct stb0899_tab stb0899_quant_tab[] = {
 };
 
 /* DVB-S2 Es/N0 estimate in dB/100 vs read value */
-struct stb0899_tab stb0899_est_tab[] = {
+static struct stb0899_tab stb0899_est_tab[] = {
        {    0,      0 },
        {    0,      1 },
        {  301,      2 },
@@ -217,7 +218,7 @@ struct stb0899_tab stb0899_est_tab[] = {
        { 5721, 526017 },
 };
 
-int _stb0899_read_reg(struct stb0899_state *state, unsigned int reg)
+static int _stb0899_read_reg(struct stb0899_state *state, unsigned int reg)
 {
        int ret;
 
@@ -241,14 +242,14 @@ int _stb0899_read_reg(struct stb0899_state *state, unsigned int reg)
        ret = i2c_transfer(state->i2c, msg, 2);
        if (ret != 2) {
                if (ret != -ERESTARTSYS)
-                       dprintk(verbose, FE_ERROR, 1,
+                       dprintk(state->verbose, FE_ERROR, 1,
                                "Read error, Reg=[0x%02x], Status=%d",
                                reg, ret);
 
                return ret < 0 ? ret : -EREMOTEIO;
        }
-       if (unlikely(verbose >= FE_DEBUGREG))
-               dprintk(verbose, FE_ERROR, 1, "Reg=[0x%02x], data=%02x",
+       if (unlikely(*state->verbose >= FE_DEBUGREG))
+               dprintk(state->verbose, FE_ERROR, 1, "Reg=[0x%02x], data=%02x",
                        reg, buf);
 
        return (unsigned int)buf;
@@ -272,9 +273,9 @@ int stb0899_read_reg(struct stb0899_state *state, unsigned int reg)
 }
 
 u32 _stb0899_read_s2reg(struct stb0899_state *state,
-                       u32 stb0899_i2cdev,
-                       u32 stb0899_base_addr,
-                       u16 stb0899_reg_offset)
+                       u32 stb0899_i2cdev,
+                       u32 stb0899_base_addr,
+                       u16 stb0899_reg_offset)
 {
        int status;
        u32 data;
@@ -361,7 +362,7 @@ u32 _stb0899_read_s2reg(struct stb0899_state *state,
        }
 
        data = MAKEWORD32(buf[3], buf[2], buf[1], buf[0]);
-       if (unlikely(state->verbose >= FE_DEBUGREG))
+       if (unlikely(*state->verbose >= FE_DEBUGREG))
                printk(KERN_DEBUG "%s Device=[0x%04x], Base address=[0x%08x], Offset=[0x%04x], Data=[0x%08x]\n",
                       __func__, stb0899_i2cdev, stb0899_base_addr, stb0899_reg_offset, data);
 
@@ -418,7 +419,7 @@ int stb0899_write_s2reg(struct stb0899_state *state,
        buf_1[4] = GETBYTE(stb0899_data, BYTE2);
        buf_1[5] = GETBYTE(stb0899_data, BYTE3);
 
-       if (unlikely(state->verbose >= FE_DEBUGREG))
+       if (unlikely(*state->verbose >= FE_DEBUGREG))
                printk(KERN_DEBUG "%s Device=[0x%04x], Base Address=[0x%08x], Offset=[0x%04x], Data=[0x%08x]\n",
                       __func__, stb0899_i2cdev, stb0899_base_addr, stb0899_reg_offset, stb0899_data);
 
@@ -444,7 +445,7 @@ err:
        return status < 0 ? status : -EREMOTEIO;
 }
 
-int stb0899_read_regs(struct stb0899_state *state, unsigned int reg, u8 *buf, size_t count)
+int stb0899_read_regs(struct stb0899_state *state, unsigned int reg, u8 *buf, u32 count)
 {
        int status;
 
@@ -480,7 +481,7 @@ int stb0899_read_regs(struct stb0899_state *state, unsigned int reg, u8 *buf, si
            (((reg & 0xff00) == 0xf200) || ((reg & 0xff00) == 0xf600)))
                _stb0899_read_reg(state, (reg | 0x00ff));
 
-       if (unlikely(state->verbose >= FE_DEBUGREG)) {
+       if (unlikely(*state->verbose >= FE_DEBUGREG)) {
                int i;
 
                printk(KERN_DEBUG "%s [0x%04x]:", __func__, reg);
@@ -495,7 +496,7 @@ err:
        return status < 0 ? status : -EREMOTEIO;
 }
 
-int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, size_t count)
+int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, u32 count)
 {
        int ret;
        u8 buf[2 + count];
@@ -510,7 +511,7 @@ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data,
        buf[1] = reg & 0xff;
        memcpy(&buf[2], data, count);
 
-       if (unlikely(state->verbose >= FE_DEBUGREG)) {
+       if (unlikely(*state->verbose >= FE_DEBUGREG)) {
                int i;
 
                printk(KERN_DEBUG "%s [0x%04x]:", __func__, reg);
@@ -530,7 +531,7 @@ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data,
 
        if (ret != 1) {
                if (ret != -ERESTARTSYS)
-                       dprintk(verbose, FE_ERROR, 1, "Reg=[0x%04x], Data=[0x%02x ...], Count=%u, Status=%d",
+                       dprintk(state->verbose, FE_ERROR, 1, "Reg=[0x%04x], Data=[0x%02x ...], Count=%u, Status=%d",
                                reg, data[0], count, ret);
                return ret < 0 ? ret : -EREMOTEIO;
        }
@@ -554,7 +555,7 @@ static u32 stb0899_get_mclk(struct stb0899_state *state)
 
        div = stb0899_read_reg(state, STB0899_NCOARSE);
        mclk = (div + 1) * state->config->xtal_freq / 6;
-       dprintk(verbose, FE_DEBUG, 1, "div=%d, mclk=%d", div, mclk);
+       dprintk(state->verbose, FE_DEBUG, 1, "div=%d, mclk=%d", div, mclk);
 
        return mclk;
 }
@@ -570,14 +571,14 @@ static void stb0899_set_mclk(struct stb0899_state *state, u32 Mclk)
        struct stb0899_internal *internal = &state->internal;
        u8 mdiv = 0;
 
-       dprintk(verbose, FE_DEBUG, 1, "state->config=%p", state->config);
+       dprintk(state->verbose, FE_DEBUG, 1, "state->config=%p", state->config);
        mdiv = ((6 * Mclk) / state->config->xtal_freq) - 1;
-       dprintk(verbose, FE_DEBUG, 1, "mdiv=%d", mdiv);
+       dprintk(state->verbose, FE_DEBUG, 1, "mdiv=%d", mdiv);
 
        stb0899_write_reg(state, STB0899_NCOARSE, mdiv);
        internal->master_clk = stb0899_get_mclk(state);
 
-       dprintk(verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk);
+       dprintk(state->verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk);
 }
 
 static int stb0899_postproc(struct stb0899_state *state, u8 ctl, int enable)
@@ -606,7 +607,7 @@ static void stb0899_release(struct dvb_frontend *fe)
 {
        struct stb0899_state *state = fe->demodulator_priv;
 
-       dprintk(verbose, FE_DEBUG, 1, "Release Frontend");
+       dprintk(state->verbose, FE_DEBUG, 1, "Release Frontend");
        /* post process event */
        stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
        kfree(state);
@@ -683,7 +684,7 @@ static int stb0899_wait_diseqc_fifo_empty(struct stb0899_state *state, int timeo
                if (!STB0899_GETFIELD(FIFOFULL, reg))
                        break;
                if ((jiffies - start) > timeout) {
-                       dprintk(verbose, FE_ERROR, 1, "timed out !!");
+                       dprintk(state->verbose, FE_ERROR, 1, "timed out !!");
                        return -ETIMEDOUT;
                }
        }
@@ -725,7 +726,7 @@ static int stb0899_wait_diseqc_rxidle(struct stb0899_state *state, int timeout)
        while (!STB0899_GETFIELD(RXEND, reg)) {
                reg = stb0899_read_reg(state, STB0899_DISRX_ST0);
                if (jiffies - start > timeout) {
-                       dprintk(verbose, FE_ERROR, 1, "timed out!!");
+                       dprintk(state->verbose, FE_ERROR, 1, "timed out!!");
                        return -ETIMEDOUT;
                }
                msleep(10);
@@ -774,7 +775,7 @@ static int stb0899_wait_diseqc_txidle(struct stb0899_state *state, int timeout)
        while (!STB0899_GETFIELD(TXIDLE, reg)) {
                reg = stb0899_read_reg(state, STB0899_DISSTATUS);
                if (jiffies - start > timeout) {
-                       dprintk(verbose, FE_ERROR, 1, "timed out!!");
+                       dprintk(state->verbose, FE_ERROR, 1, "timed out!!");
                        return -ETIMEDOUT;
                }
                msleep(10);
@@ -794,7 +795,7 @@ static int stb0899_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t
        reg = stb0899_read_reg(state, STB0899_DISCNTRL1);
        old_state = reg;
        /* set to burst mode    */
-       STB0899_SETFIELD_VAL(DISEQCMODE, reg, 0x02);
+       STB0899_SETFIELD_VAL(DISEQCMODE, reg, 0x03);
        STB0899_SETFIELD_VAL(DISPRECHARGE, reg, 0x01);
        stb0899_write_reg(state, STB0899_DISCNTRL1, reg);
        switch (burst) {
@@ -823,16 +824,12 @@ static int stb0899_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t
 static int stb0899_diseqc_init(struct stb0899_state *state)
 {
        struct dvb_diseqc_master_cmd tx_data;
+/*
        struct dvb_diseqc_slave_reply rx_data;
-
+*/
        u8 f22_tx, f22_rx, reg;
 
-       u32 mclk, tx_freq = 22000, count = 0, i;
-
-       u32 trial = 0;  /* try max = 2 (try 20khz and 17.5 khz) */
-       u32 ret_1 = 0;  /* 20 Khz status        */
-       u32 ret_2 = 0;  /* 17.5 Khz status      */
-
+       u32 mclk, tx_freq = 22000;/* count = 0, i; */
        tx_data.msg[0] = 0xe2;
        tx_data.msg_len = 3;
        reg = stb0899_read_reg(state, STB0899_DISCNTRL2);
@@ -860,9 +857,10 @@ static int stb0899_diseqc_init(struct stb0899_state *state)
 static int stb0899_sleep(struct dvb_frontend *fe)
 {
        struct stb0899_state *state = fe->demodulator_priv;
+/*
        u8 reg;
-
-       dprintk(verbose, FE_DEBUG, 1, "Going to Sleep .. (Really tired .. :-))");
+*/
+       dprintk(state->verbose, FE_DEBUG, 1, "Going to Sleep .. (Really tired .. :-))");
        /* post process event */
        stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
 
@@ -894,15 +892,14 @@ static int stb0899_init(struct dvb_frontend *fe)
        struct stb0899_state *state = fe->demodulator_priv;
        struct stb0899_config *config = state->config;
 
-       dprintk(verbose, FE_DEBUG, 1, "Initializing STB0899 ... ");
-//     mutex_init(&state->search_lock);
+       dprintk(state->verbose, FE_DEBUG, 1, "Initializing STB0899 ... ");
 
        /* init device          */
-       dprintk(verbose, FE_DEBUG, 1, "init device");
+       dprintk(state->verbose, FE_DEBUG, 1, "init device");
        for (i = 0; config->init_dev[i].address != 0xffff; i++)
                stb0899_write_reg(state, config->init_dev[i].address, config->init_dev[i].data);
 
-       dprintk(verbose, FE_DEBUG, 1, "init S2 demod");
+       dprintk(state->verbose, FE_DEBUG, 1, "init S2 demod");
        /* init S2 demod        */
        for (i = 0; config->init_s2_demod[i].offset != 0xffff; i++)
                stb0899_write_s2reg(state, STB0899_S2DEMOD,
@@ -910,12 +907,12 @@ static int stb0899_init(struct dvb_frontend *fe)
                                    config->init_s2_demod[i].offset,
                                    config->init_s2_demod[i].data);
 
-       dprintk(verbose, FE_DEBUG, 1, "init S1 demod");
+       dprintk(state->verbose, FE_DEBUG, 1, "init S1 demod");
        /* init S1 demod        */
        for (i = 0; config->init_s1_demod[i].address != 0xffff; i++)
                stb0899_write_reg(state, config->init_s1_demod[i].address, config->init_s1_demod[i].data);
 
-       dprintk(verbose, FE_DEBUG, 1, "init S2 FEC");
+       dprintk(state->verbose, FE_DEBUG, 1, "init S2 FEC");
        /* init S2 fec          */
        for (i = 0; config->init_s2_fec[i].offset != 0xffff; i++)
                stb0899_write_s2reg(state, STB0899_S2FEC,
@@ -923,7 +920,7 @@ static int stb0899_init(struct dvb_frontend *fe)
                                    config->init_s2_fec[i].offset,
                                    config->init_s2_fec[i].data);
 
-       dprintk(verbose, FE_DEBUG, 1, "init TST");
+       dprintk(state->verbose, FE_DEBUG, 1, "init TST");
        /* init test            */
        for (i = 0; config->init_tst[i].address != 0xffff; i++)
                stb0899_write_reg(state, config->init_tst[i].address, config->init_tst[i].data);
@@ -968,8 +965,8 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
        int val;
        u32 reg;
        switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-       case DVBFE_DELSYS_DSS:
+       case SYS_DVBS:
+       case SYS_DSS:
                if (internal->lock) {
                        reg  = stb0899_read_reg(state, STB0899_VSTATUS);
                        if (STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg)) {
@@ -979,24 +976,24 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
 
                                *strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val);
                                *strength += 750;
-                               dprintk(verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm",
+                               dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm",
                                        val & 0xff, *strength);
                        }
                }
                break;
-       case DVBFE_DELSYS_DVBS2:
+       case SYS_DVBS2:
                if (internal->lock) {
                        reg = STB0899_READ_S2REG(STB0899_DEMOD, IF_AGC_GAIN);
                        val = STB0899_GETFIELD(IF_AGC_GAIN, reg);
 
                        *strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val);
                        *strength += 750;
-                       dprintk(verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm",
+                       dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm",
                                val & 0x3fff, *strength);
                }
                break;
        default:
-               dprintk(verbose, FE_DEBUG, 1, "Unsupported delivery system");
+               dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system");
                return -EINVAL;
        }
 
@@ -1014,8 +1011,8 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr)
 
        reg  = stb0899_read_reg(state, STB0899_VSTATUS);
        switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-       case DVBFE_DELSYS_DSS:
+       case SYS_DVBS:
+       case SYS_DSS:
                if (internal->lock) {
                        if (STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg)) {
 
@@ -1023,12 +1020,12 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr)
                                val = MAKEWORD16(buf[0], buf[1]);
 
                                *snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val);
-                               dprintk(verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n",
+                               dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n",
                                        buf[0], buf[1], val, *snr);
                        }
                }
                break;
-       case DVBFE_DELSYS_DVBS2:
+       case SYS_DVBS2:
                if (internal->lock) {
                        reg = STB0899_READ_S2REG(STB0899_S2DEMOD, UWP_CNTRL1);
                        quant = STB0899_GETFIELD(UWP_ESN0_QUANT, reg);
@@ -1047,12 +1044,12 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr)
                                val = (quantn - estn) / 10;
                        }
                        *snr = val;
-                       dprintk(verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm",
+                       dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm",
                                quant, quantn, est, estn, val);
                }
                break;
        default:
-               dprintk(verbose, FE_DEBUG, 1, "Unsupported delivery system");
+               dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system");
                return -EINVAL;
        }
 
@@ -1067,8 +1064,8 @@ static int stb0899_read_status(struct dvb_frontend *fe, enum fe_status *status)
        *status = 0;
 
        switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-       case DVBFE_DELSYS_DSS:
+       case SYS_DVBS:
+       case SYS_DSS:
                dprintk(state->verbose, FE_DEBUG, 1, "Delivery system DVB-S/DSS");
                if (internal->lock) {
                        reg  = stb0899_read_reg(state, STB0899_VSTATUS);
@@ -1086,7 +1083,7 @@ static int stb0899_read_status(struct dvb_frontend *fe, enum fe_status *status)
                        }
                }
                break;
-       case DVBFE_DELSYS_DVBS2:
+       case SYS_DVBS2:
                dprintk(state->verbose, FE_DEBUG, 1, "Delivery system DVB-S2");
                if (internal->lock) {
                        reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_STAT2);
@@ -1118,7 +1115,7 @@ static int stb0899_read_status(struct dvb_frontend *fe, enum fe_status *status)
                }
                break;
        default:
-               dprintk(verbose, FE_DEBUG, 1, "Unsupported delivery system");
+               dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system");
                return -EINVAL;
        }
        return 0;
@@ -1141,8 +1138,8 @@ static int stb0899_read_ber(struct dvb_frontend *fe, u32 *ber)
        *ber = 0;
 
        switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-       case DVBFE_DELSYS_DSS:
+       case SYS_DVBS:
+       case SYS_DSS:
                if (internal->lock) {
                        /* average 5 BER values */
                        for (i = 0; i < 5; i++) {
@@ -1162,7 +1159,7 @@ static int stb0899_read_ber(struct dvb_frontend *fe, u32 *ber)
                        }
                }
                break;
-       case DVBFE_DELSYS_DVBS2:
+       case SYS_DVBS2:
                if (internal->lock) {
                        /* Average 5 PER values */
                        for (i = 0; i < 5; i++) {
@@ -1177,7 +1174,7 @@ static int stb0899_read_ber(struct dvb_frontend *fe, u32 *ber)
                }
                break;
        default:
-               dprintk(verbose, FE_DEBUG, 1, "Unsupported delivery system");
+               dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system");
                return -EINVAL;
        }
 
@@ -1241,7 +1238,7 @@ static int stb0899_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
        return 0;
 }
 
-static int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
+int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
 {
        int i2c_stat;
        struct stb0899_state *state = fe->demodulator_priv;
@@ -1255,10 +1252,15 @@ static int stb0899_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
                i2c_stat |=  STB0899_I2CTON;
                if (stb0899_write_reg(state, STB0899_I2CRPT, i2c_stat) < 0)
                        goto err;
+       } else {
+               dprintk(state->verbose, FE_DEBUG, 1, "Disabling I2C Repeater ...");
+               i2c_stat &= ~STB0899_I2CTON;
+               if (stb0899_write_reg(state, STB0899_I2CRPT, i2c_stat) < 0)
+                       goto err;
        }
        return 0;
 err:
-       dprintk(state->verbose, FE_ERROR, 1, "I2C Repeater enable failed");
+       dprintk(state->verbose, FE_ERROR, 1, "I2C Repeater control failed");
        return -EREMOTEIO;
 }
 
@@ -1304,102 +1306,7 @@ int stb0899_get_dev_id(struct stb0899_state *state)
        return 0;
 }
 
-static const struct dvbfe_info dvbs_info       = {
-       .name                                   = "STB0899 DVB-S",
-       .delivery                               = DVBFE_DELSYS_DVBS,
-       .delsys                                 = {
-               .dvbs.modulation                = DVBFE_MOD_QPSK,
-               .dvbs.fec                       = DVBFE_FEC_1_2 | DVBFE_FEC_2_3 |
-                                                 DVBFE_FEC_3_4 | DVBFE_FEC_5_6 |
-                                                 DVBFE_FEC_6_7
-       },
-
-       .frequency_min                          = 950000,
-       .frequency_max                          = 2150000,
-       .frequency_step                         = 0,
-       .symbol_rate_min                        = 1000000,
-       .symbol_rate_max                        = 45000000,
-       .symbol_rate_tolerance                  = 0
-};
-
-static const struct dvbfe_info dss_info                = {
-       .name                                   = "STB0899 DSS",
-       .delivery                               = DVBFE_DELSYS_DSS,
-       .delsys                                 = {
-               .dss.modulation                 = DVBFE_MOD_BPSK | DVBFE_MOD_QPSK,
-               .dss.fec                        = DVBFE_FEC_1_2  | DVBFE_FEC_2_3 |
-                                                 DVBFE_FEC_3_4  | DVBFE_FEC_5_6 |
-                                                 DVBFE_FEC_6_7
-       },
-
-       .frequency_min                          = 950000,
-       .frequency_max                          = 2150000,
-       .frequency_step                         = 0,
-       .symbol_rate_min                        = 1000000,
-       .symbol_rate_max                        = 45000000,
-       .symbol_rate_tolerance                  = 0
-};
-
-static const struct dvbfe_info dvbs2_info      = {
-       .name                                   = "STB0899 DVB-S2",
-       .delivery                               = DVBFE_DELSYS_DVBS2,
-       .delsys                                 = {
-               .dvbs2.modulation               = DVBFE_MOD_QPSK   | DVBFE_MOD_8PSK |
-                                                 DVBFE_MOD_16APSK | DVBFE_MOD_32APSK,
-
-               .dvbs2.fec                      = DVBFE_FEC_1_4 | DVBFE_FEC_1_3 |
-                                                 DVBFE_FEC_2_5 | DVBFE_FEC_1_2 |
-                                                 DVBFE_FEC_3_5 | DVBFE_FEC_2_3 |
-                                                 DVBFE_FEC_3_4 | DVBFE_FEC_4_5 |
-                                                 DVBFE_FEC_5_6 | DVBFE_FEC_8_9 |
-                                                 DVBFE_FEC_9_10,
-       },
-
-       .frequency_min          = 950000,
-       .frequency_max          = 2150000,
-       .frequency_step         = 0,
-       .symbol_rate_min        = 1000000,
-       .symbol_rate_max        = 45000000,
-       .symbol_rate_tolerance  = 0
-};
-
-static int stb0899_get_info(struct dvb_frontend *fe, struct dvbfe_info *fe_info)
-{
-       struct stb0899_state *state = fe->demodulator_priv;
-
-       dprintk(verbose, FE_DEBUG, 1, "Get Info");
-
-       state->delsys = fe_info->delivery;
-       switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-               dprintk(verbose, FE_ERROR, 1, "Querying DVB-S info");
-               memcpy(fe_info, &dvbs_info, sizeof (struct dvbfe_info));
-               break;
-       case DVBFE_DELSYS_DSS:
-               dprintk(verbose, FE_ERROR, 1, "Querying DSS info");
-               memcpy(fe_info, &dss_info, sizeof (struct dvbfe_info));
-               break;
-       case DVBFE_DELSYS_DVBS2:
-               dprintk(verbose, FE_ERROR, 1, "Querying DVB-S2 info");
-               memcpy(fe_info, &dvbs2_info, sizeof (struct dvbfe_info));
-               break;
-       default:
-               dprintk(verbose, FE_ERROR, 1, "Unsupported delivery system");
-               return -EINVAL;
-       }
-       dprintk(verbose, FE_DEBUG, 1, "delivery system=%d", state->delsys);
-
-       return 0;
-}
-
-static int stb0899_get_delsys(struct dvb_frontend *fe, enum dvbfe_delsys *fe_delsys)
-{
-       *fe_delsys = DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DSS | DVBFE_DELSYS_DVBS2;
-
-       return 0;
-}
-
-void stb0899_set_delsys(struct stb0899_state *state)
+static void stb0899_set_delivery(struct stb0899_state *state)
 {
        u8 reg;
        u8 stop_clk[2];
@@ -1408,8 +1315,8 @@ void stb0899_set_delsys(struct stb0899_state *state)
        stop_clk[1] = stb0899_read_reg(state, STB0899_STOPCLK2);
 
        switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-               dprintk(verbose, FE_DEBUG, 1, "Delivery System -- DVB-S");
+       case SYS_DVBS:
+               dprintk(state->verbose, FE_DEBUG, 1, "Delivery System -- DVB-S");
                /* FECM/Viterbi ON      */
                reg = stb0899_read_reg(state, STB0899_FECM);
                STB0899_SETFIELD_VAL(FECM_RSVD0, reg, 0);
@@ -1437,7 +1344,7 @@ void stb0899_set_delsys(struct stb0899_state *state)
 
                STB0899_SETFIELD_VAL(STOP_CKS2DMD108, stop_clk[1], 1);
                break;
-       case DVBFE_DELSYS_DVBS2:
+       case SYS_DVBS2:
                /* FECM/Viterbi OFF     */
                reg = stb0899_read_reg(state, STB0899_FECM);
                STB0899_SETFIELD_VAL(FECM_RSVD0, reg, 0);
@@ -1465,7 +1372,7 @@ void stb0899_set_delsys(struct stb0899_state *state)
 
                STB0899_SETFIELD_VAL(STOP_CKS2DMD108, stop_clk[1], 0);
                break;
-       case DVBFE_DELSYS_DSS:
+       case SYS_DSS:
                /* FECM/Viterbi ON      */
                reg = stb0899_read_reg(state, STB0899_FECM);
                STB0899_SETFIELD_VAL(FECM_RSVD0, reg, 1);
@@ -1492,7 +1399,7 @@ void stb0899_set_delsys(struct stb0899_state *state)
                STB0899_SETFIELD_VAL(STOP_CKS2DMD108, stop_clk[1], 1);
                break;
        default:
-               dprintk(verbose, FE_ERROR, 1, "Unsupported delivery system");
+               dprintk(state->verbose, FE_ERROR, 1, "Unsupported delivery system");
                break;
        }
        STB0899_SETFIELD_VAL(STOP_CKADCI108, stop_clk[0], 0);
@@ -1524,62 +1431,47 @@ static void stb0899_set_iterations(struct stb0899_state *state)
        stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_MAX_ITER, STB0899_OFF0_MAX_ITER, reg);
 }
 
-static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_params *params)
+static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
 {
        struct stb0899_state *state = fe->demodulator_priv;
        struct stb0899_params *i_params = &state->params;
        struct stb0899_internal *internal = &state->internal;
+       struct stb0899_config *config = state->config;
+       struct dtv_frontend_properties *props = &fe->dtv_property_cache;
 
        u32 SearchRange, gain;
 
-       switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-               dprintk(verbose, FE_ERROR, 1, "set DVB-S params");
-               i_params->freq  = params->frequency;
-               i_params->srate = params->delsys.dvbs.symbol_rate;
-               break;
-       case DVBFE_DELSYS_DSS:
-               dprintk(verbose, FE_ERROR, 1, "set DSS params");
-               i_params->freq  = params->frequency;
-               i_params->srate = params->delsys.dss.symbol_rate;
-               break;
-       case DVBFE_DELSYS_DVBS2:
-               dprintk(verbose, FE_ERROR, 1, "set DVB-S2 params");
-               i_params->freq  = params->frequency;
-               i_params->srate = params->delsys.dvbs2.symbol_rate;
-               break;
-       default:
-               dprintk(verbose, FE_ERROR, 1, "Unsupported delivery system");
-               return -EINVAL;
-       }
-       dprintk(verbose, FE_DEBUG, 1, "delivery system=%d", state->delsys);
+       i_params->freq  = p->frequency;
+       i_params->srate = p->u.qpsk.symbol_rate;
+       state->delsys = props->delivery_system;
+       dprintk(state->verbose, FE_DEBUG, 1, "delivery system=%d", state->delsys);
 
        SearchRange = 10000000;
-       dprintk(verbose, FE_DEBUG, 1, "Frequency=%d, Srate=%d", i_params->freq, i_params->srate);
+       dprintk(state->verbose, FE_DEBUG, 1, "Frequency=%d, Srate=%d", i_params->freq, i_params->srate);
        /* checking Search Range is meaningless for a fixed 3 Mhz                       */
        if (INRANGE(i_params->srate, 1000000, 45000000)) {
-               dprintk(verbose, FE_DEBUG, 1, "Parameters IN RANGE");
-               stb0899_set_delsys(state);
+               dprintk(state->verbose, FE_DEBUG, 1, "Parameters IN RANGE");
+               stb0899_set_delivery(state);
 
                if (state->config->tuner_set_rfsiggain) {
                        if (internal->srate > 15000000)
-                               gain =  8;      /* 15Mb < srate < 45Mb, gain = 8dB      */
+                               gain =  8; /* 15Mb < srate < 45Mb, gain = 8dB   */
                        else if (internal->srate > 5000000)
-                               gain = 12;      /*  5Mb < srate < 15Mb, gain = 12dB     */
+                               gain = 12; /*  5Mb < srate < 15Mb, gain = 12dB  */
                        else
-                               gain = 14;      /*  1Mb < srate <  5Mb, gain = 14db     */
+                               gain = 14; /*  1Mb < srate <  5Mb, gain = 14db  */
                        state->config->tuner_set_rfsiggain(fe, gain);
                }
 
                if (i_params->srate <= 5000000)
-                       stb0899_set_mclk(state, 76500000);
+                       stb0899_set_mclk(state, config->lo_clk);
                else
-                       stb0899_set_mclk(state, 99000000);
+                       stb0899_set_mclk(state, config->hi_clk);
 
                switch (state->delsys) {
-               case DVBFE_DELSYS_DVBS:
-               case DVBFE_DELSYS_DSS:
-                       dprintk(verbose, FE_DEBUG, 1, "DVB-S delivery system");
+               case SYS_DVBS:
+               case SYS_DSS:
+                       dprintk(state->verbose, FE_DEBUG, 1, "DVB-S delivery system");
                        internal->freq  = i_params->freq;
                        internal->srate = i_params->srate;
                        /*
@@ -1592,25 +1484,32 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa
                        internal->derot_percent = 30;
 
                        /* What to do for tuners having no bandwidth setup ?    */
+                       /* enable tuner I/O */
+                       stb0899_i2c_gate_ctrl(&state->frontend, 1);
+
                        if (state->config->tuner_set_bandwidth)
                                state->config->tuner_set_bandwidth(fe, (13 * (stb0899_carr_width(state) + SearchRange)) / 10);
                        if (state->config->tuner_get_bandwidth)
                                state->config->tuner_get_bandwidth(fe, &internal->tuner_bw);
+
+                       /* disable tuner I/O */
+                       stb0899_i2c_gate_ctrl(&state->frontend, 0);
+
                        /* Set DVB-S1 AGC               */
                        stb0899_write_reg(state, STB0899_AGCRFCFG, 0x11);
 
                        /* Run the search algorithm     */
-                       dprintk(verbose, FE_DEBUG, 1, "running DVB-S search algo ..");
+                       dprintk(state->verbose, FE_DEBUG, 1, "running DVB-S search algo ..");
                        if (stb0899_dvbs_algo(state)    == RANGEOK) {
                                internal->lock          = 1;
-                               dprintk(verbose, FE_DEBUG, 1,
+                               dprintk(state->verbose, FE_DEBUG, 1,
                                        "-------------------------------------> DVB-S LOCK !");
 
 //                             stb0899_write_reg(state, STB0899_ERRCTRL1, 0x3d); /* Viterbi Errors     */
 //                             internal->v_status = stb0899_read_reg(state, STB0899_VSTATUS);
 //                             internal->err_ctrl = stb0899_read_reg(state, STB0899_ERRCTRL1);
-//                             dprintk(verbose, FE_DEBUG, 1, "VSTATUS=0x%02x", internal->v_status);
-//                             dprintk(verbose, FE_DEBUG, 1, "ERR_CTRL=0x%02x", internal->err_ctrl);
+//                             dprintk(state->verbose, FE_DEBUG, 1, "VSTATUS=0x%02x", internal->v_status);
+//                             dprintk(state->verbose, FE_DEBUG, 1, "ERR_CTRL=0x%02x", internal->err_ctrl);
 
                                return DVBFE_ALGO_SEARCH_SUCCESS;
                        } else {
@@ -1619,16 +1518,22 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa
                                return DVBFE_ALGO_SEARCH_FAILED;
                        }
                        break;
-               case DVBFE_DELSYS_DVBS2:
+               case SYS_DVBS2:
                        internal->freq                  = i_params->freq;
                        internal->srate                 = i_params->srate;
                        internal->srch_range            = SearchRange;
 
+                       /* enable tuner I/O */
+                       stb0899_i2c_gate_ctrl(&state->frontend, 1);
+
                        if (state->config->tuner_set_bandwidth)
                                state->config->tuner_set_bandwidth(fe, (stb0899_carr_width(state) + SearchRange));
                        if (state->config->tuner_get_bandwidth)
                                state->config->tuner_get_bandwidth(fe, &internal->tuner_bw);
 
+                       /* disable tuner I/O */
+                       stb0899_i2c_gate_ctrl(&state->frontend, 0);
+
 //                     pParams->SpectralInv            = pSearch->IQ_Inversion;
 
                        /* Set DVB-S2 AGC               */
@@ -1638,10 +1543,10 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa
                        stb0899_set_iterations(state);
 
                        /* Run the search algorithm     */
-                       dprintk(verbose, FE_DEBUG, 1, "running DVB-S2 search algo ..");
+                       dprintk(state->verbose, FE_DEBUG, 1, "running DVB-S2 search algo ..");
                        if (stb0899_dvbs2_algo(state)   == DVBS2_FEC_LOCK) {
                                internal->lock          = 1;
-                               dprintk(verbose, FE_DEBUG, 1,
+                               dprintk(state->verbose, FE_DEBUG, 1,
                                        "-------------------------------------> DVB-S2 LOCK !");
 
 //                             stb0899_write_reg(state, STB0899_ERRCTRL1, 0xb6); /* Packet Errors      */
@@ -1656,207 +1561,18 @@ static enum dvbfe_search stb0899_search(struct dvb_frontend *fe, struct dvbfe_pa
                        }
                        break;
                default:
-                       dprintk(verbose, FE_ERROR, 1, "Unsupported delivery system");
+                       dprintk(state->verbose, FE_ERROR, 1, "Unsupported delivery system");
                        return DVBFE_ALGO_SEARCH_INVALID;
                }
        }
 
        return DVBFE_ALGO_SEARCH_ERROR;
 }
-
-static enum stb0899_status stb0899_track_carrier(struct stb0899_state *state)
-{
-       u8 reg;
-
-       reg = stb0899_read_reg(state, STB0899_DSTATUS);
-       dprintk(verbose, FE_DEBUG, 1, "--------------------> STB0899_DSTATUS=[0x%02x]", reg);
-       if (STB0899_GETFIELD(CARRIER_FOUND, reg)) {
-               dprintk(verbose, FE_DEBUG, 1, "-------------> CARRIEROK !");
-               return CARRIEROK;
-       } else {
-               dprintk(verbose, FE_DEBUG, 1, "-------------> NOCARRIER !");
-               return NOCARRIER;
-       }
-
-       return NOCARRIER;
-}
-
-static enum stb0899_status stb0899_get_ifagc(struct stb0899_state *state)
-{
-       u8 reg;
-
-       reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_STATUS);
-       dprintk(verbose, FE_DEBUG, 1, "DMD_STATUS=[0x%02x]", reg);
-       if (STB0899_GETFIELD(IF_AGC_LOCK, reg)) {
-               dprintk(verbose, FE_DEBUG, 1, "------------->IF AGC LOCKED !");
-               return AGC1OK;
-       } else {
-               dprintk(verbose, FE_DEBUG, 1, "------------->IF AGC LOCK LOST !");
-               return NOAGC1;
-       }
-
-       return NOAGC1;
-}
-
-static int stb0899_get_s1fec(struct stb0899_internal *internal, enum dvbfe_fec *fec)
-{
-       switch (internal->fecrate) {
-       case STB0899_FEC_1_2:
-               *fec = DVBFE_FEC_1_2;
-               break;
-       case STB0899_FEC_2_3:
-               *fec = DVBFE_FEC_2_3;
-               break;
-       case STB0899_FEC_3_4:
-               *fec = DVBFE_FEC_3_4;
-               break;
-       case STB0899_FEC_5_6:
-               *fec = DVBFE_FEC_5_6;
-               break;
-       case STB0899_FEC_6_7:
-               *fec = DVBFE_FEC_6_7;
-               break;
-       case STB0899_FEC_7_8:
-               *fec = DVBFE_FEC_7_8;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-static int stb0899_get_modcod(struct stb0899_internal *internal, struct dvbs2_params *params)
-{
-       switch (internal->modcod) {
-       case STB0899_DUMMY_PLF:
-               params->modulation      = DVBFE_MOD_NONE;
-               params->fec             = DVBFE_FEC_NONE;
-               break;
-       case STB0899_QPSK_14:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_1_4;
-               break;
-       case STB0899_QPSK_13:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_1_3;
-               break;
-       case STB0899_QPSK_25:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_2_5;
-               break;
-       case STB0899_QPSK_12:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_1_2;
-               break;
-       case STB0899_QPSK_35:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_3_5;
-               break;
-       case STB0899_QPSK_23:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_2_3;
-               break;
-       case STB0899_QPSK_34:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_3_4;
-               break;
-       case STB0899_QPSK_45:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_4_5;
-               break;
-       case STB0899_QPSK_56:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_5_6;
-               break;
-       case STB0899_QPSK_89:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_8_9;
-               break;
-       case STB0899_QPSK_910:
-               params->modulation      = DVBFE_MOD_QPSK;
-               params->fec             = DVBFE_FEC_9_10;
-               break;
-       case STB0899_8PSK_35:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_3_5;
-               break;
-       case STB0899_8PSK_23:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_2_3;
-               break;
-       case STB0899_8PSK_34:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_3_4;
-               break;
-       case STB0899_8PSK_56:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_5_6;
-               break;
-       case STB0899_8PSK_89:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_8_9;
-               break;
-       case STB0899_8PSK_910:
-               params->modulation      = DVBFE_MOD_8PSK;
-               params->fec             = DVBFE_FEC_9_10;
-               break;
-       case STB0899_16APSK_23:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_2_3;
-               break;
-       case STB0899_16APSK_34:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_3_4;
-               break;
-       case STB0899_16APSK_45:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_4_5;
-               break;
-       case STB0899_16APSK_56:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_5_6;
-               break;
-       case STB0899_16APSK_89:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_8_9;
-               break;
-       case STB0899_16APSK_910:
-               params->modulation      = DVBFE_MOD_16APSK;
-               params->fec             = DVBFE_FEC_9_10;
-               break;
-       case STB0899_32APSK_34:
-               params->modulation      = DVBFE_MOD_32APSK;
-               params->fec             = DVBFE_FEC_3_4;
-               break;
-       case STB0899_32APSK_45:
-               params->modulation      = DVBFE_MOD_32APSK;
-               params->fec             = DVBFE_FEC_4_5;
-               break;
-       case STB0899_32APSK_56:
-               params->modulation      = DVBFE_MOD_32APSK;
-               params->fec             = DVBFE_FEC_5_6;
-               break;
-       case STB0899_32APSK_89:
-               params->modulation      = DVBFE_MOD_32APSK;
-               params->fec             = DVBFE_FEC_8_9;
-               break;
-       case STB0899_32APSK_910:
-               params->modulation      = DVBFE_MOD_32APSK;
-               params->fec             = DVBFE_FEC_9_10;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
 /*
  * stb0899_track
  * periodically check the signal level against a specified
  * threshold level and perform derotator centering.
- * called once we have a lock from a succesful search
+ * called once we have a lock from a successful search
  * event.
  *
  * Will be called periodically called to maintain the
@@ -1868,46 +1584,18 @@ static int stb0899_get_modcod(struct stb0899_internal *internal, struct dvbs2_pa
  * Once a new lock has established, the internal state
  * frequency (internal->freq) is updated
  */
-static int stb0899_track(struct dvb_frontend *fe, struct dvbfe_params *params, int *delay)
+static int stb0899_track(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
 {
-       u32 lock_lost;
-
-       struct stb0899_state *state             = fe->demodulator_priv;
-       struct stb0899_internal *internal       = &state->internal;
-
-
-       *delay = HZ/10;
-
        return 0;
 }
 
-static int stb0899_get_params(struct dvb_frontend *fe, struct dvbfe_params *params)
+static int stb0899_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
 {
        struct stb0899_state *state             = fe->demodulator_priv;
        struct stb0899_internal *internal       = &state->internal;
 
-       params->frequency                       = internal->freq;
-       params->inversion                       = internal->inversion;
-       params->delivery                        = state->delsys;
-       switch (state->delsys) {
-       case DVBFE_DELSYS_DVBS:
-               dprintk(verbose, FE_DEBUG, 1, "Get DVB-S params");
-               params->delsys.dvbs.symbol_rate         = internal->srate;
-               params->delsys.dvbs.modulation          = DVBFE_MOD_QPSK;
-               break;
-       case DVBFE_DELSYS_DSS:
-               dprintk(verbose, FE_DEBUG, 1, "Get DSS params");
-               params->delsys.dss.symbol_rate          = internal->srate;
-               params->delsys.dss.modulation           = DVBFE_MOD_QPSK;
-               break;
-       case DVBFE_DELSYS_DVBS2:
-               dprintk(verbose, FE_DEBUG, 1, "Get DVB-S2 params");
-               params->delsys.dvbs2.symbol_rate        = internal->srate;
-               break;
-       default:
-               dprintk(verbose, FE_ERROR, 1, "Unsupported delivery system");
-               return -EINVAL;
-       }
+       dprintk(state->verbose, FE_DEBUG, 1, "Get params");
+       p->u.qpsk.symbol_rate = internal->srate;
 
        return 0;
 }
@@ -1920,7 +1608,19 @@ static enum dvbfe_algo stb0899_frontend_algo(struct dvb_frontend *fe)
 static struct dvb_frontend_ops stb0899_ops = {
 
        .info = {
-               .name                   = "STB0899 Multistandard",
+               .name                   = "STB0899 Multistandard",
+               .type                   = FE_QPSK,
+               .frequency_min          = 950000,
+               .frequency_max          = 2150000,
+               .frequency_stepsize     = 0,
+               .frequency_tolerance    = 0,
+               .symbol_rate_min        =  5000000,
+               .symbol_rate_max        = 45000000,
+
+               .caps                   = FE_CAN_INVERSION_AUTO |
+                                         FE_CAN_FEC_AUTO       |
+                                         FE_CAN_2G_MODULATION  |
+                                         FE_CAN_QPSK
        },
 
        .release                        = stb0899_release,
@@ -1929,18 +1629,16 @@ static struct dvb_frontend_ops stb0899_ops = {
 //     .wakeup                         = stb0899_wakeup,
 
        .i2c_gate_ctrl                  = stb0899_i2c_gate_ctrl,
-       .get_info                       = stb0899_get_info,
-       .get_delsys                     = stb0899_get_delsys,
 
        .get_frontend_algo              = stb0899_frontend_algo,
        .search                         = stb0899_search,
        .track                          = stb0899_track,
-       .get_params                     = stb0899_get_params,
+       .get_frontend                   = stb0899_get_frontend,
+
 
        .read_status                    = stb0899_read_status,
        .read_snr                       = stb0899_read_snr,
        .read_signal_strength           = stb0899_read_signal_strength,
-       .read_status                    = stb0899_read_status,
        .read_ber                       = stb0899_read_ber,
 
        .set_voltage                    = stb0899_set_voltage,
@@ -1961,7 +1659,7 @@ struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_ad
                goto error;
 
        inversion                               = config->inversion;
-       state->verbose                          = verbose;
+       state->verbose                          = &verbose;
        state->config                           = config;
        state->i2c                              = i2c;
        state->frontend.ops                     = stb0899_ops;