Skip to contentSkip to conversation

v4l: cx88 update

PATCH In review Gerd Knorr 1 participant 1 message Nov 8, 2004 Media (V4L/DVB)

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 5/6 v4l: cx88 update

This is a cx88 driver update, changes:

* adapt to video-buf changes.
* add support for a new card.
* use the new video-buf-dvb module.

The dvb stuff doesn't build yet as it depends on some cutting-edge code from the linuxtv cvs and is tagged as 'BROKEN' because of that.

The patch also removes all trailing whitespaces. I've a script to remove them from my sources now, that should kill those no-op whitespace changes in my patches after merging this initial cleanup.

---
 drivers/media/video/Kconfig               |   13 
 drivers/media/video/cx88/Makefile         |    4 
 drivers/media/video/cx88/cx88-blackbird.c |   51 +--
 drivers/media/video/cx88/cx88-cards.c     |   32 +-
 drivers/media/video/cx88/cx88-core.c      |   23 -
 drivers/media/video/cx88/cx88-dvb.c       |  343 ++++++++--------------
 drivers/media/video/cx88/cx88-i2c.c       |    6 
 drivers/media/video/cx88/cx88-mpeg.c      |    5 
 drivers/media/video/cx88/cx88-reg.h       |   66 ++--
 drivers/media/video/cx88/cx88-tvaudio.c   |   28 +
 drivers/media/video/cx88/cx88-vbi.c       |   22 -
 drivers/media/video/cx88/cx88-video.c     |  153 +++++----
 drivers/media/video/cx88/cx88.h           |   28 -
 13 files changed, 350 insertions(+), 424 deletions(-)
drivers/media/video/cx88/cx88.h +5 -23
Index: linux-2004-11-05/drivers/media/video/cx88/cx88.h
===================================================================
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88.h,v 1.37 2004/10/12 07:33:22 kraxel Exp $
+ * $Id: cx88.h,v 1.40 2004/11/03 09:04:51 kraxel Exp $
  *
  * v4l2 device driver for cx2388x based TV cards
  *
@@ -26,15 +26,10 @@
 #include <linux/videodev.h>
 #include <linux/kdev_t.h>
 
-#include <dvbdev.h>
-#include <dmxdev.h>
-#include <dvb_demux.h>
-#include <dvb_net.h>
-#include <dvb_frontend.h>
-
-#include <media/video-buf.h>
 #include <media/tuner.h>
 #include <media/audiochip.h>
+#include <media/video-buf.h>
+#include <media/video-buf-dvb.h>
 
 #include "btcx-risc.h"
 #include "cx88-reg.h"
@@ -160,6 +155,7 @@ extern struct sram_channel cx88_sram_cha
 #define CX88_BOARD_HAUPPAUGE_DVB_T1        18
 #define CX88_BOARD_CONEXANT_DVB_T1         19
 #define CX88_BOARD_PROVIDEO_PV259          20
+#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21
 
 enum cx88_itype {
 	CX88_VMUX_COMPOSITE1 = 1,
@@ -351,7 +347,6 @@ struct cx8802_fh {
 };
 
 struct cx8802_suspend_state {
-	u32                        pci_cfg[64 / sizeof(u32)];
 	int                        disabled;
 };
 
@@ -369,11 +364,6 @@ struct cx8802_dev {
 	u32                        ts_packet_size;
 	u32                        ts_packet_count;
 
-	/* error stats */
-	u32                        stopper_count;
-	u32                        error_count;
-	u32                        timeout_count;
-
 	/* other global state info */
 	struct cx8802_suspend_state state;
 
@@ -383,15 +373,7 @@ struct cx8802_dev {
 	u32                        mailbox;
 
 	/* for dvb only */
-	struct dvb_adapter         *dvb_adapter;
-	struct videobuf_queue      dvbq;
-	struct task_struct         *dvb_thread;
-	struct dvb_demux           demux;
-	struct dmxdev              dmxdev;
-	struct dmx_frontend        fe_hw;
-	struct dmx_frontend        fe_mem;
-	struct dvb_net             dvbnet;
-	int                        nfeeds;
+	struct videobuf_dvb        dvb;
 	void*                      fe_handle;
 	int                        (*fe_release)(void *handle);
 };
drivers/media/video/cx88/cx88-reg.h +33 -33

113 lines not on this page · raw message

drivers/media/video/cx88/cx88-cards.c +25 -7
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-cards.c
===================================================================
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-cards.c,v 1.44 2004/10/12 07:33:22 kraxel Exp $
+ * $Id: cx88-cards.c,v 1.47 2004/11/03 09:04:50 kraxel Exp $
  *
  * device driver for Conexant 2388x based TV cards
  * card-specific stuff.
@@ -336,11 +336,11 @@ struct cx88_board cx88_boards[] = {
 		.tuner_type     = TUNER_ABSENT, /* No analog tuner */
 		.input          = {{
 			.type   = CX88_VMUX_COMPOSITE1,
-			.vmux   = 0,
+			.vmux   = 1,
 			.gpio0  = 0x000027df,
 		 },{
 			.type   = CX88_VMUX_SVIDEO,
-			.vmux   = 1,
+			.vmux   = 2,
 			.gpio0  = 0x000027df,
 		}},
 		.dvb            = 1,
@@ -438,6 +438,20 @@ struct cx88_board cx88_boards[] = {
 		}},
 		.blackbird = 1,
 	},
+	[CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
+		.name           = "DVICO FusionHDTV DVB-T Plus",
+		.tuner_type     = TUNER_ABSENT, /* No analog tuner */
+		.input          = {{
+			.type   = CX88_VMUX_COMPOSITE1,
+			.vmux   = 1,
+			.gpio0  = 0x000027df,
+		 },{
+			.type   = CX88_VMUX_SVIDEO,
+			.vmux   = 2,
+			.gpio0  = 0x000027df,
+		}},
+		.dvb            = 1,
+	},
 };
 const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
 
@@ -525,6 +539,10 @@ struct cx88_subid cx88_subids[] = {
 		.subvendor = 0x1540,
 		.subdevice = 0x2580,
 		.card      = CX88_BOARD_PROVIDEO_PV259,
+	},{
+		.subvendor = 0x18AC,
+		.subdevice = 0xDB10,
+		.card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
 	}
 };
 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
@@ -612,7 +630,7 @@ static struct {
 	{ TUNER_ABSENT,        "Philips TD1536D_FH_44"},
 	{ TUNER_LG_NTSC_FM,    "LG TPI8NSR01F"},
 	{ TUNER_LG_PAL_FM,     "LG TPI8PSB01D"},
-	{ TUNER_LG_PAL,        "LG TPI8PSB11D"},	
+	{ TUNER_LG_PAL,        "LG TPI8PSB11D"},
 	{ TUNER_LG_PAL_I_FM,   "LG TAPC-I001D"},
 	{ TUNER_LG_PAL_I,      "LG TAPC-I701D"}
 };
@@ -634,12 +652,12 @@ static void hauppauge_eeprom(struct cx88
 	model = eeprom_data[12] << 8 | eeprom_data[11];
 	tuner = eeprom_data[9];
 	radio = eeprom_data[blk2-1] & 0x01;
-	
+
         if (tuner < ARRAY_SIZE(hauppauge_tuner))
                 core->tuner_type = hauppauge_tuner[tuner].id;
 	if (radio)
 		core->has_radio = 1;
-	
+
 	printk(KERN_INFO "%s: hauppauge eeprom: model=%d, "
 	       "tuner=%s (%d), radio=%s\n",
 	       core->name, model, (tuner < ARRAY_SIZE(hauppauge_tuner)
@@ -804,7 +822,7 @@ void cx88_card_list(struct cx88_core *co
 void cx88_card_setup(struct cx88_core *core)
 {
 	static u8 eeprom[128];
-		
+
 	switch (core->board) {
 	case CX88_BOARD_HAUPPAUGE:
 		if (0 == core->i2c_rc)
drivers/media/video/cx88/cx88-core.c +11 -12
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-core.c
===================================================================
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-core.c,v 1.13 2004/10/12 07:33:22 kraxel Exp $
+ * $Id: cx88-core.c,v 1.15 2004/10/25 11:26:36 kraxel Exp $
  *
  * device driver for Conexant 2388x based TV cards
  * driver core
@@ -50,13 +50,12 @@ module_param(latency,int,0444);
 MODULE_PARM_DESC(latency,"pci latency timer");
 
 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
-static int tuner_num;
-module_param_array(tuner,int,&tuner_num,0444);
-MODULE_PARM_DESC(tuner,"tuner type");
+static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
+
+module_param_array(tuner, int, NULL, 0444);
+module_param_array(card,  int, NULL, 0444);
 
-static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
-static int card_num;
-module_param_array(card,int,&card_num,0444);
+MODULE_PARM_DESC(tuner,"tuner type");
 MODULE_PARM_DESC(card,"card type");
 
 static unsigned int nicam = 0;
@@ -137,7 +136,7 @@ static u32* cx88_risc_field(u32 *rp, str
 	/* sync instruction */
 	if (sync_line != NO_SYNC_LINE)
 		*(rp++) = cpu_to_le32(RISC_RESYNC | sync_line);
-	
+
 	/* scan lines */
 	sg = sglist;
 	for (line = 0; line < lines; line++) {
@@ -291,7 +290,7 @@ cx88_free_buffer(struct pci_dev *pci, st
  *
  * Every channel has 160 bytes control data (64 bytes instruction
  * queue and 6 CDT entries), which is close to 2k total.
- * 
+ *
  * Address layout:
  *    0x0000 - 0x03ff    CMDs / reserved
  *    0x0400 - 0x0bff    instruction queues + CDs
@@ -467,7 +466,7 @@ void cx88_risc_disasm(struct cx88_core *
 		      struct btcx_riscmem *risc)
 {
 	unsigned int i,j,n;
-	
+
 	printk("%s: risc disasm: %p [dma=0x%08lx]\n",
 	       core->name, risc->cpu, (unsigned long)risc->dma);
 	for (i = 0; i < (risc->size >> 2); i += n) {
@@ -537,13 +536,13 @@ void cx88_sram_channel_dump(struct cx88_
 }
 
 char *cx88_pci_irqs[32] = {
-	"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", 
+	"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
 	"src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
 	"brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
 	"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
 };
 char *cx88_vid_irqs[32] = {
-	"y_risci1", "u_risci1", "v_risci1", "vbi_risc1", 
+	"y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
 	"y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
 	"y_oflow",  "u_oflow",  "v_oflow",  "vbi_oflow",
 	"y_sync",   "u_sync",   "v_sync",   "vbi_sync",
drivers/media/video/cx88/cx88-i2c.c +3 -3
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-i2c.c
===================================================================
@@ -1,5 +1,5 @@
 /*
-    $Id: cx88-i2c.c,v 1.17 2004/10/11 13:45:51 kraxel Exp $
+    $Id: cx88-i2c.c,v 1.18 2004/10/13 10:39:00 kraxel Exp $
 
     cx88-i2c.c  --  all the i2c code is here
 
@@ -21,7 +21,7 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    
+
 */
 
 #include <linux/module.h>
@@ -72,7 +72,7 @@ static int cx8800_bit_getscl(void *data)
 {
 	struct cx88_core *core = data;
 	u32 state;
-	
+
 	state = cx_read(MO_I2C);
 	return state & 0x02 ? 1 : 0;
 }
drivers/media/video/cx88/cx88-tvaudio.c +18 -10
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-tvaudio.c
===================================================================
@@ -1,5 +1,5 @@
 /*
-    $Id: cx88-tvaudio.c,v 1.22 2004/10/11 13:45:51 kraxel Exp $
+    $Id: cx88-tvaudio.c,v 1.24 2004/10/25 11:51:00 kraxel Exp $
 
     cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
 
@@ -18,9 +18,9 @@
 
     Some comes from the dscaler sources, one of the dscaler driver guy works
     for Conexant ...
-    
+
     -----------------------------------------------------------------------
-    
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
@@ -553,6 +553,13 @@ static void set_audio_standard_A2(struct
 	set_audio_start(core, 0x0004, EN_DMTRX_SUMDIFF | EN_A2_AUTO_STEREO);
 	set_audio_registers(core, a2_common);
 	switch (core->tvaudio) {
+	case WW_NICAM_I:
+		/* gives at least mono according to the dscaler guys */
+		/* so use use that while nicam is broken ...         */
+		dprintk("%s PAL-I mono (status: unknown)\n",__FUNCTION__);
+		set_audio_registers(core, a2_table1);
+		cx_write(AUD_CTL, EN_A2_FORCE_MONO1);
+		break;
 	case WW_A2_BG:
 		dprintk("%s PAL-BG A2 (status: known-good)\n",__FUNCTION__);
 		set_audio_registers(core, a2_table1);
@@ -601,7 +608,7 @@ static void set_audio_standard_FM(struct
 			cx_write(AUD_DEEMPH1_B0, 0x1C29);
 			cx_write(AUD_DEEMPH1_A1, 0x3FC66);
 			cx_write(AUD_DEEMPH1_B1, 0x399A);
-			
+
 			break;
 
 		case WW_FM_DEEMPH_75:
@@ -639,10 +646,11 @@ void cx88_set_tvaudio(struct cx88_core *
 	case WW_BTSC:
 		set_audio_standard_BTSC(core,0);
 		break;
-	case WW_NICAM_I:
+	// case WW_NICAM_I:
 	case WW_NICAM_BGDKL:
 		set_audio_standard_NICAM(core);
 		break;
+	case WW_NICAM_I:
 	case WW_A2_BG:
 	case WW_A2_DK:
 	case WW_A2_M:
@@ -750,7 +758,7 @@ void cx88_set_stereo(struct cx88_core *c
 	case WW_A2_DK:
 	case WW_A2_M:
 		switch (mode) {
-		case V4L2_TUNER_MODE_MONO:   
+		case V4L2_TUNER_MODE_MONO:
 		case V4L2_TUNER_MODE_LANG1:
 			ctl  = EN_A2_FORCE_MONO1;
 			mask = 0x3f;
@@ -767,7 +775,7 @@ void cx88_set_stereo(struct cx88_core *c
 		break;
 	case WW_NICAM_BGDKL:
 		switch (mode) {
-		case V4L2_TUNER_MODE_MONO:   
+		case V4L2_TUNER_MODE_MONO:
 			ctl  = EN_NICAM_FORCE_MONO1;
 			mask = 0x3f;
 			break;
@@ -780,10 +788,10 @@ void cx88_set_stereo(struct cx88_core *c
 			mask = 0x93f;
 			break;
 		}
-		break;	
+		break;
 	case WW_FM:
 		switch (mode) {
-		case V4L2_TUNER_MODE_MONO:   
+		case V4L2_TUNER_MODE_MONO:
 			ctl  = EN_FMRADIO_FORCE_MONO;
 			mask = 0x3f;
 			break;
@@ -792,7 +800,7 @@ void cx88_set_stereo(struct cx88_core *c
 			mask = 0x3f;
 			break;
 		}
-		break;	
+		break;
 	}
 
 	if (UNSET != ctl) {
drivers/media/video/cx88/cx88-video.c +81 -72

430 lines not on this page · raw message

drivers/media/video/cx88/cx88-vbi.c +11 -11
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-vbi.c
===================================================================
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-vbi.c,v 1.12 2004/10/11 13:45:51 kraxel Exp $
+ * $Id: cx88-vbi.c,v 1.14 2004/11/07 13:17:15 kraxel Exp $
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -143,7 +143,7 @@ void cx8800_vbi_timeout(unsigned long da
 /* ------------------------------------------------------------------ */
 
 static int
-vbi_setup(void *priv, unsigned int *count, unsigned int *size)
+vbi_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
 {
 	*size = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
 	if (0 == *count)
@@ -156,12 +156,12 @@ vbi_setup(void *priv, unsigned int *coun
 }
 
 static int
-vbi_prepare(void *priv, struct videobuf_buffer *vb,
+vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
 	    enum v4l2_field field)
 {
-	struct cx8800_fh   *fh  = priv;
+	struct cx8800_fh   *fh  = q->priv_data;
 	struct cx8800_dev  *dev = fh->dev;
-	struct cx88_buffer *buf = (struct cx88_buffer*)vb;
+	struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
 	unsigned int size;
 	int rc;
 
@@ -192,11 +192,11 @@ vbi_prepare(void *priv, struct videobuf_
 }
 
 static void
-vbi_queue(void *priv, struct videobuf_buffer *vb)
+vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
 {
-	struct cx88_buffer    *buf  = (struct cx88_buffer*)vb;
+	struct cx88_buffer    *buf = container_of(vb,struct cx88_buffer,vb);
 	struct cx88_buffer    *prev;
-	struct cx8800_fh      *fh   = priv;
+	struct cx8800_fh      *fh   = vq->priv_data;
 	struct cx8800_dev     *dev  = fh->dev;
 	struct cx88_dmaqueue  *q    = &dev->vbiq;
 
@@ -224,10 +224,10 @@ vbi_queue(void *priv, struct videobuf_bu
 	}
 }
 
-static void vbi_release(void *priv, struct videobuf_buffer *vb)
+static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
 {
-	struct cx88_buffer *buf = (struct cx88_buffer*)vb;
-	struct cx8800_fh   *fh  = priv;
+	struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
+	struct cx8800_fh   *fh  = q->priv_data;
 
 	cx88_free_buffer(fh->dev->pci,buf);
 }
drivers/media/video/cx88/cx88-mpeg.c +1 -4
Index: linux-2004-11-05/drivers/media/video/cx88/cx88-mpeg.c
===================================================================
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-mpeg.c,v 1.11 2004/10/12 07:33:22 kraxel Exp $
+ * $Id: cx88-mpeg.c,v 1.14 2004/10/25 11:26:36 kraxel Exp $
  *
  *  Support for the mpeg transport stream transfers
  *  PCI function #2 of the cx2388x.
@@ -239,7 +239,6 @@ static void cx8802_timeout(unsigned long
 	if (debug)
 		cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
 	cx8802_stop_dma(dev);
-	dev->timeout_count++;
 	do_cancel_buffers(dev,"timeout",1);
 }
 
@@ -276,7 +275,6 @@ static void cx8802_mpeg_irq(struct cx880
 	/* risc2 y */
 	if (status & 0x10) {
 		spin_lock(&dev->slock);
-		dev->stopper_count++;
 		cx8802_restart_queue(dev,&dev->mpegq);
 		spin_unlock(&dev->slock);
 	}
@@ -284,7 +282,6 @@ static void cx8802_mpeg_irq(struct cx880
         /* other general errors */
         if (status & 0x1f0100) {
                 spin_lock(&dev->slock);
-		dev->error_count++;
 		cx8802_stop_dma(dev);
                 cx8802_restart_queue(dev,&dev->mpegq);
                 spin_unlock(&dev->slock);
drivers/media/video/cx88/cx88-dvb.c +127 -216

434 lines not on this page · raw message

drivers/media/video/cx88/cx88-blackbird.c +25 -26

133 lines not on this page · raw message

drivers/media/video/Kconfig +7 -6
Index: linux-2004-11-05/drivers/media/video/Kconfig
===================================================================
@@ -315,12 +315,13 @@ config VIDEO_CX88
 	  To compile this driver as a module, choose M here: the
 	  module will be called cx8800
 
-#config VIDEO_CX88_DVB
-#	tristate "DVB Support for cx2388x based TV cards"
-#	depends on VIDEO_CX88 && DVB_CORE
-#	---help---
-#	  This adds support for DVB cards based on the
-#	  Connexant 2388x chip.
+config VIDEO_CX88_DVB
+	tristate "DVB Support for cx2388x based TV cards"
+	depends on VIDEO_CX88 && DVB_CORE && BROKEN
+	select VIDEO_BUF_DVB
+	---help---
+	  This adds support for DVB cards based on the
+	  Connexant 2388x chip.
 
 config VIDEO_OVCAMCHIP
 	tristate "OmniVision Camera Chip support"
drivers/media/video/cx88/Makefile +3 -1
Index: linux-2004-11-05/drivers/media/video/cx88/Makefile
===================================================================
@@ -5,4 +5,6 @@ cx8802-objs	:= cx88-mpeg.o
 obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o
 obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
 
-EXTRA_CFLAGS = -I$(src)/.. -I$(srctree)/drivers/media/dvb/dvb-core
+EXTRA_CFLAGS += -I$(src)/..
+EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
+EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)