Hi Manu,
I attached a minimal patch against mantis.tar.bz2.
It contains changes into cu1216.c.
Those changes enable dvb_core.c heuristics
so that both inversion=0 and inversion=1 work.
I didn't have to insert the get_tune_settings() function
that informs dvb_core.c about the 50ms delay.
cu1216.c works for me without that now.
I didn't have to fix the negative return value issue either:
no function seems to check the return value
of cu1216_set_parameters() anymore.
File cu1216_no_inversion_heuristics.patch
contains changes without fixing indentation.
File cu1216_no_inversion_heuristics_final.patch
contains same changes, but with fixing the indentation.
Without the patch, cu1216.c is stuck with inversion=0 :
it never tries inversion=1.
With me the fixed version works nicely:
Initially dvb_core.c tries with automatic mode inversion=0.
That fails for me and then dvb_core.c tries inversion=1.
That's successful for me.
When I switch into another frequency, dvb_core.c tries first inversion=1.
Thus it remembered the previous successfull inversion.
Thus I'd like to have Kaffeine inform dvb_core.c about using inversion=1
first.
That way I would save over two seconds for the first channel.
Regards,
Marko
Manu Abraham kirjoitti:
On 2/22/07, Marko Ristola <marko.ristola@xxxxxxxxxxx> wrote:
Manu Abraham wrote:
...
> Can you check whether this one exists in there ? I do remember pulling
> in a 50mS delay for the CU1216 after your comment, but the others i
> would appreciate if you can take a look as to whether it needs
> changes.
>
Unfortunately cu1216.c doesn't yet have a get_tune_settings() function.
I noticed, that the function has been implemented on many other
dvb/frontend/?.c files though.
I noticed that li_oldIq and li_Iq heuristics is still in cu1216.c.
It didn't work for me. My fix was to remove the inversion heuristics
completely from cu1216_set_parameters().
Instead it used the value from fepriv->inversion.
Ok.
That's the way to use dvb_core.c's own inversion heuristics.
The "set gain" heuristics works mostly in cu1216_set_parameters().
I moved uc_Gain and uc_oldGain as local parameters for
cu1216_set_parameters().
I think that global parameters aren't needed for them.
Ok
Thanks.
Manu
Index: mantis/linux/drivers/media/dvb/frontends/cu1216.c
===================================================================
RCS file: /var/cvs/mantis/linux/drivers/media/dvb/frontends/cu1216.c,v
retrieving revision 1.7.2.4.2.2
diff -u -p -r1.7.2.4.2.2 cu1216.c
--- mantis/linux/drivers/media/dvb/frontends/cu1216.c 24 Feb 2007 10:38:45 -0000 1.7.2.4.2.2
+++ mantis/linux/drivers/media/dvb/frontends/cu1216.c 24 Feb 2007 17:48:34 -0000
@@ -67,7 +67,6 @@ typedef struct AC_TypeQAM_TAG {
static u32 AC_uSysClk;
-static u8 li_Iq, li_oldIq = 0, uc_Gain, uc_oldGain = 0;
static void cu1216_set_symbolRate(struct dvb_frontend *fe, u16 uFreqSymb);
static void cu1216_set_QAM(struct dvb_frontend *fe, u8 bQAM);
@@ -799,16 +798,16 @@ static int cu1216_set_parameters(struct
{
struct cu1216_state *state = fe->demodulator_priv;
- u8 i;
u8 QamSize = 0;
+ u8 li_Iq, uc_Gain, uc_oldGain;
u32 ErrRate[3];
fe_status_t value;
int status = -EINVAL;
- printk("[%s]:frequency = %d , symbol = %d , qam = %d .\n",
+ printk("[%s]:frequency = %d , symbol = %d , qam = %d, inversion = %d .\n",
__func__,
params->frequency , params->u.qam.symbol_rate,
- params->u.qam.modulation);
+ params->u.qam.modulation, params->inversion );
switch (params->u.qam.modulation) {
case QPSK :
@@ -834,9 +833,6 @@ static int cu1216_set_parameters(struct
break;
}
- if (li_oldIq >= 2)
- li_oldIq = 0;
-
// cu1216_reset(fe);
// FIXME ! need to do a Bridge RESET from here
// state->config->fe_reset(fe);
@@ -861,8 +857,7 @@ static int cu1216_set_parameters(struct
//Write QAM
cu1216_set_QAM(fe, QamSize);
- for (i = li_oldIq; i < li_oldIq + 2; i++) {
- li_Iq = i % 2;
+ li_Iq = (params->inversion == INVERSION_ON)? 1:0;
for (uc_Gain = 1; uc_Gain < 4; uc_Gain++) {
cu1216_set_IQ(fe, li_Iq);
@@ -874,7 +869,6 @@ static int cu1216_set_parameters(struct
if (cu1216_read_status(fe, &value) == 0) {
- li_oldIq = li_Iq;
uc_oldGain = uc_Gain;
ErrRate[0] = cu1216_read_errRate(fe);
@@ -913,7 +907,6 @@ static int cu1216_set_parameters(struct
}
goto ret;
}
- }
}
status = -1;
Index: linux/drivers/media/dvb/frontends/cu1216.c
===================================================================
RCS file: /var/cvs/mantis/linux/drivers/media/dvb/frontends/cu1216.c,v
retrieving revision 1.7.2.4.2.3
diff -u -p -r1.7.2.4.2.3 cu1216.c
--- linux/drivers/media/dvb/frontends/cu1216.c 24 Feb 2007 17:53:50 -0000 1.7.2.4.2.3
+++ linux/drivers/media/dvb/frontends/cu1216.c 24 Feb 2007 18:34:36 -0000
@@ -859,54 +859,54 @@ static int cu1216_set_parameters(struct
li_Iq = (params->inversion == INVERSION_ON)? 1:0;
- for (uc_Gain = 1; uc_Gain < 4; uc_Gain++) {
- cu1216_set_IQ(fe, li_Iq);
+ for (uc_Gain = 1; uc_Gain < 4; uc_Gain++) {
+ cu1216_set_IQ(fe, li_Iq);
- cu1216_set_gain(fe, uc_Gain);
+ cu1216_set_gain(fe, uc_Gain);
- //udelay(50);
- delay_us_interruptible(5);
+ //udelay(50);
+ delay_us_interruptible(5);
- if (cu1216_read_status(fe, &value) == 0) {
+ if (cu1216_read_status(fe, &value) == 0) {
- uc_oldGain = uc_Gain;
- ErrRate[0] = cu1216_read_errRate(fe);
+ uc_oldGain = uc_Gain;
+ ErrRate[0] = cu1216_read_errRate(fe);
- if (uc_Gain < 3) {
- cu1216_set_gain(fe, uc_Gain+1);
+ if (uc_Gain < 3) {
+ cu1216_set_gain(fe, uc_Gain+1);
+ //udelay(50);
+ delay_us_interruptible(5);
+ ErrRate[1] = cu1216_read_errRate(fe);
+
+ if (ErrRate[0] > ErrRate[1]) {
+ cu1216_set_gain(fe , uc_Gain);
//udelay(50);
delay_us_interruptible(5);
- ErrRate[1] = cu1216_read_errRate(fe);
- if (ErrRate[0] > ErrRate[1]) {
- cu1216_set_gain(fe , uc_Gain);
+ } else {
+ uc_oldGain = uc_Gain + 1;
+ uc_Gain = uc_Gain + 1;
+
+ if (uc_Gain < 3) {
+ cu1216_set_gain(fe, uc_Gain + 1);
+
//udelay(50);
delay_us_interruptible(5);
+ ErrRate[2] = cu1216_read_errRate(fe);
- } else {
- uc_oldGain = uc_Gain + 1;
- uc_Gain = uc_Gain + 1;
-
- if (uc_Gain < 3) {
- cu1216_set_gain(fe, uc_Gain + 1);
+ if (ErrRate[1] > ErrRate[2]) {
+ cu1216_set_gain(fe , uc_oldGain);
//udelay(50);
delay_us_interruptible(5);
- ErrRate[2] = cu1216_read_errRate(fe);
-
- if (ErrRate[1] > ErrRate[2]) {
- cu1216_set_gain(fe , uc_oldGain);
-
- //udelay(50);
- delay_us_interruptible(5);
- } else {
- uc_oldGain = uc_Gain + 1;
- }
+ } else {
+ uc_oldGain = uc_Gain + 1;
}
}
}
- goto ret;
}
+ goto ret;
+ }
}
status = -1;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb