Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e52e98a7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds
Browse files

[PATCH] v4l: CX88 updates and card additions



- Remove $Id CVS logs for V4L files
- add ioctl indirection via cx88_ioctl_hook and cx88_ioctl_translator to
  cx88-blackbird.c.
- declare the indirection hooks from cx88-blackbird.c.
- dcprintk macro which uses core instead of dev->core on cx88-video.c.
- replace dev->core occurances with core on cx88-video.c.
- CodingStyle fixes.
- MaxInput replaced by a define.
- cx8801 structures moved from cx88.h.
- The output_mode needs to be set for the Hauppauge Nova-T DVB-T
  for versions after 2.6.12.
- Corrected GPIO values for cx88 cards #28 & #31 for s-video and composite.
- Updated DViCO FusionHDTV5 Gold & added DVB support.
- Fixed DViCO FusionHDTV 3 Gold-Q GPIO.
- Some clean up in cx88-tvaudio.c
- replaced hex values when writing to AUD_CTL to EN_xx for better reading.
- Allow select by hand between Mono, Lang1, Lang2 and Stereo for BTSC.
- Support for stereo NICAM and BTSC improved.
- Broken stereo check removed.
- Added support for remote control to Cinergy DVBT-1400.
- local var renamed from rc5 to a better name (ircode).
- LGDT330X QAM lock bug fixes.
- Some reorg: move some bits to struct cx88_core, factor out common ioctl's
  to cx88_do_ioctl.
- Get rid of '//' comments, replace them with #if 0 and /**/.
- Minor clean-ups: remove dcprintk and replace all instances of "dev->core"
  with "core".
- Added some registers to control PCI controller at CX2388x chips.
- New tuner standby API.
- Small mpeg fixes and cleanups for blackbird.
- fix mpeg packet size & count
- add VIDIOC_QUERYCAP ioctl for the mpeg stream
- return more information in struct v4l2_format
- fix default window height
- small cleanups

Signed-off-by: default avatarUli Luckas <luckas@musoft.de>
Signed-off-by: default avatarTorsten Seeboth <Torsten.Seeboth@t-online.de>
Signed-off-by: default avatarNickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: default avatarMichael Krufky <mkrufky@m1k.net>
Signed-off-by: default avatarPatrick Boettcher <patrick.boettcher@desy.de>
Signed-off-by: default avatarCatalin Climov <catalin@climov.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 24a70fdc
Loading
Loading
Loading
Loading
+59 −14
Original line number Diff line number Diff line
/*
 * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $
 *
 *  Support for a cx23416 mpeg encoder via cx2388x host port.
 *  "blackbird" reference design.
@@ -62,7 +61,6 @@ static LIST_HEAD(cx8802_devlist);
#define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF

/* Firmware API commands */
/* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */
#define IVTV_API_STD_TIMEOUT 500

#define BLACKBIRD_API_PING               0x80
@@ -696,7 +694,6 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)

	/* assign stream type */
	blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM);
	/* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */

	/* assign output port */
	blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */
@@ -824,7 +821,8 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
			BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

	blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */
	/* initialize the video input */
	blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0);

	msleep(1);

@@ -833,11 +831,12 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
	blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE);
	msleep(1);

	/* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */
	/* start capturing to the host interface */
	/* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); */
	blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0,
			BLACKBIRD_MPEG_CAPTURE,
			BLACKBIRD_RAW_BITS_NONE
		); /* start capturing to the host interface */
		);
	msleep(10);

	blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0);
@@ -851,8 +850,8 @@ static int bb_buf_setup(struct videobuf_queue *q,
{
	struct cx8802_fh *fh = q->priv_data;

	fh->dev->ts_packet_size  = 512;
	fh->dev->ts_packet_count = 100;
	fh->dev->ts_packet_size  = 188 * 4; /* was: 512 */
	fh->dev->ts_packet_count = 32; /* was: 100 */

	*size = fh->dev->ts_packet_size * fh->dev->ts_packet_count;
	if (0 == *count)
@@ -900,12 +899,36 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
{
	struct cx8802_fh  *fh  = file->private_data;
	struct cx8802_dev *dev = fh->dev;
	struct cx88_core  *core = dev->core;

	if (debug > 1)
		cx88_print_ioctl(dev->core->name,cmd);
		cx88_print_ioctl(core->name,cmd);

	switch (cmd) {

	/* --- capabilities ------------------------------------------ */
	case VIDIOC_QUERYCAP:
	{
		struct v4l2_capability *cap = arg;

		memset(cap,0,sizeof(*cap));
		strcpy(cap->driver, "cx88_blackbird");
		strlcpy(cap->card, cx88_boards[core->board].name,sizeof(cap->card));
		sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
		cap->version = CX88_VERSION_CODE;
		cap->capabilities =
			V4L2_CAP_VIDEO_CAPTURE |
			V4L2_CAP_READWRITE     |
			V4L2_CAP_STREAMING     |
			V4L2_CAP_VBI_CAPTURE   |
			V4L2_CAP_VIDEO_OVERLAY |
			0;
		if (UNSET != core->tuner_type)
			cap->capabilities |= V4L2_CAP_TUNER;

		return 0;
	}

	/* --- capture ioctls ---------------------------------------- */
	case VIDIOC_ENUM_FMT:
	{
@@ -935,7 +958,11 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
		f->fmt.pix.width        = dev->width;
		f->fmt.pix.height       = dev->height;
		f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
		f->fmt.pix.sizeimage    = 1024 * 512 /* FIXME: BUFFER_SIZE */;
		f->fmt.pix.field        = V4L2_FIELD_NONE;
		f->fmt.pix.bytesperline = 0;
		f->fmt.pix.sizeimage    = 188 * 4 * 1024; /* 1024 * 512 */ /* FIXME: BUFFER_SIZE */;
		f->fmt.pix.colorspace   = 0;
		return 0;
	}

	/* --- streaming capture ------------------------------------- */
@@ -959,15 +986,25 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
		return videobuf_streamoff(&fh->mpegq);

	default:
		return -EINVAL;
		return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook );
	}
	return 0;
}

int (*cx88_ioctl_hook)(struct inode *inode, struct file *file,
			unsigned int cmd, void *arg);
unsigned int (*cx88_ioctl_translator)(unsigned int cmd);

static unsigned int mpeg_translate_ioctl(unsigned int cmd)
{
	return cmd;
}

static int mpeg_ioctl(struct inode *inode, struct file *file,
			unsigned int cmd, unsigned long arg)
{
	return video_usercopy(inode, file, cmd, arg, mpeg_do_ioctl);
	cmd = cx88_ioctl_translator( cmd );
	return video_usercopy(inode, file, cmd, arg, cx88_ioctl_hook);
}

static int mpeg_open(struct inode *inode, struct file *file)
@@ -1135,7 +1172,7 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
	dev->pci = pci_dev;
	dev->core = core;
	dev->width = 720;
	dev->height = 480;
	dev->height = 576;

	err = cx8802_init_common(dev);
	if (0 != err)
@@ -1148,6 +1185,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,

	list_add_tail(&dev->devlist,&cx8802_devlist);
	blackbird_register_video(dev);

	/* initial device configuration: needed ? */

	return 0;

 fail_free:
@@ -1202,6 +1242,8 @@ static int blackbird_init(void)
	printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n",
	       SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
#endif
	cx88_ioctl_hook = mpeg_do_ioctl;
	cx88_ioctl_translator = mpeg_translate_ioctl;
	return pci_register_driver(&blackbird_pci_driver);
}

@@ -1213,6 +1255,9 @@ static void blackbird_fini(void)
module_init(blackbird_init);
module_exit(blackbird_fini);

EXPORT_SYMBOL(cx88_ioctl_hook);
EXPORT_SYMBOL(cx88_ioctl_translator);

/* ----------------------------------------------------------- */
/*
 * Local variables:
+10 −14
Original line number Diff line number Diff line
/*
 * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $
 *
 * device driver for Conexant 2388x based TV cards
 * card-specific stuff.
@@ -499,9 +498,6 @@ struct cx88_board cx88_boards[] = {
		.input          = {{
                        .type   = CX88_VMUX_DVB,
                        .vmux   = 0,
		},{
			.type   = CX88_VMUX_SVIDEO,
			.vmux   = 2,
                }},
		.dvb            = 1,
	},
@@ -614,12 +610,12 @@ struct cx88_board cx88_boards[] = {
		.input          = {{
			.type   = CX88_VMUX_TELEVISION,
			.vmux   = 0,
			.gpio0  = 0xed12,  // internal decoder
			.gpio0  = 0xed12,  /* internal decoder */
			.gpio2  = 0x00ff,
		},{
			.type   = CX88_VMUX_DEBUG,
			.vmux   = 0,
			.gpio0  = 0xff01,  // mono from tuner chip
			.gpio0  = 0xff01,  /* mono from tuner chip */
		},{
			.type   = CX88_VMUX_COMPOSITE1,
			.vmux   = 1,
@@ -715,19 +711,18 @@ struct cx88_board cx88_boards[] = {
		.radio_type     = UNSET,
		.tuner_addr	= ADDR_UNSET,
		.radio_addr	= ADDR_UNSET,
		/*  See DViCO FusionHDTV 3 Gold-Q for GPIO documentation.  */
		.input          = {{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x0f0d,
                        .gpio0  = 0x97ed,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x0f00,
                        .gpio0  = 0x97e9,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x0f00,
                        .gpio0  = 0x97e9,
                }},
		.dvb            = 1,
        },
@@ -765,20 +760,21 @@ struct cx88_board cx88_boards[] = {
		.radio_type     = UNSET,
		.tuner_addr	= ADDR_UNSET,
		.radio_addr	= ADDR_UNSET,
		/*  See DViCO FusionHDTV 3 Gold-Q for GPIO documentation.  */
		.tda9887_conf   = TDA9887_PRESENT,
		.input          = {{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x0f0d,
                        .gpio0  = 0x87fd,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x0f00,
                        .gpio0  = 0x87f9,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x0f00,
                        .gpio0  = 0x87f9,
                }},
		.dvb            = 1,
	},
};
const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
+14 −7
Original line number Diff line number Diff line
/*
 * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $
 *
 * device driver for Conexant 2388x based TV cards
 * driver core
@@ -876,7 +875,7 @@ static int set_tvaudio(struct cx88_core *core)

	cx_andor(MO_AFECFG_IO, 0x1f, 0x0);
	cx88_set_tvaudio(core);
	// cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO);
	/* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */

	cx_write(MO_AUDD_LNGTH,    128); /* fifo size */
	cx_write(MO_AUDR_LNGTH,    128); /* fifo size */
@@ -1087,10 +1086,17 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
	core->pci_bus  = pci->bus->number;
	core->pci_slot = PCI_SLOT(pci->devfn);
	core->pci_irqmask = 0x00fc00;
	init_MUTEX(&core->lock);

	core->nr = cx88_devcount++;
	sprintf(core->name,"cx88[%d]",core->nr);
	if (0 != get_ressources(core,pci)) {
		printk(KERN_ERR "CORE %s No more PCI ressources for "
			"subsystem: %04x:%04x, board: %s\n",
			core->name,pci->subsystem_vendor,
			pci->subsystem_device,
			cx88_boards[core->board].name);

		cx88_devcount--;
		goto fail_free;
	}
@@ -1114,7 +1120,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
		core->board = CX88_BOARD_UNKNOWN;
		cx88_card_list(core,pci);
	}
        printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
	printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
		core->name,pci->subsystem_vendor,
		pci->subsystem_device,cx88_boards[core->board].name,
		core->board, card[core->nr] == core->board ?
@@ -1202,4 +1208,5 @@ EXPORT_SYMBOL(cx88_core_put);
 * Local variables:
 * c-basic-offset: 8
 * End:
 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
 */
+44 −3
Original line number Diff line number Diff line
/*
 * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $
 *
 * device driver for Conexant 2388x based TV cards
 * MPEG Transport Stream (DVB) routines
@@ -31,6 +30,7 @@
#include <linux/suspend.h>
#include <linux/config.h>


#include "cx88.h"
#include "dvb-pll.h"

@@ -210,16 +210,26 @@ static struct or51132_config pchdtv_hd3000 = {
static int lgdt330x_pll_set(struct dvb_frontend* fe,
			    struct dvb_frontend_parameters* params)
{
	/* FIXME make this routine use the tuner-simple code.
	 * It could probably be shared with a number of ATSC
	 * frontends. Many share the same tuner with analog TV. */

	struct cx8802_dev *dev= fe->dvb->priv;
	struct cx88_core *core = dev->core;
	u8 buf[4];
	struct i2c_msg msg =
		{ .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 };
	int err;

	dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0);
	/* Put the analog decoder in standby to keep it quiet */
	if (core->tda9887_conf) {
		cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
	}

	dvb_pll_configure(core->pll_desc, buf, params->frequency, 0);
	dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
			__FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
	if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
	if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) {
		printk(KERN_WARNING "cx88-dvb: %s error "
			   "(addr %02x <- %02x, err = %i)\n",
			   __FUNCTION__, buf[0], buf[1], err);
@@ -228,6 +238,13 @@ static int lgdt330x_pll_set(struct dvb_frontend* fe,
		else
			return -EREMOTEIO;
	}
	if (core->tuner_type == TUNER_LG_TDVS_H062F) {
		/* Set the Auxiliary Byte. */
		buf[2] &= ~0x20;
		buf[2] |= 0x18;
		buf[3] = 0x50;
		i2c_transfer(&core->i2c_adap, &msg, 1);
	}
	return 0;
}

@@ -261,6 +278,14 @@ static struct lgdt330x_config fusionhdtv_3_gold = {
	.pll_set          = lgdt330x_pll_set,
	.set_ts_params    = lgdt330x_set_ts_param,
};

static struct lgdt330x_config fusionhdtv_5_gold = {
	.demod_address    = 0x0e,
	.demod_chip       = LGDT3303,
	.serial_mpeg      = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
	.pll_set          = lgdt330x_pll_set,
	.set_ts_params    = lgdt330x_set_ts_param,
};
#endif

static int dvb_register(struct cx8802_dev *dev)
@@ -346,6 +371,22 @@ static int dvb_register(struct cx8802_dev *dev)
						    &dev->core->i2c_adap);
		}
		break;
	case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
		dev->ts_gen_cntrl = 0x08;
		{
		/* Do a hardware reset of chip before using it. */
		struct cx88_core *core = dev->core;

		cx_clear(MO_GP0_IO, 1);
		mdelay(100);
		cx_set(MO_GP0_IO, 1);
		mdelay(200);
		dev->core->pll_addr = 0x61;
		dev->core->pll_desc = &dvb_pll_tdvs_tua6034;
		dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold,
						    &dev->core->i2c_adap);
		}
		break;
#endif
	default:
		printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n",
+0 −1
Original line number Diff line number Diff line
/*
    $Id: cx88-i2c.c,v 1.30 2005/07/25 05:10:13 mkrufky Exp $

    cx88-i2c.c  --  all the i2c code is here

Loading