]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] dvb: the core logic to handle the DVBv5 QoS properties
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 7 Jan 2013 18:41:35 +0000 (15:41 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 23 Jan 2013 21:09:52 +0000 (19:09 -0200)
Add the logic to poll, reset counters and report the QoS stats
to the end user.
The idea is that the core will periodically poll the frontend for
the stats. The frontend may return -EBUSY, if the previous collect
didn't finish, or it may fill the cached data.
The value returned to the end user is always the cached data.

Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb-core/dvb_frontend.c
drivers/media/dvb-core/dvb_frontend.h

index dd35fa972067bed0d8e3aa01f940b8c7570678f4..0c6f936ffac8ed810608a615e6da1e78d575c4de 100644 (file)
@@ -1053,6 +1053,16 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
        _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0),
        _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0),
        _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
+
+       /* Statistics API */
+       _DTV_CMD(DTV_STAT_SIGNAL_STRENGTH, 0, 0),
+       _DTV_CMD(DTV_STAT_CNR, 0, 0),
+       _DTV_CMD(DTV_STAT_PRE_ERROR_BIT_COUNT, 0, 0),
+       _DTV_CMD(DTV_STAT_PRE_TOTAL_BIT_COUNT, 0, 0),
+       _DTV_CMD(DTV_STAT_POST_ERROR_BIT_COUNT, 0, 0),
+       _DTV_CMD(DTV_STAT_POST_TOTAL_BIT_COUNT, 0, 0),
+       _DTV_CMD(DTV_STAT_ERROR_BLOCK_COUNT, 0, 0),
+       _DTV_CMD(DTV_STAT_TOTAL_BLOCK_COUNT, 0, 0),
 };
 
 static void dtv_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp)
@@ -1443,6 +1453,31 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
                tvp->u.data = c->lna;
                break;
 
+       /* Fill quality measures */
+       case DTV_STAT_SIGNAL_STRENGTH:
+               tvp->u.st = c->strength;
+               break;
+       case DTV_STAT_CNR:
+               tvp->u.st = c->cnr;
+               break;
+       case DTV_STAT_PRE_ERROR_BIT_COUNT:
+               tvp->u.st = c->pre_bit_error;
+               break;
+       case DTV_STAT_PRE_TOTAL_BIT_COUNT:
+               tvp->u.st = c->pre_bit_count;
+               break;
+       case DTV_STAT_POST_ERROR_BIT_COUNT:
+               tvp->u.st = c->post_bit_error;
+               break;
+       case DTV_STAT_POST_TOTAL_BIT_COUNT:
+               tvp->u.st = c->post_bit_count;
+               break;
+       case DTV_STAT_ERROR_BLOCK_COUNT:
+               tvp->u.st = c->block_error;
+               break;
+       case DTV_STAT_TOTAL_BLOCK_COUNT:
+               tvp->u.st = c->block_count;
+               break;
        default:
                return -EINVAL;
        }
index 97112cd88a177f4ad66fafa8bd66e540aaf86dcf..b34922a0815643986da4d0d12ba355f5674bce3d 100644 (file)
@@ -393,6 +393,16 @@ struct dtv_frontend_properties {
        u8                      atscmh_sccc_code_mode_d;
 
        u32                     lna;
+
+       /* statistics data */
+       struct dtv_fe_stats     strength;
+       struct dtv_fe_stats     cnr;
+       struct dtv_fe_stats     pre_bit_error;
+       struct dtv_fe_stats     pre_bit_count;
+       struct dtv_fe_stats     post_bit_error;
+       struct dtv_fe_stats     post_bit_count;
+       struct dtv_fe_stats     block_error;
+       struct dtv_fe_stats     block_count;
 };
 
 struct dvb_frontend {