Re: knc-1 dvb-c with cam

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 20 April 2006 18:40, norbert wrote:
> Am Donnerstag, 20. April 2006 18:13 schrieb Andrew de Quincey:
> > On Thursday 20 April 2006 17:07, norbert wrote:
> > > hello,
> > >
> > > i'm still having problems with my KNC 1 DVB-C card using a CAM.
> > >
> > > While using the card without the CAM plugged in I can watch all
> > > unscrambled channels perfectly. But when I plug in my Alphacrypt Light
> > > Cam there is no data coming out of /dev/dvb/adapter0/dvr0 using czap
> > > -r.
> > >
> > > 'modprobe budget-av' without the CAM and using 'czap -r ZDF' has
> > > following output:
> > > status 1f | signal 8a8a | snr f1f1 | ber 00195000 | unc 00000000 |
> > > FE_HAS_LOCK
> > >
> > > and doing 'cat /dev/dvb/adapter0/dvr0 > /tmp/test' will fill the file
> > > with data
> > >
> > > plugging in the CAM and doing 'czap -r ZDF'  again will output nearly
> > > the same, except the ber value is now lower:
> > > status 1f | signal 8a8a | snr f1f1 | ber 00029a90 | unc 00000000 |
> > > FE_HAS_LOCK
> > >
> > > and doing 'cat /dev/dvb/adapter0/dvr0 > /tmp/test'  creates the file
> > > without filling it with any data
> > >
> > > even removing now the CAM doesn't change anything
> > > status 1f | signal 8a8a | snr f1f1 | ber 00029a90 | unc 00000000 |
> > > FE_HAS_LOCK
> > >
> > > but when I doing rmmod budget-av & modprobe budget-av everything works
> > > for the unscrambled channels perfectly
> >
> > I know what this is I think - I have a patch which should fix it.. will
> > sort it out later. Does your card use a tda10021 demod?
>
> Yes, thats right.

Hi, can you try the attached patch please? It should solve the problem...
diff -r 414e69f0d50f linux/drivers/media/dvb/frontends/tda10021.c
--- a/linux/drivers/media/dvb/frontends/tda10021.c	Fri Apr 07 19:10:14 2006 -0300
+++ b/linux/drivers/media/dvb/frontends/tda10021.c	Thu Apr 20 22:32:36 2006 +0100
@@ -89,6 +89,14 @@ static int tda10021_writereg (struct tda
 	msleep(10);
 	return (ret != 1) ? -EREMOTEIO : 0;
 }
+
+int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data)
+{
+	struct tda10021_state* state = fe->demodulator_priv;
+
+	return tda10021_writereg(state, reg, data);
+}
+EXPORT_SYMBOL(tda10021_write_byte);
 
 static u8 tda10021_readreg (struct tda10021_state* state, u8 reg)
 {
diff -r 414e69f0d50f linux/drivers/media/dvb/frontends/tda10021.h
--- a/linux/drivers/media/dvb/frontends/tda10021.h	Fri Apr 07 19:10:14 2006 -0300
+++ b/linux/drivers/media/dvb/frontends/tda10021.h	Thu Apr 20 22:32:36 2006 +0100
@@ -39,4 +39,6 @@ extern struct dvb_frontend* tda10021_att
 extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
 					    struct i2c_adapter* i2c, u8 pwm);
 
+extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data);
+
 #endif // TDA10021_H
diff -r 414e69f0d50f linux/drivers/media/dvb/ttpci/budget-av.c
--- a/linux/drivers/media/dvb/ttpci/budget-av.c	Fri Apr 07 19:10:14 2006 -0300
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c	Thu Apr 20 22:32:36 2006 +0100
@@ -58,6 +58,10 @@ struct budget_av {
 	struct tasklet_struct ciintf_irq_tasklet;
 	int slot_status;
 	struct dvb_ca_en50221 ca;
+
+	int tda10021_poclkp;
+	int tda10021_ts_enabled;
+	int (*tda10021_set_frontend)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
 };
 
 /* GPIO Connections:
@@ -239,6 +243,13 @@ static int ciintf_slot_shutdown(struct d
 
 	ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB);
 	budget_av->slot_status = 0;
+
+	/* set tda10021 back to original clock configuration when cam removed */
+	if (budget_av->tda10021_poclkp) {
+		tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa0);
+		budget_av->tda10021_ts_enabled = 0;
+	}
+
 	return 0;
 }
 
@@ -253,6 +264,13 @@ static int ciintf_slot_ts_enable(struct 
 	dprintk(1, "ciintf_slot_ts_enable: %d\n", budget_av->slot_status);
 
 	ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA);
+
+	/* tda10021 seems to need a different TS clock config when data is routed to the CAM */
+	if (budget_av->tda10021_poclkp) {
+		tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa1);
+		budget_av->tda10021_ts_enabled = 1;
+	}
+
 	return 0;
 }
 
@@ -1012,6 +1030,23 @@ static u8 read_pwm(struct budget_av *bud
 #define SUBID_DVBT_KNC1		0x0030
 #define SUBID_DVBT_CINERGY1200	0x1157
 
+
+static int tda10021_set_frontend(struct dvb_frontend *fe,
+				 struct dvb_frontend_parameters *p)
+{
+	struct budget_av* budget_av = fe->dvb->priv;
+	int result;
+
+	result = budget_av->tda10021_set_frontend(fe, p);
+	if (budget_av->tda10021_ts_enabled) {
+		tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa1);
+	} else {
+		tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa0);
+	}
+
+	return result;
+}
+
 static void frontend_init(struct budget_av *budget_av)
 {
 	struct saa7146_dev * saa = budget_av->budget.dev;
@@ -1063,6 +1098,9 @@ static void frontend_init(struct budget_
 		fe = tda10021_attach(&philips_cu1216_config,
 				     &budget_av->budget.i2c_adap,
 				     read_pwm(budget_av));
+		budget_av->tda10021_poclkp = 1;
+		budget_av->tda10021_set_frontend = fe->ops->set_frontend;
+		fe->ops->set_frontend = tda10021_set_frontend;
 		break;
 
 	case SUBID_DVBT_KNC1:
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux