Skip to contentSkip to conversation

S2API: add multifrontend

PATCH New Hans Werner 1 participant 1 message Sep 11, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 S2API: add multifrontend

Steve,

here is a patch which adds multifrontend to S2API (rev ffa9a0c644b3). It's based on the earlier patches by you and the mfe patches at Darron's website. Those patches are quite old so I had to do a lot by hand without automatic patching -- so please check it carefully.

Notes: somewhere along the line in the past
(a) videobuf-dvb.h: struct dvb_adapter *adapter; in videobuf_dvb changed to struct dvb_adapter adapter;
(b) videobuf-dvb.h: videobuf_dvb_register gained an extra parameter short *adapter_nr.

I tested it with the HVR4000. Seems OK so far.

/dev/dvb/adapter0/frontend0: DVB-S/S2 (tested OK with new API, S,S2QPSK,S28PSK) /dev/dvb/adapter0/frontend1: DVB-T (tested OK with old API)

The DVB-T part of the HVR4000 (cx22702) still needs additions so that it picks up and uses the new API property cache (not hard as you know).

I see you are progressing rapidly (great!) so I thought I had better send this before it's out of date.

You know this subject better than I, so I'll leave it up to you how to prioritise this, but the recent messages in the ML indicate there is quite a lot of interest in multifrontend.

Regards,
Hans

Signature · 2 lines
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
linux/drivers/media/dvb/dvb-core/dvb_frontend.c +13 -11
diff -r ffa9a0c644b3 linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -216,8 +216,9 @@ static int dvb_frontend_get_event(struct
 
 static void dvb_frontend_init(struct dvb_frontend *fe)
 {
-	dprintk ("DVB: initialising frontend %i (%s)...\n",
+	dprintk ("DVB: initialising adapter %i frontend %i (%s)...\n",
 		 fe->dvb->num,
+		 fe->id,
 		 fe->ops.info.name);
 
 	if (fe->ops.init)
@@ -696,7 +697,7 @@ static int dvb_frontend_start(struct dvb
 	mb();
 
 	fe_thread = kthread_run(dvb_frontend_thread, fe,
-		"kdvb-fe-%i", fe->dvb->num);
+		"kdvb-ad-%i-fe-%i", fe->dvb->num,fe->id);
 	if (IS_ERR(fe_thread)) {
 		ret = PTR_ERR(fe_thread);
 		printk("dvb_frontend_start: failed to start kthread (%d)\n", ret);
@@ -720,8 +721,8 @@ static void dvb_frontend_get_frequeny_li
 		*freq_max = min(fe->ops.info.frequency_max, fe->ops.tuner_ops.info.frequency_max);
 
 	if (*freq_min == 0 || *freq_max == 0)
-		printk(KERN_WARNING "DVB: frontend %u frequency limits undefined - fix the driver\n",
-		       fe->dvb->num);
+		printk(KERN_WARNING "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
+		       fe->dvb->num,fe->id);
 }
 
 static int dvb_frontend_check_parameters(struct dvb_frontend *fe,
@@ -734,8 +735,8 @@ static int dvb_frontend_check_parameters
 	dvb_frontend_get_frequeny_limits(fe, &freq_min, &freq_max);
 	if ((freq_min && parms->frequency < freq_min) ||
 	    (freq_max && parms->frequency > freq_max)) {
-		printk(KERN_WARNING "DVB: frontend %u frequency %u out of range (%u..%u)\n",
-		       fe->dvb->num, parms->frequency, freq_min, freq_max);
+		printk(KERN_WARNING "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
+		       fe->dvb->num, fe->id, parms->frequency, freq_min, freq_max);
 		return -EINVAL;
 	}
 
@@ -745,8 +746,8 @@ static int dvb_frontend_check_parameters
 		     parms->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min) ||
 		    (fe->ops.info.symbol_rate_max &&
 		     parms->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max)) {
-			printk(KERN_WARNING "DVB: frontend %u symbol rate %u out of range (%u..%u)\n",
-			       fe->dvb->num, parms->u.qpsk.symbol_rate,
+			printk(KERN_WARNING "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
+			       fe->dvb->num, fe->id, parms->u.qpsk.symbol_rate,
 			       fe->ops.info.symbol_rate_min, fe->ops.info.symbol_rate_max);
 			return -EINVAL;
 		}
@@ -756,8 +757,8 @@ static int dvb_frontend_check_parameters
 		     parms->u.qam.symbol_rate < fe->ops.info.symbol_rate_min) ||
 		    (fe->ops.info.symbol_rate_max &&
 		     parms->u.qam.symbol_rate > fe->ops.info.symbol_rate_max)) {
-			printk(KERN_WARNING "DVB: frontend %u symbol rate %u out of range (%u..%u)\n",
-			       fe->dvb->num, parms->u.qam.symbol_rate,
+			printk(KERN_WARNING "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
+			       fe->dvb->num, fe->id, parms->u.qam.symbol_rate,
 			       fe->ops.info.symbol_rate_min, fe->ops.info.symbol_rate_max);
 			return -EINVAL;
 		}
@@ -1775,8 +1776,9 @@ int dvb_register_frontend(struct dvb_ada
 	fe->dvb = dvb;
 	fepriv->inversion = INVERSION_OFF;
 
-	printk ("DVB: registering frontend %i (%s)...\n",
+	printk ("DVB: registering adapter %i frontend %i (%s)...\n",
 		fe->dvb->num,
+		fe->id,
 		fe->ops.info.name);
 
 	dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
linux/drivers/media/dvb/dvb-core/dvb_frontend.h +1 -0
diff -r ffa9a0c644b3 linux/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -234,6 +234,7 @@ struct dvb_frontend {
 	void *sec_priv;
 	void *analog_demod_priv;
 	struct tv_frontend_properties tv_property_cache;
+	int id;
 };
 
 extern int dvb_register_frontend(struct dvb_adapter *dvb,
linux/drivers/media/video/cx23885/cx23885-dvb.c +69 -54

307 lines not on this page · raw message

linux/drivers/media/video/cx23885/cx23885.h +1 -1
diff -r ffa9a0c644b3 linux/drivers/media/video/cx23885/cx23885.h
@@ -226,7 +226,7 @@ struct cx23885_tsport {
 	int                        nr;
 	int                        sram_chno;
 
-	struct videobuf_dvb        dvb;
+	struct videobuf_dvb_frontends frontends;
 
 	/* dma queues */
 	struct cx23885_dmaqueue    mpegq;
linux/drivers/media/video/cx88/Kconfig +1 -0
diff -r ffa9a0c644b3 linux/drivers/media/video/cx88/Kconfig
@@ -58,6 +58,7 @@ config VIDEO_CX88_DVB
 	select DVB_ISL6421 if !DVB_FE_CUSTOMISE
 	select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
 	select DVB_S5H1411 if !DVB_FE_CUSTOMISE
+	select DVB_CX24116 if !DVB_FE_CUSTOMISE
 	---help---
 	  This adds support for DVB/ATSC cards based on the
 	  Conexant 2388x chip.
linux/drivers/media/video/cx88/cx88-cards.c +36 -4
diff -r ffa9a0c644b3 linux/drivers/media/video/cx88/cx88-cards.c
@@ -1324,6 +1324,7 @@ static const struct cx88_board cx88_boar
 			.gpio0  = 0x84bf,
 		}},
 		.mpeg           = CX88_MPEG_DVB,
+		.num_frontends	= 2,
 	},
 	[CX88_BOARD_NORWOOD_MICRO] = {
 		.name           = "Norwood Micro TV Tuner",
@@ -1717,6 +1718,26 @@ static const struct cx88_board cx88_boar
 		 * S-Video      0xc4bf  0xc4bb
 		 * Composite1   0xc4ff  0xc4fb
 		 * S-Video1     0xc4ff  0xc4fb
+		 *
+		 * BIT  VALUE	FUNCTION GP{x}_IO
+		 * 0	1	I:?
+		 * 1	1	I:?
+		 * 2	1	O:DVB-T DEMOD ENABLE LOW/ANALOG DEMOD ENABLE HIGH
+		 * 3	1	I:?
+		 * 4	1	I:?
+		 * 5	1	I:?
+		 * 6	0	O:INPUT SELECTOR 0=INTERNAL 1=EXPANSION
+		 * 7	1	O:DVB-T DEMOD RESET LOW
+		 *
+		 * BIT  VALUE	FUNCTION GP{x}_OE
+		 * 8	0	I
+		 * 9	0	I
+		 * a	1	O
+		 * b	0	I
+		 * c	0	I
+		 * d	0	I
+		 * e	1	O
+		 * f	1	O
 		 */
 		.input          = {{
 			.type   = CX88_VMUX_TELEVISION,
@@ -1733,6 +1754,7 @@ static const struct cx88_board cx88_boar
 		} },
 		/* fixme: Add radio support */
 		.mpeg           = CX88_MPEG_DVB,
+		.num_frontends	= 2,
 	},
 	[CX88_BOARD_HAUPPAUGE_HVR4000LITE] = {
 		.name           = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2",
@@ -2543,8 +2565,13 @@ static void cx88_card_setup_pre_i2c(stru
 	case CX88_BOARD_HAUPPAUGE_HVR4000:
 	case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
 		/* Init GPIO to allow tuner to attach */
-		cx_write(MO_GP0_IO, 0x0000c4bf);
-		udelay(1000);
+		//cx_write(MO_GP0_IO, 0x0000c4bf);
+		//udelay(1000);
+
+		//from MFE
+		/* Init GPIO for DVB-S/S2/Analog */
+		cx_write(MO_GP0_IO, core->board.input[0].gpio0);
+		break;
 	}
 }
 
@@ -2871,12 +2898,17 @@ struct cx88_core *cx88_core_create(struc
 		cx88_card_list(core, pci);
 	}
 
+	memset(&core->board, 0, sizeof(core->board));
 	memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
 
-	info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
+	if (!core->board.num_frontends)
+		core->board.num_frontends=1;
+
+	info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
 		pci->subsystem_vendor, pci->subsystem_device, core->board.name,
 		core->boardnr, card[core->nr] == core->boardnr ?
-		"insmod option" : "autodetected");
+		"insmod option" : "autodetected",
+		core->board.num_frontends);
 
 	if (tuner[core->nr] != UNSET)
 		core->board.tuner_type = tuner[core->nr];
linux/drivers/media/video/cx88/cx88-dvb.c +330 -112

772 lines not on this page · raw message

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb