Commit c94f751f authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: bttv update

This is an update for the bttv driver, changes:

  * adapt to video-buf changes.
  * convert to new-style insmod options.
  * drop some obsolete junk.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent df91ad2a
/* /*
$Id: btcx-risc.c,v 1.3 2004/10/13 10:39:00 kraxel Exp $ $Id: btcx-risc.c,v 1.4 2004/11/07 13:17:14 kraxel Exp $
btcx-risc.c btcx-risc.c
...@@ -38,7 +38,7 @@ MODULE_AUTHOR("Gerd Knorr"); ...@@ -38,7 +38,7 @@ MODULE_AUTHOR("Gerd Knorr");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static unsigned int debug = 0; static unsigned int debug = 0;
MODULE_PARM(debug,"i"); module_param(debug, int, 0644);
MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)"); MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
......
/* /*
$Id: bttv-cards.c,v 1.29 2004/10/13 10:39:00 kraxel Exp $ $Id: bttv-cards.c,v 1.32 2004/11/07 13:17:14 kraxel Exp $
bttv-cards.c bttv-cards.c
...@@ -106,53 +106,31 @@ static unsigned int audioall = UNSET; ...@@ -106,53 +106,31 @@ static unsigned int audioall = UNSET;
static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET }; static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
/* insmod options */ /* insmod options */
MODULE_PARM(triton1,"i"); module_param(triton1, int, 0444);
module_param(vsfx, int, 0444);
module_param(no_overlay, int, 0444);
module_param(latency, int, 0444);
module_param(gpiomask, int, 0444);
module_param(audioall, int, 0444);
module_param(autoload, int, 0444);
module_param_array(card, int, NULL, 0444);
module_param_array(pll, int, NULL, 0444);
module_param_array(tuner, int, NULL, 0444);
module_param_array(svhs, int, NULL, 0444);
module_param_array(remote, int, NULL, 0444);
module_param_array(audiomux, int, NULL, 0444);
MODULE_PARM_DESC(triton1,"set ETBF pci config bit " MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
"[enable bug compatibility for triton1 + others]"); "[enable bug compatibility for triton1 + others]");
MODULE_PARM(vsfx,"i");
MODULE_PARM_DESC(vsfx,"set VSFX pci config bit " MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
"[yet another chipset flaw workaround]"); "[yet another chipset flaw workaround]");
MODULE_PARM(no_overlay,"i");
MODULE_PARM(latency,"i");
MODULE_PARM_DESC(latency,"pci latency timer"); MODULE_PARM_DESC(latency,"pci latency timer");
MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list"); MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)"); MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM_DESC(tuner,"specify installed tuner type"); MODULE_PARM_DESC(tuner,"specify installed tuner type");
MODULE_PARM(autoload,"i");
MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)"); MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
MODULE_PARM(svhs,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM(gpiomask,"i");
MODULE_PARM(audioall,"i");
MODULE_PARM(audiomux,"1-6i");
/* kernel args */
#ifndef MODULE
static int __init p_card(char *str) { return bttv_parse(str,BTTV_MAX,card); }
static int __init p_pll(char *str) { return bttv_parse(str,BTTV_MAX,pll); }
static int __init p_tuner(char *str) { return bttv_parse(str,BTTV_MAX,tuner); }
__setup("bttv.card=", p_card);
__setup("bttv.pll=", p_pll);
__setup("bttv.tuner=", p_tuner);
int __init bttv_parse(char *str, int max, int *vals)
{
int i,number,res = 2;
for (i = 0; res == 2 && i < max; i++) {
res = get_option(&str,&number);
if (res)
vals[i] = number;
}
return 1;
}
#endif
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* list of card IDs for bt878+ cards */ /* list of card IDs for bt878+ cards */
...@@ -184,7 +162,6 @@ static struct CARD { ...@@ -184,7 +162,6 @@ static struct CARD {
{ 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
{ 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
{ 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
// some cards ship with byteswapped IDs ... // some cards ship with byteswapped IDs ...
{ 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
{ 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
...@@ -194,6 +171,7 @@ static struct CARD { ...@@ -194,6 +171,7 @@ static struct CARD {
{ 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" }, { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
{ 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" }, { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
{ 0xa005144f, BTTV_MAGICTVIEW063, "CPH06X TView99-Card" },
{ 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" }, { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
{ 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" }, { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
{ 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" }, { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
...@@ -306,6 +284,7 @@ static struct CARD { ...@@ -306,6 +284,7 @@ static struct CARD {
// DVB cards (using pci function .1 for mpeg data xfer) // DVB cards (using pci function .1 for mpeg data xfer)
{ 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
{ 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T" }, { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T" },
{ 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
{ 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" }, { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
{ 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB-T" }, { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB-T" },
{ 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
...@@ -1670,6 +1649,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1670,6 +1649,7 @@ struct tvcard bttv_tvcards[] = {
.needs_tvaudio = 0, .needs_tvaudio = 0,
.pll = PLL_28, .pll = PLL_28,
.no_gpioirq = 1, .no_gpioirq = 1,
.has_dvb = 1,
},{ },{
.name = "Formac ProTV II (bt878)", .name = "Formac ProTV II (bt878)",
.video_inputs = 4, .video_inputs = 4,
...@@ -2084,9 +2064,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -2084,9 +2064,7 @@ struct tvcard bttv_tvcards[] = {
.pll = PLL_28, .pll = PLL_28,
.has_dvb = 1, .has_dvb = 1,
.no_gpioirq = 1, .no_gpioirq = 1,
#if 0 /* untested */
.has_remote = 1, .has_remote = 1,
#endif
},{ },{
/* ---- card 0x7c ---------------------------------- */ /* ---- card 0x7c ---------------------------------- */
/* Matt Jesson <dvb@jesson.eclipse.co.uk> */ /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
...@@ -2969,40 +2947,6 @@ static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen) ...@@ -2969,40 +2947,6 @@ static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
return 0; return 0;
} }
#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
/* old 2.4.x way -- via soundcore's mod_firmware_load */
static char *firm_altera = "/usr/lib/video4linux/hcwamc.rbf";
MODULE_PARM(firm_altera,"s");
MODULE_PARM_DESC(firm_altera,"WinTV/PVR firmware "
"(driver CD => unzip pvr45xxx.exe => hcwamc.rbf)");
extern int mod_firmware_load(const char *fn, char **fp);
int __devinit pvr_boot(struct bttv *btv)
{
u32 microlen;
u8 *micro;
int result;
microlen = mod_firmware_load(firm_altera, (char**) &micro);
if (!microlen) {
printk(KERN_WARNING "bttv%d: altera firmware not found [%s]\n",
btv->c.nr, firm_altera);
return -1;
}
printk(KERN_INFO "bttv%d: uploading altera firmware [%s] ...\n",
btv->c.nr, firm_altera);
result = pvr_altera_load(btv, micro, microlen);
printk(KERN_INFO "bttv%d: ... upload %s\n",
btv->c.nr, (result < 0) ? "failed" : "ok");
vfree(micro);
return result;
}
#else
/* new 2.5.x way -- via hotplug firmware loader */
int __devinit pvr_boot(struct bttv *btv) int __devinit pvr_boot(struct bttv *btv)
{ {
const struct firmware *fw_entry; const struct firmware *fw_entry;
...@@ -3020,7 +2964,6 @@ int __devinit pvr_boot(struct bttv *btv) ...@@ -3020,7 +2964,6 @@ int __devinit pvr_boot(struct bttv *btv)
release_firmware(fw_entry); release_firmware(fw_entry);
return rc; return rc;
} }
#endif
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* some osprey specific stuff */ /* some osprey specific stuff */
......
/* /*
$Id: bttv-driver.c,v 1.23 2004/10/13 10:39:00 kraxel Exp $ $Id: bttv-driver.c,v 1.27 2004/11/07 14:44:59 kraxel Exp $
bttv - Bt848 frame grabber driver bttv - Bt848 frame grabber driver
...@@ -78,63 +77,56 @@ static unsigned int vcr_hack = 0; ...@@ -78,63 +77,56 @@ static unsigned int vcr_hack = 0;
static unsigned int irq_iswitch = 0; static unsigned int irq_iswitch = 0;
/* API features (turn on/off stuff for testing) */ /* API features (turn on/off stuff for testing) */
static unsigned int v4l2 = 1; static unsigned int v4l2 = 1;
/* insmod args */ /* insmod args */
MODULE_PARM(radio,"1-" __stringify(BTTV_MAX) "i"); module_param(bttv_verbose, int, 0644);
module_param(bttv_gpio, int, 0644);
module_param(bttv_debug, int, 0644);
module_param(irq_debug, int, 0644);
module_param(debug_latency, int, 0644);
module_param(fdsr, int, 0444);
module_param(video_nr, int, 0444);
module_param(radio_nr, int, 0444);
module_param(vbi_nr, int, 0444);
module_param(gbuffers, int, 0444);
module_param(gbufsize, int, 0444);
module_param(v4l2, int, 0644);
module_param(bigendian, int, 0644);
module_param(irq_iswitch, int, 0644);
module_param(combfilter, int, 0444);
module_param(lumafilter, int, 0444);
module_param(automute, int, 0444);
module_param(chroma_agc, int, 0444);
module_param(adc_crush, int, 0444);
module_param(whitecrush_upper, int, 0444);
module_param(whitecrush_lower, int, 0444);
module_param(vcr_hack, int, 0444);
module_param_array(radio, int, NULL, 0444);
MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)"); MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)");
MODULE_PARM(bigendian,"i");
MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian"); MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian");
MODULE_PARM(bttv_verbose,"i");
MODULE_PARM_DESC(bttv_verbose,"verbose startup messages, default is 1 (yes)"); MODULE_PARM_DESC(bttv_verbose,"verbose startup messages, default is 1 (yes)");
MODULE_PARM(bttv_gpio,"i");
MODULE_PARM_DESC(bttv_gpio,"log gpio changes, default is 0 (no)"); MODULE_PARM_DESC(bttv_gpio,"log gpio changes, default is 0 (no)");
MODULE_PARM(bttv_debug,"i");
MODULE_PARM_DESC(bttv_debug,"debug messages, default is 0 (no)"); MODULE_PARM_DESC(bttv_debug,"debug messages, default is 0 (no)");
MODULE_PARM(irq_debug,"i");
MODULE_PARM_DESC(irq_debug,"irq handler debug messages, default is 0 (no)"); MODULE_PARM_DESC(irq_debug,"irq handler debug messages, default is 0 (no)");
MODULE_PARM(gbuffers,"i");
MODULE_PARM_DESC(gbuffers,"number of capture buffers. range 2-32, default 8"); MODULE_PARM_DESC(gbuffers,"number of capture buffers. range 2-32, default 8");
MODULE_PARM(gbufsize,"i");
MODULE_PARM_DESC(gbufsize,"size of the capture buffers, default is 0x208000"); MODULE_PARM_DESC(gbufsize,"size of the capture buffers, default is 0x208000");
MODULE_PARM(video_nr,"i");
MODULE_PARM(radio_nr,"i");
MODULE_PARM(vbi_nr,"i");
MODULE_PARM(debug_latency,"i");
MODULE_PARM(fdsr,"i");
MODULE_PARM(combfilter,"i");
MODULE_PARM(lumafilter,"i");
MODULE_PARM(automute,"i");
MODULE_PARM_DESC(automute,"mute audio on bad/missing video signal, default is 1 (yes)"); MODULE_PARM_DESC(automute,"mute audio on bad/missing video signal, default is 1 (yes)");
MODULE_PARM(chroma_agc,"i");
MODULE_PARM_DESC(chroma_agc,"enables the AGC of chroma signal, default is 0 (no)"); MODULE_PARM_DESC(chroma_agc,"enables the AGC of chroma signal, default is 0 (no)");
MODULE_PARM(adc_crush,"i");
MODULE_PARM_DESC(adc_crush,"enables the luminance ADC crush, default is 1 (yes)"); MODULE_PARM_DESC(adc_crush,"enables the luminance ADC crush, default is 1 (yes)");
MODULE_PARM(whitecrush_upper,"i");
MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is 207"); MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is 207");
MODULE_PARM(whitecrush_lower,"i");
MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127");
MODULE_PARM(vcr_hack,"i");
MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)");
MODULE_PARM(irq_iswitch,"i");
MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler");
MODULE_PARM(v4l2,"i");
MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards");
MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* kernel args */
#ifndef MODULE
static int __init p_radio(char *str) { return bttv_parse(str,BTTV_MAX,radio); }
__setup("bttv.radio=", p_radio);
#endif
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* sysfs */ /* sysfs */
...@@ -1414,9 +1406,9 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, ...@@ -1414,9 +1406,9 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf,
} }
static int static int
buffer_setup(void *priv, unsigned int *count, unsigned int *size) buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
*size = fh->fmt->depth*fh->width*fh->height >> 3; *size = fh->fmt->depth*fh->width*fh->height >> 3;
if (0 == *count) if (0 == *count)
...@@ -1427,21 +1419,21 @@ buffer_setup(void *priv, unsigned int *count, unsigned int *size) ...@@ -1427,21 +1419,21 @@ buffer_setup(void *priv, unsigned int *count, unsigned int *size)
} }
static int static int
buffer_prepare(void *priv, struct videobuf_buffer *vb, buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
return bttv_prepare_buffer(fh->btv, buf, fh->fmt, return bttv_prepare_buffer(fh->btv, buf, fh->fmt,
fh->width, fh->height, field); fh->width, fh->height, field);
} }
static void static void
buffer_queue(void *priv, struct videobuf_buffer *vb) buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
buf->vb.state = STATE_QUEUED; buf->vb.state = STATE_QUEUED;
...@@ -1452,10 +1444,10 @@ buffer_queue(void *priv, struct videobuf_buffer *vb) ...@@ -1452,10 +1444,10 @@ buffer_queue(void *priv, struct videobuf_buffer *vb)
} }
} }
static void buffer_release(void *priv, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
bttv_dma_free(fh->btv,buf); bttv_dma_free(fh->btv,buf);
} }
...@@ -2154,7 +2146,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2154,7 +2146,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (btv->errors) if (btv->errors)
bttv_reinit_bt848(btv); bttv_reinit_bt848(btv);
#ifdef VIDIOC_G_PRIORITY
switch (cmd) { switch (cmd) {
case VIDIOCSFREQ: case VIDIOCSFREQ:
case VIDIOCSTUNER: case VIDIOCSTUNER:
...@@ -2168,7 +2159,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2168,7 +2159,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (0 != retval) if (0 != retval)
return retval; return retval;
}; };
#endif
switch (cmd) { switch (cmd) {
/* *** v4l1 *** ************************************************ */ /* *** v4l1 *** ************************************************ */
...@@ -2386,8 +2377,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2386,8 +2377,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
unsigned int i; unsigned int i;
down(&fh->cap.lock); down(&fh->cap.lock);
retval = videobuf_mmap_setup(file->private_data, retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize,
&fh->cap,gbuffers,gbufsize,
V4L2_MEMORY_MMAP); V4L2_MEMORY_MMAP);
if (retval < 0) if (retval < 0)
goto fh_unlock_and_return; goto fh_unlock_and_return;
...@@ -2685,16 +2675,16 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2685,16 +2675,16 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
} }
case VIDIOC_REQBUFS: case VIDIOC_REQBUFS:
return videobuf_reqbufs(file->private_data,bttv_queue(fh),arg); return videobuf_reqbufs(bttv_queue(fh),arg);
case VIDIOC_QUERYBUF: case VIDIOC_QUERYBUF:
return videobuf_querybuf(bttv_queue(fh),arg); return videobuf_querybuf(bttv_queue(fh),arg);
case VIDIOC_QBUF: case VIDIOC_QBUF:
return videobuf_qbuf(file->private_data,bttv_queue(fh),arg); return videobuf_qbuf(bttv_queue(fh),arg);
case VIDIOC_DQBUF: case VIDIOC_DQBUF:
return videobuf_dqbuf(file->private_data,bttv_queue(fh),arg, return videobuf_dqbuf(bttv_queue(fh),arg,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
...@@ -2703,13 +2693,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2703,13 +2693,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (!check_alloc_btres(btv,fh,res)) if (!check_alloc_btres(btv,fh,res))
return -EBUSY; return -EBUSY;
return videobuf_streamon(file->private_data,bttv_queue(fh)); return videobuf_streamon(bttv_queue(fh));
} }
case VIDIOC_STREAMOFF: case VIDIOC_STREAMOFF:
{ {
int res = bttv_resource(fh); int res = bttv_resource(fh);
retval = videobuf_streamoff(file->private_data,bttv_queue(fh)); retval = videobuf_streamoff(bttv_queue(fh));
if (retval < 0) if (retval < 0)
return retval; return retval;
free_btres(btv,fh,res); free_btres(btv,fh,res);
...@@ -2778,7 +2768,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2778,7 +2768,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
#ifdef VIDIOC_G_PRIORITY
case VIDIOC_G_PRIORITY: case VIDIOC_G_PRIORITY:
{ {
enum v4l2_priority *p = arg; enum v4l2_priority *p = arg;
...@@ -2792,8 +2781,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2792,8 +2781,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return v4l2_prio_change(&btv->prio, &fh->prio, *prio); return v4l2_prio_change(&btv->prio, &fh->prio, *prio);
} }
#endif
case VIDIOC_ENUMSTD: case VIDIOC_ENUMSTD:
case VIDIOC_G_STD: case VIDIOC_G_STD:
...@@ -2846,15 +2833,13 @@ static ssize_t bttv_read(struct file *file, char __user *data, ...@@ -2846,15 +2833,13 @@ static ssize_t bttv_read(struct file *file, char __user *data,
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (locked_btres(fh->btv,RESOURCE_VIDEO)) if (locked_btres(fh->btv,RESOURCE_VIDEO))
return -EBUSY; return -EBUSY;
retval = videobuf_read_one(file->private_data, retval = videobuf_read_one(&fh->cap, data, count, ppos,
&fh->cap, data, count, ppos,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
break; break;
case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_CAPTURE:
if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
return -EBUSY; return -EBUSY;
retval = videobuf_read_stream(file->private_data, retval = videobuf_read_stream(&fh->vbi, data, count, ppos, 1,
&fh->vbi, data, count, ppos, 1,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
break; break;
default: default:
...@@ -2872,8 +2857,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) ...@@ -2872,8 +2857,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
return POLLERR; return POLLERR;
return videobuf_poll_stream(file, file->private_data, return videobuf_poll_stream(file, &fh->vbi, wait);
&fh->vbi, wait);
} }
if (check_btres(fh,RESOURCE_VIDEO)) { if (check_btres(fh,RESOURCE_VIDEO)) {
...@@ -2953,20 +2937,20 @@ static int bttv_open(struct inode *inode, struct file *file) ...@@ -2953,20 +2937,20 @@ static int bttv_open(struct inode *inode, struct file *file)
*fh = btv->init; *fh = btv->init;
fh->type = type; fh->type = type;
fh->ov.setup_ok = 0; fh->ov.setup_ok = 0;
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_open(&btv->prio,&fh->prio); v4l2_prio_open(&btv->prio,&fh->prio);
#endif
videobuf_queue_init(&fh->cap, &bttv_video_qops, videobuf_queue_init(&fh->cap, &bttv_video_qops,
btv->c.pci, &btv->s_lock, btv->c.pci, &btv->s_lock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED, V4L2_FIELD_INTERLACED,
sizeof(struct bttv_buffer)); sizeof(struct bttv_buffer),
fh);
videobuf_queue_init(&fh->vbi, &bttv_vbi_qops, videobuf_queue_init(&fh->vbi, &bttv_vbi_qops,
btv->c.pci, &btv->s_lock, btv->c.pci, &btv->s_lock,
V4L2_BUF_TYPE_VBI_CAPTURE, V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_FIELD_SEQ_TB, V4L2_FIELD_SEQ_TB,
sizeof(struct bttv_buffer)); sizeof(struct bttv_buffer),
fh);
i2c_vidiocschan(btv); i2c_vidiocschan(btv);
btv->users++; btv->users++;
...@@ -2987,7 +2971,7 @@ static int bttv_release(struct inode *inode, struct file *file) ...@@ -2987,7 +2971,7 @@ static int bttv_release(struct inode *inode, struct file *file)
/* stop video capture */ /* stop video capture */
if (check_btres(fh, RESOURCE_VIDEO)) { if (check_btres(fh, RESOURCE_VIDEO)) {
videobuf_streamoff(file->private_data,&fh->cap); videobuf_streamoff(&fh->cap);
free_btres(btv,fh,RESOURCE_VIDEO); free_btres(btv,fh,RESOURCE_VIDEO);
} }
if (fh->cap.read_buf) { if (fh->cap.read_buf) {
...@@ -2998,15 +2982,13 @@ static int bttv_release(struct inode *inode, struct file *file) ...@@ -2998,15 +2982,13 @@ static int bttv_release(struct inode *inode, struct file *file)
/* stop vbi capture */ /* stop vbi capture */
if (check_btres(fh, RESOURCE_VBI)) { if (check_btres(fh, RESOURCE_VBI)) {
if (fh->vbi.streaming) if (fh->vbi.streaming)
videobuf_streamoff(file->private_data,&fh->vbi); videobuf_streamoff(&fh->vbi);
if (fh->vbi.reading) if (fh->vbi.reading)
videobuf_read_stop(file->private_data,&fh->vbi); videobuf_read_stop(&fh->vbi);
free_btres(btv,fh,RESOURCE_VBI); free_btres(btv,fh,RESOURCE_VBI);
} }
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_close(&btv->prio,&fh->prio); v4l2_prio_close(&btv->prio,&fh->prio);
#endif
file->private_data = NULL; file->private_data = NULL;
kfree(fh); kfree(fh);
...@@ -3023,7 +3005,7 @@ bttv_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -3023,7 +3005,7 @@ bttv_mmap(struct file *file, struct vm_area_struct *vma)
dprintk("bttv%d: mmap type=%s 0x%lx+%ld\n", dprintk("bttv%d: mmap type=%s 0x%lx+%ld\n",
fh->btv->c.nr, v4l2_type_names[fh->type], fh->btv->c.nr, v4l2_type_names[fh->type],
vma->vm_start, vma->vm_end - vma->vm_start); vma->vm_start, vma->vm_end - vma->vm_start);
return videobuf_mmap_mapper(vma,bttv_queue(fh)); return videobuf_mmap_mapper(bttv_queue(fh),vma);
} }
static struct file_operations bttv_fops = static struct file_operations bttv_fops =
...@@ -3742,9 +3724,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, ...@@ -3742,9 +3724,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
INIT_LIST_HEAD(&btv->c.subs); INIT_LIST_HEAD(&btv->c.subs);
INIT_LIST_HEAD(&btv->capture); INIT_LIST_HEAD(&btv->capture);
INIT_LIST_HEAD(&btv->vcapture); INIT_LIST_HEAD(&btv->vcapture);
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_init(&btv->prio); v4l2_prio_init(&btv->prio);
#endif
init_timer(&btv->timeout); init_timer(&btv->timeout);
btv->timeout.function = bttv_irq_timeout; btv->timeout.function = bttv_irq_timeout;
......
/* /*
$Id: bttv-gpio.c,v 1.4 2004/10/13 10:39:00 kraxel Exp $ $Id: bttv-gpio.c,v 1.6 2004/11/03 09:04:50 kraxel Exp $
bttv-gpio.c -- gpio sub drivers bttv-gpio.c -- gpio sub drivers
......
/* /*
$Id: bttv-i2c.c,v 1.11 2004/10/13 10:39:00 kraxel Exp $ $Id: bttv-i2c.c,v 1.13 2004/11/07 13:17:15 kraxel Exp $
bttv-i2c.c -- all the i2c code is here bttv-i2c.c -- all the i2c code is here
...@@ -37,19 +37,15 @@ static struct i2c_adapter bttv_i2c_adap_sw_template; ...@@ -37,19 +37,15 @@ static struct i2c_adapter bttv_i2c_adap_sw_template;
static struct i2c_adapter bttv_i2c_adap_hw_template; static struct i2c_adapter bttv_i2c_adap_hw_template;
static struct i2c_client bttv_i2c_client_template; static struct i2c_client bttv_i2c_client_template;
#ifndef I2C_PEC
static void bttv_inc_use(struct i2c_adapter *adap);
static void bttv_dec_use(struct i2c_adapter *adap);
#endif
static int attach_inform(struct i2c_client *client); static int attach_inform(struct i2c_client *client);
static int detach_inform(struct i2c_client *client); static int detach_inform(struct i2c_client *client);
static int i2c_debug = 0; static int i2c_debug = 0;
static int i2c_hw = 0; static int i2c_hw = 0;
static int i2c_scan = 0; static int i2c_scan = 0;
MODULE_PARM(i2c_debug,"i"); module_param(i2c_debug, int, 0644);
MODULE_PARM(i2c_hw,"i"); module_param(i2c_hw, int, 0444);
MODULE_PARM(i2c_scan,"i"); module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -108,12 +104,7 @@ static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = { ...@@ -108,12 +104,7 @@ static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = {
}; };
static struct i2c_adapter bttv_i2c_adap_sw_template = { static struct i2c_adapter bttv_i2c_adap_sw_template = {
#ifdef I2C_PEC
.owner = THIS_MODULE, .owner = THIS_MODULE,
#else
.inc_use = bttv_inc_use,
.dec_use = bttv_dec_use,
#endif
#ifdef I2C_CLASS_TV_ANALOG #ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG, .class = I2C_CLASS_TV_ANALOG,
#endif #endif
...@@ -290,12 +281,7 @@ static struct i2c_algorithm bttv_algo = { ...@@ -290,12 +281,7 @@ static struct i2c_algorithm bttv_algo = {
}; };
static struct i2c_adapter bttv_i2c_adap_hw_template = { static struct i2c_adapter bttv_i2c_adap_hw_template = {
#ifdef I2C_PEC
.owner = THIS_MODULE, .owner = THIS_MODULE,
#else
.inc_use = bttv_inc_use,
.dec_use = bttv_dec_use,
#endif
#ifdef I2C_CLASS_TV_ANALOG #ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG, .class = I2C_CLASS_TV_ANALOG,
#endif #endif
...@@ -306,6 +292,9 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { ...@@ -306,6 +292,9 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = {
.client_unregister = detach_inform, .client_unregister = detach_inform,
}; };
/* ----------------------------------------------------------------------- */
/* I2C functions - common stuff */
static int attach_inform(struct i2c_client *client) static int attach_inform(struct i2c_client *client)
{ {
struct bttv *btv = i2c_get_adapdata(client->adapter); struct bttv *btv = i2c_get_adapdata(client->adapter);
......
/* /*
$Id: bttv-vbi.c,v 1.6 2004/10/13 10:39:00 kraxel Exp $ $Id: bttv-vbi.c,v 1.7 2004/11/07 13:17:15 kraxel Exp $
bttv - Bt848 frame grabber driver bttv - Bt848 frame grabber driver
vbi interface vbi interface
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
static unsigned int vbibufs = 4; static unsigned int vbibufs = 4;
static unsigned int vbi_debug = 0; static unsigned int vbi_debug = 0;
MODULE_PARM(vbibufs,"i"); module_param(vbibufs, int, 0444);
module_param(vbi_debug, int, 0644);
MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32, default 4"); MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32, default 4");
MODULE_PARM(vbi_debug,"i");
MODULE_PARM_DESC(vbi_debug,"vbi code debug messages, default is 0 (no)"); MODULE_PARM_DESC(vbi_debug,"vbi code debug messages, default is 0 (no)");
#ifdef dprintk #ifdef dprintk
...@@ -63,10 +63,10 @@ vbi_buffer_risc(struct bttv *btv, struct bttv_buffer *buf, int lines) ...@@ -63,10 +63,10 @@ vbi_buffer_risc(struct bttv *btv, struct bttv_buffer *buf, int lines)
return 0; return 0;
} }
static int vbi_buffer_setup(void *priv, static int vbi_buffer_setup(struct videobuf_queue *q,
unsigned int *count, unsigned int *size) unsigned int *count, unsigned int *size)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
if (0 == *count) if (0 == *count)
...@@ -76,12 +76,13 @@ static int vbi_buffer_setup(void *priv, ...@@ -76,12 +76,13 @@ static int vbi_buffer_setup(void *priv,
return 0; return 0;
} }
static int vbi_buffer_prepare(void *priv, struct videobuf_buffer *vb, static int vbi_buffer_prepare(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
int rc; int rc;
buf->vb.size = fh->lines * 2 * 2048; buf->vb.size = fh->lines * 2 * 2048;
...@@ -107,11 +108,11 @@ static int vbi_buffer_prepare(void *priv, struct videobuf_buffer *vb, ...@@ -107,11 +108,11 @@ static int vbi_buffer_prepare(void *priv, struct videobuf_buffer *vb,
} }
static void static void
vbi_buffer_queue(void *priv, struct videobuf_buffer *vb) vbi_buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
dprintk("queue %p\n",vb); dprintk("queue %p\n",vb);
buf->vb.state = STATE_QUEUED; buf->vb.state = STATE_QUEUED;
...@@ -122,11 +123,11 @@ vbi_buffer_queue(void *priv, struct videobuf_buffer *vb) ...@@ -122,11 +123,11 @@ vbi_buffer_queue(void *priv, struct videobuf_buffer *vb)
} }
} }
static void vbi_buffer_release(void *priv, struct videobuf_buffer *vb) static void vbi_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = q->priv_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb);
dprintk("free %p\n",vb); dprintk("free %p\n",vb);
bttv_dma_free(fh->btv,buf); bttv_dma_free(fh->btv,buf);
......
...@@ -230,9 +230,6 @@ extern void bttv_init_card2(struct bttv *btv); ...@@ -230,9 +230,6 @@ extern void bttv_init_card2(struct bttv *btv);
extern void tea5757_set_freq(struct bttv *btv, unsigned short freq); extern void tea5757_set_freq(struct bttv *btv, unsigned short freq);
extern void bttv_tda9880_setnorm(struct bttv *btv, int norm); extern void bttv_tda9880_setnorm(struct bttv *btv, int norm);
/* kernel cmd line parse helper */
extern int bttv_parse(char *str, int max, int *vals);
/* extra tweaks for some chipsets */ /* extra tweaks for some chipsets */
extern void bttv_check_chipset(void); extern void bttv_check_chipset(void);
extern int bttv_handle_chipset(struct bttv *btv); extern int bttv_handle_chipset(struct bttv *btv);
......
/* /*
$Id: bttvp.h,v 1.11 2004/10/13 10:39:00 kraxel Exp $ $Id: bttvp.h,v 1.12 2004/10/25 11:26:36 kraxel Exp $
bttv - Bt848 frame grabber driver bttv - Bt848 frame grabber driver
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment