]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] or51132: convert set_fontend to use DVBv5 parameters
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 26 Dec 2011 18:01:57 +0000 (15:01 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 11:46:10 +0000 (09:46 -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/or51132.c

index e0c952c535a9f7f3982e7c0a98c936b48042c4cc..1fc7778a58c8c16ea2546f013a4a230fe623f785 100644 (file)
@@ -306,9 +306,9 @@ static int modulation_fw_class(fe_modulation_t modulation)
        }
 }
 
-static int or51132_set_parameters(struct dvb_frontend* fe,
-                                 struct dvb_frontend_parameters *param)
+static int or51132_set_parameters(struct dvb_frontend *fe)
 {
+       struct dtv_frontend_properties *p = &fe->dtv_property_cache;
        int ret;
        struct or51132_state* state = fe->demodulator_priv;
        const struct firmware *fw;
@@ -317,8 +317,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
 
        /* Upload new firmware only if we need a different one */
        if (modulation_fw_class(state->current_modulation) !=
-           modulation_fw_class(param->u.vsb.modulation)) {
-               switch(modulation_fw_class(param->u.vsb.modulation)) {
+           modulation_fw_class(p->modulation)) {
+               switch (modulation_fw_class(p->modulation)) {
                case MOD_FWCLASS_VSB:
                        dprintk("set_parameters VSB MODE\n");
                        fwname = OR51132_VSB_FIRMWARE;
@@ -335,7 +335,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
                        break;
                default:
                        printk("or51132: Modulation type(%d) UNSUPPORTED\n",
-                              param->u.vsb.modulation);
+                              p->modulation);
                        return -1;
                }
                printk("or51132: Waiting for firmware upload(%s)...\n",
@@ -357,8 +357,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
                state->config->set_ts_params(fe, clock_mode);
        }
        /* Change only if we are actually changing the modulation */
-       if (state->current_modulation != param->u.vsb.modulation) {
-               state->current_modulation = param->u.vsb.modulation;
+       if (state->current_modulation != p->modulation) {
+               state->current_modulation = p->modulation;
                or51132_setmode(fe);
        }
 
@@ -371,12 +371,12 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
        or51132_setmode(fe);
 
        /* Update current frequency */
-       state->current_frequency = param->frequency;
+       state->current_frequency = p->frequency;
        return 0;
 }
 
 static int or51132_get_parameters(struct dvb_frontend* fe,
-                                 struct dvb_frontend_parameters *param)
+                                 struct dtv_frontend_properties *p)
 {
        struct or51132_state* state = fe->demodulator_priv;
        int status;
@@ -389,21 +389,28 @@ start:
                return -EREMOTEIO;
        }
        switch(status&0xff) {
-               case 0x06: param->u.vsb.modulation = VSB_8; break;
-               case 0x43: param->u.vsb.modulation = QAM_64; break;
-               case 0x45: param->u.vsb.modulation = QAM_256; break;
-               default:
-                       if (retry--) goto start;
-                       printk(KERN_WARNING "or51132: unknown status 0x%02x\n",
-                              status&0xff);
-                       return -EREMOTEIO;
+       case 0x06:
+               p->modulation = VSB_8;
+               break;
+       case 0x43:
+               p->modulation = QAM_64;
+               break;
+       case 0x45:
+               p->modulation = QAM_256;
+               break;
+       default:
+               if (retry--)
+                       goto start;
+               printk(KERN_WARNING "or51132: unknown status 0x%02x\n",
+                      status&0xff);
+               return -EREMOTEIO;
        }
 
        /* FIXME: Read frequency from frontend, take AFC into account */
-       param->frequency = state->current_frequency;
+       p->frequency = state->current_frequency;
 
        /* FIXME: How to read inversion setting? Receiver 6 register? */
-       param->inversion = INVERSION_AUTO;
+       p->inversion = INVERSION_AUTO;
 
        return 0;
 }
@@ -579,7 +586,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
 }
 
 static struct dvb_frontend_ops or51132_ops = {
-
+       .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
        .info = {
                .name                   = "Oren OR51132 VSB/QAM Frontend",
                .type                   = FE_ATSC,
@@ -597,8 +604,8 @@ static struct dvb_frontend_ops or51132_ops = {
        .init = or51132_init,
        .sleep = or51132_sleep,
 
-       .set_frontend_legacy = or51132_set_parameters,
-       .get_frontend_legacy = or51132_get_parameters,
+       .set_frontend = or51132_set_parameters,
+       .get_frontend = or51132_get_parameters,
        .get_tune_settings = or51132_get_tune_settings,
 
        .read_status = or51132_read_status,