]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
V4L/DVB (12097): Implement reading uncorrected blocks for stv0900
authorAbylay Ospan <aospan@netup.ru>
Mon, 8 Jun 2009 07:31:26 +0000 (04:31 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 23 Jun 2009 06:14:07 +0000 (03:14 -0300)
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stv0900_core.c

index 4daec8ad92c3c72d8af91178004aa595be12ad37..9ab4f30146734f0daa6d5bd1295818380923f33f 100644 (file)
@@ -712,6 +712,44 @@ static s32 stv0900_carr_get_quality(struct dvb_frontend *fe,
        return c_n;
 }
 
+static int stv0900_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks)
+{
+       struct stv0900_state *state = fe->demodulator_priv;
+       struct stv0900_internal *i_params = state->internal;
+       enum fe_stv0900_demod_num demod = state->demod;
+       u8 err_val1, err_val0;
+       s32 err_field1, err_field0;
+       u32 header_err_val = 0;
+
+       *ucblocks = 0x0;
+       if (stv0900_get_standard(fe, demod) == STV0900_DVBS2_STANDARD) {
+               /* DVB-S2 delineator errors count */
+
+               /* retreiving number for errnous headers */
+               dmd_reg(err_field0, R0900_P1_BBFCRCKO0,
+                                       R0900_P2_BBFCRCKO0);
+               dmd_reg(err_field1, R0900_P1_BBFCRCKO1,
+                                       R0900_P2_BBFCRCKO1);
+
+               err_val1 = stv0900_read_reg(i_params, err_field1);
+               err_val0 = stv0900_read_reg(i_params, err_field0);
+               header_err_val = (err_val1<<8) | err_val0;
+
+               /* retreiving number for errnous packets */
+               dmd_reg(err_field0, R0900_P1_UPCRCKO0,
+                                       R0900_P2_UPCRCKO0);
+               dmd_reg(err_field1, R0900_P1_UPCRCKO1,
+                                       R0900_P2_UPCRCKO1);
+
+               err_val1 = stv0900_read_reg(i_params, err_field1);
+               err_val0 = stv0900_read_reg(i_params, err_field0);
+               *ucblocks = (err_val1<<8) | err_val0;
+               *ucblocks += header_err_val;
+       }
+
+       return 0;
+}
+
 static int stv0900_read_snr(struct dvb_frontend *fe, u16 *snr)
 {
        *snr = stv0900_carr_get_quality(fe,
@@ -1882,6 +1920,7 @@ static struct dvb_frontend_ops stv0900_ops = {
        .read_ber                       = stv0900_read_ber,
        .read_signal_strength           = stv0900_read_signal_strength,
        .read_snr                       = stv0900_read_snr,
+       .read_ucblocks                  = stv0900_read_ucblocks,
 };
 
 struct dvb_frontend *stv0900_attach(const struct stv0900_config *config,