[media] nxt6000: convert set_fontend to use DVBv5 parameters
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 26 Dec 2011 15:26:34 +0000 (12:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 11:30:51 +0000 (09:30 -0200)
Instead of using dvb_frontend_parameters struct, that were
designed for a subset of the supported standards, use the DVBv5
cache information.

Also, fill the supported delivery systems at dvb_frontend_ops
struct.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/nxt6000.c

index a2419e86f34ae6e28f844d7cbc521aad92dcb6e1..89021bddfcb6f60c398aedda5434a1af1fb3c320 100644 (file)
@@ -81,22 +81,21 @@ static void nxt6000_reset(struct nxt6000_state* state)
        nxt6000_writereg(state, OFDM_COR_CTL, val | COREACT);
 }
 
-static int nxt6000_set_bandwidth(struct nxt6000_state* state, fe_bandwidth_t bandwidth)
+static int nxt6000_set_bandwidth(struct nxt6000_state *state, u32 bandwidth)
 {
        u16 nominal_rate;
        int result;
 
        switch (bandwidth) {
-
-       case BANDWIDTH_6_MHZ:
+       case 6000000:
                nominal_rate = 0x55B7;
                break;
 
-       case BANDWIDTH_7_MHZ:
+       case 7000000:
                nominal_rate = 0x6400;
                break;
 
-       case BANDWIDTH_8_MHZ:
+       case 8000000:
                nominal_rate = 0x7249;
                break;
 
@@ -457,8 +456,9 @@ static int nxt6000_init(struct dvb_frontend* fe)
        return 0;
 }
 
-static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *param)
+static int nxt6000_set_frontend(struct dvb_frontend *fe)
 {
+       struct dtv_frontend_properties *p = &fe->dtv_property_cache;
        struct nxt6000_state* state = fe->demodulator_priv;
        int result;
 
@@ -467,13 +467,20 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
                if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
        }
 
-       if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0)
+       result = nxt6000_set_bandwidth(state, p->bandwidth_hz);
+       if (result < 0)
                return result;
-       if ((result = nxt6000_set_guard_interval(state, param->u.ofdm.guard_interval)) < 0)
+
+       result = nxt6000_set_guard_interval(state, p->guard_interval);
+       if (result < 0)
                return result;
-       if ((result = nxt6000_set_transmission_mode(state, param->u.ofdm.transmission_mode)) < 0)
+
+       result = nxt6000_set_transmission_mode(state, p->transmission_mode);
+       if (result < 0)
                return result;
-       if ((result = nxt6000_set_inversion(state, param->inversion)) < 0)
+
+       result = nxt6000_set_inversion(state, p->inversion);
+       if (result < 0)
                return result;
 
        msleep(500);
@@ -566,7 +573,7 @@ error:
 }
 
 static struct dvb_frontend_ops nxt6000_ops = {
-
+       .delsys = { SYS_DVBT },
        .info = {
                .name = "NxtWave NXT6000 DVB-T",
                .type = FE_OFDM,
@@ -592,7 +599,7 @@ static struct dvb_frontend_ops nxt6000_ops = {
 
        .get_tune_settings = nxt6000_fe_get_tune_settings,
 
-       .set_frontend_legacy = nxt6000_set_frontend,
+       .set_frontend = nxt6000_set_frontend,
 
        .read_status = nxt6000_read_status,
        .read_ber = nxt6000_read_ber,