Skip to content

Commit

Permalink
[PATCH] v4l: CX88 updates and card additions
Browse files Browse the repository at this point in the history
- 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: Uli Luckas <luckas@musoft.de>
Signed-off-by: Torsten Seeboth <Torsten.Seeboth@t-online.de>
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Patrick Boettcher <patrick.boettcher@desy.de>
Signed-off-by: Catalin Climov <catalin@climov.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Mauro Carvalho Chehab authored and Linus Torvalds committed Sep 9, 2005
1 parent 24a70fd commit e52e98a
Show file tree
Hide file tree
Showing 12 changed files with 874 additions and 599 deletions.
73 changes: 59 additions & 14 deletions drivers/media/video/cx88/cx88-blackbird.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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:
{
Expand Down Expand Up @@ -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 ------------------------------------- */
Expand All @@ -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)
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)
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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);
}

Expand All @@ -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:
Expand Down
24 changes: 10 additions & 14 deletions drivers/media/video/cx88/cx88-cards.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $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.
Expand Down Expand Up @@ -499,9 +498,6 @@ struct cx88_board cx88_boards[] = {
.input = {{
.type = CX88_VMUX_DVB,
.vmux = 0,
},{
.type = CX88_VMUX_SVIDEO,
.vmux = 2,
}},
.dvb = 1,
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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);
Expand Down
21 changes: 14 additions & 7 deletions drivers/media/video/cx88/cx88-core.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* $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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
Expand All @@ -1114,11 +1120,11 @@ 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",
core->name,pci->subsystem_vendor,
pci->subsystem_device,cx88_boards[core->board].name,
core->board, card[core->nr] == core->board ?
"insmod option" : "autodetected");
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 ?
"insmod option" : "autodetected");

core->tuner_type = tuner[core->nr];
core->radio_type = radio[core->nr];
Expand Down Expand Up @@ -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
*/
Loading

0 comments on commit e52e98a

Please sign in to comment.