]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] dvb: remove dvb_frontend_parameters from calc_regs()
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 24 Dec 2011 15:03:05 +0000 (12:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 10:52:22 +0000 (08:52 -0200)
The calc_regs() callback is used by a few frontends (mt352, nxt200x,
digitv and zl10353). On all places it is called, the parameters are
set by DVBv5 way. So, just use the DVBv5 struct and remove the
extra parameter.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/tuner-simple.c
drivers/media/dvb/bt8xx/dvb-bt8xx.c
drivers/media/dvb/dvb-core/dvb_frontend.h
drivers/media/dvb/dvb-usb/digitv.c
drivers/media/dvb/frontends/dvb-pll.c
drivers/media/dvb/frontends/mt352.c
drivers/media/dvb/frontends/nxt200x.c
drivers/media/dvb/frontends/zl10353.c

index e6342dbb2cf763f9904b08f294300c69da12f876..1dad5fbb4de0ffdb8ae39076c659ebd302edfe95 100644 (file)
@@ -884,7 +884,6 @@ static u32 simple_dvb_configure(struct dvb_frontend *fe, u8 *buf,
 }
 
 static int simple_dvb_calc_regs(struct dvb_frontend *fe,
-                               struct dvb_frontend_parameters *params,
                                u8 *buf, int buf_len)
 {
        struct dtv_frontend_properties *c = &fe->dtv_property_cache;
@@ -896,28 +895,14 @@ static int simple_dvb_calc_regs(struct dvb_frontend *fe,
        if (buf_len < 5)
                return -EINVAL;
 
-       switch (delsys) {
-       case SYS_DVBT:
-       case SYS_DVBT2:
-               if (params->u.ofdm.bandwidth == BANDWIDTH_6_MHZ)
-                       bw = 6000000;
-               if (params->u.ofdm.bandwidth == BANDWIDTH_7_MHZ)
-                       bw = 7000000;
-               if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
-                       bw = 8000000;
-               break;
-       default:
-               break;
-       }
-       frequency = simple_dvb_configure(fe, buf+1, delsys, params->frequency, bw);
+       frequency = simple_dvb_configure(fe, buf+1, delsys, c->frequency, bw);
        if (frequency == 0)
                return -EINVAL;
 
        buf[0] = priv->i2c_props.addr;
 
        priv->frequency = frequency;
-       priv->bandwidth = (fe->ops.info.type == FE_OFDM) ?
-               params->u.ofdm.bandwidth : 0;
+       priv->bandwidth = c->bandwidth_hz;
 
        return 5;
 }
@@ -1044,7 +1029,17 @@ static int simple_get_frequency(struct dvb_frontend *fe, u32 *frequency)
 static int simple_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
 {
        struct tuner_simple_priv *priv = fe->tuner_priv;
-       *bandwidth = priv->bandwidth;
+       switch (priv->bandwidth) {
+       case 6000000:
+               *bandwidth = BANDWIDTH_6_MHZ;
+               break;
+       case 7000000:
+               *bandwidth = BANDWIDTH_7_MHZ;
+               break;
+       case 8000000:
+               *bandwidth = BANDWIDTH_8_MHZ;
+               break;
+       }
        return 0;
 }
 
index 5948601ec809db57029254a349306d13479d3e07..87e4c72989d1735104ca2d3b17a81de4c86bc143 100644 (file)
@@ -148,8 +148,9 @@ static int thomson_dtt7579_demod_init(struct dvb_frontend* fe)
        return 0;
 }
 
-static int thomson_dtt7579_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int thomson_dtt7579_tuner_calc_regs(struct dvb_frontend *fe, u8* pllbuf, int buf_len)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        u32 div;
        unsigned char bs = 0;
        unsigned char cp = 0;
@@ -157,18 +158,18 @@ static int thomson_dtt7579_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_f
        if (buf_len < 5)
                return -EINVAL;
 
-       div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+       div = (((c->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
 
-       if (params->frequency < 542000000)
+       if (c->frequency < 542000000)
                cp = 0xb4;
-       else if (params->frequency < 771000000)
+       else if (c->frequency < 771000000)
                cp = 0xbc;
        else
                cp = 0xf4;
 
-       if (params->frequency == 0)
+       if (c->frequency == 0)
                bs = 0x03;
-       else if (params->frequency < 443250000)
+       else if (c->frequency < 443250000)
                bs = 0x02;
        else
                bs = 0x08;
@@ -342,50 +343,51 @@ static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe)
        return 0;
 }
 
-static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs(struct dvb_frontend *fe, u8 *pllbuf, int buf_len)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        u32 div;
        unsigned char bs = 0;
        unsigned char cp = 0;
 
        if (buf_len < 5) return -EINVAL;
 
-       div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+       div = (((c->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
 
-       if (params->frequency < 150000000)
+       if (c->frequency < 150000000)
                cp = 0xB4;
-       else if (params->frequency < 173000000)
+       else if (c->frequency < 173000000)
                cp = 0xBC;
-       else if (params->frequency < 250000000)
+       else if (c->frequency < 250000000)
                cp = 0xB4;
-       else if (params->frequency < 400000000)
+       else if (c->frequency < 400000000)
                cp = 0xBC;
-       else if (params->frequency < 420000000)
+       else if (c->frequency < 420000000)
                cp = 0xF4;
-       else if (params->frequency < 470000000)
+       else if (c->frequency < 470000000)
                cp = 0xFC;
-       else if (params->frequency < 600000000)
+       else if (c->frequency < 600000000)
                cp = 0xBC;
-       else if (params->frequency < 730000000)
+       else if (c->frequency < 730000000)
                cp = 0xF4;
        else
                cp = 0xFC;
 
-       if (params->frequency < 150000000)
+       if (c->frequency < 150000000)
                bs = 0x01;
-       else if (params->frequency < 173000000)
+       else if (c->frequency < 173000000)
                bs = 0x01;
-       else if (params->frequency < 250000000)
+       else if (c->frequency < 250000000)
                bs = 0x02;
-       else if (params->frequency < 400000000)
+       else if (c->frequency < 400000000)
                bs = 0x02;
-       else if (params->frequency < 420000000)
+       else if (c->frequency < 420000000)
                bs = 0x02;
-       else if (params->frequency < 470000000)
+       else if (c->frequency < 470000000)
                bs = 0x02;
-       else if (params->frequency < 600000000)
+       else if (c->frequency < 600000000)
                bs = 0x08;
-       else if (params->frequency < 730000000)
+       else if (c->frequency < 730000000)
                bs = 0x08;
        else
                bs = 0x08;
@@ -514,31 +516,31 @@ static int digitv_alps_tded4_demod_init(struct dvb_frontend* fe)
        return 0;
 }
 
-static int digitv_alps_tded4_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int digitv_alps_tded4_tuner_calc_regs(struct dvb_frontend *fe,  u8 *pllbuf, int buf_len)
 {
        u32 div;
-       struct dvb_ofdm_parameters *op = &params->u.ofdm;
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
 
        if (buf_len < 5)
                return -EINVAL;
 
-       div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
+       div = (((c->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
 
        pllbuf[0] = 0x61;
        pllbuf[1] = (div >> 8) & 0x7F;
        pllbuf[2] = div & 0xFF;
        pllbuf[3] = 0x85;
 
-       dprintk("frequency %u, div %u\n", params->frequency, div);
+       dprintk("frequency %u, div %u\n", c->frequency, div);
 
-       if (params->frequency < 470000000)
+       if (c->frequency < 470000000)
                pllbuf[4] = 0x02;
-       else if (params->frequency > 823000000)
+       else if (c->frequency > 823000000)
                pllbuf[4] = 0x88;
        else
                pllbuf[4] = 0x08;
 
-       if (op->bandwidth == 8)
+       if (c->bandwidth_hz == 8000000)
                pllbuf[4] |= 0x04;
 
        return 5;
index 67bbfa728016f72ef600bd683d84ef422930362e..99ae7828f893318563b093dd2d8d862ac38932b5 100644 (file)
@@ -202,7 +202,7 @@ struct dvb_tuner_ops {
        int (*set_analog_params)(struct dvb_frontend *fe, struct analog_parameters *p);
 
        /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */
-       int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len);
+       int (*calc_regs)(struct dvb_frontend *fe, u8 *buf, int buf_len);
 
        /** This is to allow setting tuner-specific configs */
        int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
index f7184111aa6459a9573454a6d56bb08b28347a34..2856ab74e964b1fcfe38ef066b296c3b723b959a 100644 (file)
@@ -123,7 +123,7 @@ static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
        struct dvb_usb_adapter *adap = fe->dvb->priv;
        u8 b[5];
 
-       fe->ops.tuner_ops.calc_regs(fe, fep, b, sizeof(b));
+       fe->ops.tuner_ops.calc_regs(fe, b, sizeof(b));
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 1);
        return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
index c19d6bbc68ce272fcb38c1d77c08f04099bcf378..f967cf9b4a60f31a213e8712271c29e702d72859 100644 (file)
@@ -647,9 +647,9 @@ static int dvb_pll_set_params(struct dvb_frontend *fe,
 }
 
 static int dvb_pll_calc_regs(struct dvb_frontend *fe,
-                            struct dvb_frontend_parameters *params,
                             u8 *buf, int buf_len)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        struct dvb_pll_priv *priv = fe->tuner_priv;
        int result;
        u32 frequency = 0;
@@ -657,7 +657,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
        if (buf_len < 5)
                return -EINVAL;
 
-       result = dvb_pll_configure(fe, buf + 1, params->frequency);
+       result = dvb_pll_configure(fe, buf + 1, c->frequency);
        if (result < 0)
                return result;
        else
@@ -666,7 +666,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
        buf[0] = priv->pll_i2c_address;
 
        priv->frequency = frequency;
-       priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
+       priv->bandwidth = c->bandwidth_hz;
 
        return 5;
 }
index 319672f8e1a70c8ac04ec8940f1698d29ccf7bdc..e2a86daba502127864c5e6ba6a73c0c3506e90c5 100644 (file)
@@ -302,7 +302,7 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
                _mt352_write(fe, fsm_go, 2);
        } else {
                if (fe->ops.tuner_ops.calc_regs) {
-                       fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
+                       fe->ops.tuner_ops.calc_regs(fe, buf+8, 5);
                        buf[8] <<= 1;
                        _mt352_write(fe, buf, sizeof(buf));
                        _mt352_write(fe, tuner_go, 2);
index eac20650499fb510217a1ccf4bba9598083f60c7..ae5c3c32f407e168d2b834f653d4ad55e94d23ab 100644 (file)
@@ -566,7 +566,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
 
        if (fe->ops.tuner_ops.calc_regs) {
                /* get tuning information */
-               fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
+               fe->ops.tuner_ops.calc_regs(fe, buf, 5);
 
                /* write frequency information */
                nxt200x_writetuner(state, buf);
index adbbf6d3d044cc4d491032638b7498a2ee422f3e..9caccc03d588cb1a3f7a451e20599c1a23a7013c 100644 (file)
@@ -367,7 +367,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe,
                                fe->ops.i2c_gate_ctrl(fe, 0);
                }
        } else if (fe->ops.tuner_ops.calc_regs) {
-               fe->ops.tuner_ops.calc_regs(fe, param, pllbuf + 1, 5);
+               fe->ops.tuner_ops.calc_regs(fe, pllbuf + 1, 5);
                pllbuf[1] <<= 1;
                zl10353_write(fe, pllbuf, sizeof(pllbuf));
        }