This patch solved my problems.
Please integrate it.

/Anders

On Aug 7, 2006, at 4:45 PM, Yeasah Pell wrote:

I've had this dst patch kicking around for a while now -- it needs somebody else to try it out and confirm. If anybody's got a dst card and wouldn't mind trying out this patch, it'd be nice, as I'm getting a little tired of having this patch outstanding :-)

It changes the way the dst tone/power commands are issued, and has the following effects:

* Previously, tone/power commands would be partially co-mingled with tuning commands under some circumstances, and thus some commands could be lost (and bogus commands issued to the dst chip)

* The toneburst ("minidiseqc") command values were wrong (at least on my card), the new code generates the proper tonebursts. Somebody with a minidiseqc switch would have to verify this one. I bet nobody uses one of those though. FWIW, I did verify both with a scope and a minidiseqc switch, so it definitely works for my card anyway.

* It keeps better track of what the last state of the hardware was for the tone/power command so as to avoid unnecessary i2c traffic, but also to allow the retry of failed commands. (i.e. it won't squelch a repeat command if the last one failed)

thanks,
-yeasah
diff -r cf687ab6b0ab linux/drivers/media/dvb/bt8xx/dst.c
--- a/linux/drivers/media/dvb/bt8xx/dst.c Mon Aug 07 10:44:33 2006 -0300 +++ b/linux/drivers/media/dvb/bt8xx/dst.c Mon Aug 07 10:18:57 2006 -0400
@@ -1330,9 +1330,38 @@ static int dst_tone_power_cmd(struct dst

        if (state->dst_type != DST_TYPE_IS_SAT)
                return -EOPNOTSUPP;
-       paket[4] = state->tx_tuna[4];
-       paket[2] = state->tx_tuna[2];
-       paket[3] = state->tx_tuna[3];
+
+       switch (state->tone) {
+       case SEC_TONE_OFF:
+               if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
+                       paket[2] = 0x00;
+               else
+                       paket[2] = 0xff;
+               break;
+       case SEC_TONE_ON:
+               paket[2] = 0x02;
+               break;
+       }
+
+       switch (state->minicmd) {
+       case SEC_MINI_A:
+               paket[3] = 0x00;
+               break;
+       case SEC_MINI_B:
+               paket[3] = 0x01;
+               break;
+       }
+       state->minicmd = -1;
+
+       switch (state->voltage) {
+       case SEC_VOLTAGE_OFF:
+               paket[4] = 0x00;
+               break;
+       default:
+               paket[4] = 0x01;
+               break;
+       }
+
        paket[7] = dst_check_sum (paket, 7);
        return dst_command(state, paket, 8);
 }
@@ -1476,79 +1505,70 @@ static int dst_set_diseqc(struct dvb_fro

static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
 {
-       int need_cmd, retval = 0;
+       int retval = 0;
        struct dst_state *state = fe->demodulator_priv;

        state->voltage = voltage;
        if (state->dst_type != DST_TYPE_IS_SAT)
                return -EOPNOTSUPP;
-
-       need_cmd = 0;

        switch (voltage) {
        case SEC_VOLTAGE_13:
        case SEC_VOLTAGE_18:
                if ((state->diseq_flags & HAS_POWER) == 0)
-                       need_cmd = 1;
-               state->diseq_flags |= HAS_POWER;
-               state->tx_tuna[4] = 0x01;
+                       retval = dst_tone_power_cmd(state);
+               if (retval == 0)
+                       state->diseq_flags |= HAS_POWER;
                break;
        case SEC_VOLTAGE_OFF:
-               need_cmd = 1;
-               state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | ATTEMPT_TUNE);
-               state->tx_tuna[4] = 0x00;
+               if ((state->diseq_flags & HAS_POWER) != 0)
+                       retval = dst_tone_power_cmd(state);
+               if (retval == 0)
+                       state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | 
ATTEMPT_TUNE);
                break;
        default:
                return -EINVAL;
        }

-       if (need_cmd)
-               retval = dst_tone_power_cmd(state);
-
        return retval;
 }

static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
 {
+       int retval = -EINVAL;
        struct dst_state *state = fe->demodulator_priv;

-       state->tone = tone;
        if (state->dst_type != DST_TYPE_IS_SAT)
                return -EOPNOTSUPP;

        switch (tone) {
        case SEC_TONE_OFF:
-               if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
-                   state->tx_tuna[2] = 0x00;
-               else
-                   state->tx_tuna[2] = 0xff;
-               break;
-
        case SEC_TONE_ON:
-               state->tx_tuna[2] = 0x02;
-               break;
-       default:
-               return -EINVAL;
-       }
-       return dst_tone_power_cmd(state);
+               state->tone = tone;
+               retval = dst_tone_power_cmd(state);
+               if (retval != 0)
+                       state->tone = -1;
+               break;
+       }
+       return retval;
 }

static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd)
 {
+       int retval = -EINVAL;
        struct dst_state *state = fe->demodulator_priv;

        if (state->dst_type != DST_TYPE_IS_SAT)
                return -EOPNOTSUPP;
-       state->minicmd = minicmd;
+
        switch (minicmd) {
        case SEC_MINI_A:
-               state->tx_tuna[3] = 0x02;
-               break;
        case SEC_MINI_B:
-               state->tx_tuna[3] = 0xff;
-               break;
-       }
-       return dst_tone_power_cmd(state);
+               state->minicmd = minicmd;
+               retval = dst_tone_power_cmd(state);
+               break;
+       }
+       return retval;
 }


@@ -1565,8 +1585,9 @@ static int dst_init(struct dvb_frontend
static u8 atsc_tuner[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };

        state->inversion = INVERSION_OFF;
-       state->voltage = SEC_VOLTAGE_13;
-       state->tone = SEC_TONE_OFF;
+       state->voltage = -1;
+       state->tone = -1;
+       state->minicmd = -1;
        state->diseq_flags = 0;
        state->k22 = 0x02;
        state->bandwidth = BANDWIDTH_7_MHZ;
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Reply via email to