dvb-fe: Add support for setting the LNA before tuning
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 16 Feb 2014 08:36:47 +0000 (17:36 +0900)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 16 Feb 2014 09:01:32 +0000 (18:01 +0900)
Sometimes, we need to control the Low Noise Amplifier (LNA)
at the antena, in order to get a signal. This is dependent on
the way the tuner is connected to the antena, and if the antena
has support for it.

Add a logic at the code to set it. By default, LNA will be in auto
mode, with is the DVB core's default.

Enabling or disabling it is just a matter of changing parms->lna.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
lib/include/dvb-fe.h
lib/libdvbv5/dvb-fe.c

index 4accd5e..40dbe1a 100644 (file)
@@ -97,6 +97,7 @@ struct dvb_v5_fe_parms {
        struct dtv_property             dvb_prop[DTV_MAX_COMMAND];
        int                             legacy_fe;
        struct dvb_v5_stats             stats;
+       int                             lna;
 
        /* Satellite specific stuff, specified by the library client */
        const struct dvb_sat_lnb        *lnb;
index 41731e1..36da95d 100644 (file)
@@ -82,6 +82,7 @@ struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int frontend, unsigned verbose
        parms->sat_number = -1;
        parms->abort = 0;
        parms->logfunc = logfunc;
+       parms->lna = LNA_AUTO;
 
        if (ioctl(fd, FE_GET_INFO, &parms->info) == -1) {
                dvb_perror("FE_GET_INFO");
@@ -633,6 +634,9 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
        memset(&prop, 0, sizeof(prop));
        prop.props = tmp_parms.dvb_prop;
        prop.num = tmp_parms.n_props;
+       prop.props[prop.num].cmd = DTV_LNA;
+       prop.props[prop.num].u.data = parms->lna;
+       prop.num++;
        prop.props[prop.num].cmd = DTV_TUNE;
        prop.num++;
 
@@ -643,6 +647,9 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
                                dvb_fe_prt_parms(parms);
                        return -1;
                }
+               if (parms->lna != LNA_AUTO && parms->verbose)
+                       dvb_logdbg("LNA is %s", parms->lna ? "ON" : "OFF");
+
                return 0;
        }
        /* DVBv3 call */