]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] DVB: Query DVB frontend delivery capabilities
authorManu Abraham <abraham.manu@gmail.com>
Sun, 13 Nov 2011 21:47:44 +0000 (18:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 12 Dec 2011 17:03:32 +0000 (15:03 -0200)
 Currently, for any multi-standard frontend it is assumed that it just
 has a single standard capability. This is fine in some cases, but
 makes things hard when there are incompatible standards in conjuction.
 Eg: DVB-S can be seen as a subset of DVB-S2, but the same doesn't hold
 the same for DSS. This is not specific to any driver as it is, but a
 generic issue. This was handled correctly in the multiproto tree,
 while such functionality is missing from the v5 API update.

 http://www.linuxtv.org/pipermail/vdr/2008-November/018417.html

 Later on a FE_CAN_2G_MODULATION was added as a hack to workaround this
 issue in the v5 API, but that hack is incapable of addressing the
 issue, as it can be used to simply distinguish between DVB-S and
 DVB-S2 alone, or another X vs X2 modulation. If there are more systems,
 then you have a potential issue.

 An application needs to query the device capabilities before requesting
 any operation from the device.

Signed-off-by: Manu Abraham <abraham.manu@gmail.com>
Acked-by: Andreas Oberritter <obi@linuxtv.org>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-core/dvb_frontend.c
include/linux/dvb/frontend.h
include/linux/dvb/version.h

index c849455458ea8d02f3f00a96b32ba83f00a57083..821b2250ec701a801344de85eb352627ed1ee5ba 100644 (file)
@@ -974,6 +974,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
        _DTV_CMD(DTV_GUARD_INTERVAL, 0, 0),
        _DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0),
        _DTV_CMD(DTV_HIERARCHY, 0, 0),
+
+       _DTV_CMD(DTV_ENUM_DELSYS, 0, 0),
 };
 
 static void dtv_property_dump(struct dtv_property *tvp)
@@ -1209,6 +1211,37 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
 static int dvb_frontend_ioctl_properties(struct file *file,
                        unsigned int cmd, void *parg);
 
+static void dtv_set_default_delivery_caps(const struct dvb_frontend *fe, struct dtv_property *p)
+{
+       const struct dvb_frontend_info *info = &fe->ops.info;
+       u32 ncaps = 0;
+
+       switch (info->type) {
+       case FE_QPSK:
+               p->u.buffer.data[ncaps++] = SYS_DVBS;
+               if (info->caps & FE_CAN_2G_MODULATION)
+                       p->u.buffer.data[ncaps++] = SYS_DVBS2;
+               if (info->caps & FE_CAN_TURBO_FEC)
+                       p->u.buffer.data[ncaps++] = SYS_TURBO;
+               break;
+       case FE_QAM:
+               p->u.buffer.data[ncaps++] = SYS_DVBC_ANNEX_AC;
+               break;
+       case FE_OFDM:
+               p->u.buffer.data[ncaps++] = SYS_DVBT;
+               if (info->caps & FE_CAN_2G_MODULATION)
+                       p->u.buffer.data[ncaps++] = SYS_DVBT2;
+               break;
+       case FE_ATSC:
+               if (info->caps & (FE_CAN_8VSB | FE_CAN_16VSB))
+                       p->u.buffer.data[ncaps++] = SYS_ATSC;
+               if (info->caps & (FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256))
+                       p->u.buffer.data[ncaps++] = SYS_DVBC_ANNEX_B;
+               break;
+       }
+       p->u.buffer.len = ncaps;
+}
+
 static int dtv_property_process_get(struct dvb_frontend *fe,
                                    struct dtv_property *tvp,
                                    struct file *file)
@@ -1229,6 +1262,9 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
        }
 
        switch(tvp->cmd) {
+       case DTV_ENUM_DELSYS:
+               dtv_set_default_delivery_caps(fe, tvp);
+               break;
        case DTV_FREQUENCY:
                tvp->u.data = c->frequency;
                break;
index d9251df867b5886d54b19969fc8089008c3586e5..cb114f52ccf752a592fe2e0953afb7c80e2e2ec0 100644 (file)
@@ -316,7 +316,9 @@ struct dvb_frontend_event {
 
 #define DTV_DVBT2_PLP_ID       43
 
-#define DTV_MAX_COMMAND                                DTV_DVBT2_PLP_ID
+#define DTV_ENUM_DELSYS                44
+
+#define DTV_MAX_COMMAND                                DTV_ENUM_DELSYS
 
 typedef enum fe_pilot {
        PILOT_ON,
index 66594b1d5d7b01a766c359ce96d3e6dbc290c984..0559e2bd38f96e54df84936a78bac5cc7fba5365 100644 (file)
@@ -24,6 +24,6 @@
 #define _DVBVERSION_H_
 
 #define DVB_API_VERSION 5
-#define DVB_API_VERSION_MINOR 4
+#define DVB_API_VERSION_MINOR 5
 
 #endif /*_DVBVERSION_H_*/