Commit de9c9143 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] v4l: missing bits

Missing parts of the v4l update

Cc: Gerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4896f66e
......@@ -168,13 +168,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
}
// wait a bit
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/100);
msleep(10);
}
// delay a bit to let encoder settle
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/20);
msleep(50);
// done
return status;
......
/*
* $Id: saa7134-cards.c,v 1.27 2004/09/30 14:17:12 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* card-specific stuff.
*
......@@ -404,6 +406,7 @@ struct saa7134_board saa7134_boards[] = {
.name = "Terratec Cinergy 600 TV",
.audio_clock = 0x00200000,
.tuner_type = TUNER_PHILIPS_PAL,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{
.name = name_tv,
.vmux = 1,
......@@ -647,6 +650,29 @@ struct saa7134_board saa7134_boards[] = {
.tv = 1,
}},
},
[SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = {
.name = "Compro VideoMate TV Gold+",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC_M,
.gpiomask = 0x800c0000,
.inputs = {{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
.gpio = 0x06c00012,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
.gpio = 0x0ac20012,
},{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.gpio = 0x08c20012,
.tv = 1,
}},
},
[SAA7134_BOARD_CRONOS_PLUS] = {
/* gpio pins:
0 .. 3 BASE_ID
......@@ -1051,6 +1077,18 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2,
.gpio = 0x0000,
.tv = 1,
},{
.name = name_comp1,
.vmux = 4,
.amux = LINE1,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp2, // CVideo over SVideo Connector
.vmux = 0,
.amux = LINE1,
}},
.mute = {
.name = name_mute,
......@@ -1091,6 +1129,85 @@ struct saa7134_board saa7134_boards[] = {
.gpio = 0x40000,
},
},
[SAA7134_BOARD_SABRENT_SBTTVFM] = {
/* Michael Rodriguez-Torrent */
.name = "Sabrent SBT-TVFM (saa7130)",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC_M,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{
.name = name_tv,
.vmux = 3,
.amux = LINE2,
.tv = 1,
},{
.name = name_comp1,
.vmux = 1,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
}},
.radio = {
.name = name_radio,
.amux = LINE2,
},
},
[SAA7134_BOARD_ZOLID_XPERT_TV7134] = {
/* Helge Jensen <helge.jensen@slog.dk> */
.name = ":Zolid Xpert TV7134",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC,
.inputs = {{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
},{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.tv = 1,
}},
},
[SAA7134_EMPIRE_PCI_TV_RADIO_LE] = {
/* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
.name = "Empire PCI TV-Radio LE",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_PAL,
.gpiomask = 0x4000,
.inputs = {{
.name = name_tv_mono,
.vmux = 1,
.amux = LINE2,
.gpio = 0x8000,
.tv = 1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
.gpio = 0x8000,
},{
.name = name_svideo,
.vmux = 6,
.amux = LINE1,
.gpio = 0x8000,
}},
.radio = {
.name = name_radio,
.amux = LINE1,
.gpio = 0x8000,
},
.mute = {
.name = name_mute,
.amux = TV,
.gpio =0x8000,
}
},
};
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
......@@ -1236,6 +1353,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x185b,
.subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7133,
.subvendor = 0x185b,
.subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
......@@ -1401,7 +1524,7 @@ static void board_flyvideo(struct saa7134_dev *dev)
/* ----------------------------------------------------------- */
int saa7134_board_init(struct saa7134_dev *dev)
int saa7134_board_init1(struct saa7134_dev *dev)
{
// Always print gpio, often manufacturers encode tuner type and other info.
saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0);
......@@ -1420,6 +1543,7 @@ int saa7134_board_init(struct saa7134_dev *dev)
case SAA7134_BOARD_CINERGY600:
case SAA7134_BOARD_ECS_TVP3XP:
case SAA7134_BOARD_ECS_TVP3XP_4CB5:
case SAA7134_BOARD_MD2819:
dev->has_remote = 1;
break;
case SAA7134_BOARD_AVACSSMARTTV:
......@@ -1435,6 +1559,31 @@ int saa7134_board_init(struct saa7134_dev *dev)
return 0;
}
/* stuff which needs working i2c */
int saa7134_board_init2(struct saa7134_dev *dev)
{
unsigned char buf;
int board;
switch (dev->board) {
case SAA7134_BOARD_BMK_MPEX_NOTUNER:
case SAA7134_BOARD_BMK_MPEX_TUNER:
dev->i2c_client.addr = 0x60;
board = (i2c_master_recv(&dev->i2c_client,&buf,0) < 0)
? SAA7134_BOARD_BMK_MPEX_NOTUNER
: SAA7134_BOARD_BMK_MPEX_TUNER;
if (board == dev->board)
break;
printk("%s: board type fixup: %s\n", dev->name,
saa7134_boards[dev->board].name);
dev->tuner_type = saa7134_boards[dev->board].tuner_type;
if (TUNER_ABSENT != dev->tuner_type)
saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type);
break;
}
return 0;
}
/* ----------------------------------------------------------- */
/*
* Local variables:
......
/*
* $Id: saa7134-core.c,v 1.10 2004/09/15 16:15:24 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* driver core
*
......@@ -27,6 +29,7 @@
#include <linux/kmod.h>
#include <linux/sound.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include "saa7134-reg.h"
#include "saa7134.h"
......@@ -897,7 +900,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
}
/* initialize hardware #1 */
saa7134_board_init(dev);
saa7134_board_init1(dev);
saa7134_hwinit1(dev);
/* get irq */
......@@ -910,11 +913,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
}
/* wait a bit, register i2c bus */
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10);
msleep(100);
saa7134_i2c_register(dev);
/* initialize hardware #2 */
saa7134_board_init2(dev);
saa7134_hwinit2(dev);
/* load i2c helpers */
......
/*
* $Id: saa7134-i2c.c,v 1.5 2004/10/06 17:30:51 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
*
......@@ -381,21 +383,26 @@ saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
return 0;
}
static int
saa7134_i2c_scan(struct saa7134_dev *dev)
static char *i2c_devs[128] = {
[ 0x20 ] = "mpeg encoder (saa6752hs)",
[ 0xa0 >> 1 ] = "eeprom",
[ 0xc0 >> 1 ] = "tuner (analog)",
[ 0x86 >> 1 ] = "tda9887",
};
static void do_i2c_scan(char *name, struct i2c_client *c)
{
unsigned char buf;
int i,rc;
for (i = 0; i < 256; i+= 2) {
dev->i2c_client.addr = i >> 1;
rc = i2c_master_recv(&dev->i2c_client,&buf,0);
for (i = 0; i < 128; i++) {
c->addr = i;
rc = i2c_master_recv(c,&buf,0);
if (rc < 0)
continue;
printk("%s: i2c scan: found device @ %x%s\n",
dev->name, i, (i == 0xa0) ? " [eeprom]" : "");
printk("%s: i2c scan: found device @ 0x%x [%s]\n",
name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
}
return 0;
}
void saa7134_i2c_call_clients(struct saa7134_dev *dev,
......@@ -418,7 +425,7 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan)
saa7134_i2c_scan(dev);
do_i2c_scan(dev->name,&dev->i2c_client);
return 0;
}
......
/*
* $Id: saa7134-input.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
*
* handle saa7134 IR remotes via linux kernel input layer.
*
* This program is free software; you can redistribute it and/or modify
......@@ -209,6 +211,53 @@ static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
[ 15 ] = KEY_F22, // min
[ 26 ] = KEY_F23, // freeze
};
/* Alex Hermann <gaaf@gmx.net> */
static IR_KEYTAB_TYPE md2819_codes[IR_KEYTAB_SIZE] = {
[ 40 ] = KEY_KP1,
[ 24 ] = KEY_KP2,
[ 56 ] = KEY_KP3,
[ 36 ] = KEY_KP4,
[ 20 ] = KEY_KP5,
[ 52 ] = KEY_KP6,
[ 44 ] = KEY_KP7,
[ 28 ] = KEY_KP8,
[ 60 ] = KEY_KP9,
[ 34 ] = KEY_KP0,
[ 32 ] = KEY_TV, // TV/FM
[ 16 ] = KEY_CD, // CD
[ 48 ] = KEY_TEXT, // TELETEXT
[ 0 ] = KEY_POWER, // POWER
[ 8 ] = KEY_VIDEO, // VIDEO
[ 4 ] = KEY_AUDIO, // AUDIO
[ 12 ] = KEY_ZOOM, // FULL SCREEN
[ 18 ] = KEY_SUBTITLE, // DISPLAY - ???
[ 50 ] = KEY_REWIND, // LOOP - ???
[ 2 ] = KEY_PRINT, // PREVIEW - ???
[ 42 ] = KEY_SEARCH, // AUTOSCAN
[ 26 ] = KEY_SLEEP, // FREEZE - ???
[ 58 ] = KEY_SHUFFLE, // SNAPSHOT - ???
[ 10 ] = KEY_MUTE, // MUTE
[ 38 ] = KEY_RECORD, // RECORD
[ 22 ] = KEY_PAUSE, // PAUSE
[ 54 ] = KEY_STOP, // STOP
[ 6 ] = KEY_PLAY, // PLAY
[ 46 ] = KEY_RED, // <RED>
[ 33 ] = KEY_GREEN, // <GREEN>
[ 14 ] = KEY_YELLOW, // <YELLOW>
[ 1 ] = KEY_BLUE, // <BLUE>
[ 30 ] = KEY_VOLUMEDOWN, // VOLUME-
[ 62 ] = KEY_VOLUMEUP, // VOLUME+
[ 17 ] = KEY_CHANNELDOWN, // CHANNEL/PAGE-
[ 49 ] = KEY_CHANNELUP // CHANNEL/PAGE+
};
/* ---------------------------------------------------------------------- */
static int build_key(struct saa7134_dev *dev)
......@@ -303,6 +352,15 @@ int saa7134_input_init1(struct saa7134_dev *dev)
mask_keyup = 0x000020;
polling = 50; // ms
break;
case SAA7134_BOARD_MD2819:
ir_codes = md2819_codes;
mask_keycode = 0x0007C8;
mask_keydown = 0x000010;
polling = 50; // ms
/* Set GPIO pin2 to high to enable the IR controller */
saa_setb(SAA7134_GPIO_GPMODE0, 0x4);
saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4);
break;
}
if (NULL == ir_codes) {
printk("%s: Oops: IR config error [card=%d]\n",
......
/*
* $Id: saa7134-oss.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* oss dsp interface
*
......
/*
* $Id: saa7134-reg.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $
*
* philips saa7134 registers
*/
......
/*
* $Id: saa7134-ts.c,v 1.9 2004/10/11 14:53:13 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
*
......@@ -88,10 +90,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0;
}
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field)
{
struct saa7134_dev *dev = file->private_data;
struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
unsigned int lines, llength, size;
int err;
......@@ -136,7 +138,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
}
static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{
*size = TS_PACKET_SIZE * ts_nr_packets;
if (0 == *count)
......@@ -145,17 +147,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0;
}
static void buffer_queue(struct file *file, struct videobuf_buffer *vb)
static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_dev *dev = file->private_data;
struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(dev,&dev->ts_q,buf);
}
static void buffer_release(struct file *file, struct videobuf_buffer *vb)
static void buffer_release(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_dev *dev = file->private_data;
struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_dma_free(dev,buf);
......@@ -174,10 +176,9 @@ static struct videobuf_queue_ops ts_qops = {
static void ts_reset_encoder(struct saa7134_dev* dev)
{
saa_writeb(SAA7134_SPECIAL_MODE, 0x00);
mdelay(10);
msleep(10);
saa_writeb(SAA7134_SPECIAL_MODE, 0x01);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10);
msleep(100);
}
static int ts_init_encoder(struct saa7134_dev* dev, void* arg)
......@@ -226,10 +227,10 @@ static int ts_release(struct inode *inode, struct file *file)
struct saa7134_dev *dev = file->private_data;
if (dev->ts.ts.streaming)
videobuf_streamoff(file,&dev->ts.ts);
videobuf_streamoff(file->private_data,&dev->ts.ts);
down(&dev->ts.ts.lock);
if (dev->ts.ts.reading)
videobuf_read_stop(file,&dev->ts.ts);
videobuf_read_stop(file->private_data,&dev->ts.ts);
dev->ts.users--;
/* stop the encoder */
......@@ -250,7 +251,9 @@ ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
dev->ts.started = 1;
}
return videobuf_read_stream(file, &dev->ts.ts, data, count, ppos, 0);
return videobuf_read_stream(file->private_data,
&dev->ts.ts, data, count, ppos, 0,
file->f_flags & O_NONBLOCK);
}
static unsigned int
......@@ -258,7 +261,8 @@ ts_poll(struct file *file, struct poll_table_struct *wait)
{
struct saa7134_dev *dev = file->private_data;
return videobuf_poll_stream(file, &dev->ts.ts, wait);
return videobuf_poll_stream(file, file->private_data,
&dev->ts.ts, wait);
}
......@@ -387,22 +391,23 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
}
case VIDIOC_REQBUFS:
return videobuf_reqbufs(file,&dev->ts.ts,arg);
return videobuf_reqbufs(file->private_data,&dev->ts.ts,arg);
case VIDIOC_QUERYBUF:
return videobuf_querybuf(&dev->ts.ts,arg);
case VIDIOC_QBUF:
return videobuf_qbuf(file,&dev->ts.ts,arg);
return videobuf_qbuf(file->private_data,&dev->ts.ts,arg);
case VIDIOC_DQBUF:
return videobuf_dqbuf(file,&dev->ts.ts,arg);
return videobuf_dqbuf(file->private_data,&dev->ts.ts,arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON:
return videobuf_streamon(file,&dev->ts.ts);
return videobuf_streamon(file->private_data,&dev->ts.ts);
case VIDIOC_STREAMOFF:
return videobuf_streamoff(file,&dev->ts.ts);
return videobuf_streamoff(file->private_data,&dev->ts.ts);
case VIDIOC_QUERYCTRL:
case VIDIOC_G_CTRL:
......
/*
* $Id: saa7134-tvaudio.c,v 1.13 2004/09/22 11:47:11 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...)
*
......@@ -56,9 +58,10 @@ MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with
#define print_regb(reg) printk("%s: reg 0x%03x [%-16s]: 0x%02x\n", \
dev->name,(SAA7134_##reg),(#reg),saa_readb((SAA7134_##reg)))
#define SCAN_INITIAL_DELAY (HZ)
#define SCAN_SAMPLE_DELAY (HZ/5)
#define SCAN_SUBCARRIER_DELAY (HZ*2)
/* msecs */
#define SCAN_INITIAL_DELAY 1000
#define SCAN_SAMPLE_DELAY 200
#define SCAN_SUBCARRIER_DELAY 2000
/* ------------------------------------------------------------------ */
/* saa7134 code */
......@@ -324,11 +327,11 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
add_wait_queue(&dev->thread.wq, &wait);
if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) {
if (timeout < 0) {
set_current_state(TASK_INTERRUPTIBLE);
if (timeout < 0)
schedule();
else
schedule_timeout(timeout);
} else
msleep_interruptible(timeout);
}
remove_wait_queue(&dev->thread.wq, &wait);
return dev->thread.scan1 != dev->thread.scan2;
......@@ -602,7 +605,7 @@ static int tvaudio_thread(void *data)
lastmode = 42;
for (;;) {
if (tvaudio_sleep(dev,5*HZ))
if (tvaudio_sleep(dev,5000))
goto restart;
if (dev->thread.shutdown || signal_pending(current))
break;
......@@ -735,6 +738,7 @@ static int getstereo_7133(struct saa7134_dev *dev)
static int mute_input_7133(struct saa7134_dev *dev)
{
u32 reg = 0;
int mask;
switch (dev->input->amux) {
case TV: reg = 0x02; break;
......@@ -744,6 +748,14 @@ static int mute_input_7133(struct saa7134_dev *dev)
if (dev->ctl_mute)
reg = 0x07;
saa_writel(0x594 >> 2, reg);
/* switch gpio-connected external audio mux */
if (0 != card(dev).gpiomask) {
mask = card(dev).gpiomask;
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio);
saa7134_track_gpio(dev,dev->input->name);
}
return 0;
}
......@@ -777,7 +789,10 @@ static int tvaudio_thread_ddep(void *data)
/* insmod option override */
norms = (audio_ddep << 2) | 0x01;
dprintk("ddep override: %s\n",stdres[audio_ddep]);
} else{
} else if (&card(dev).radio == dev->input) {
dprintk("FM Radio\n");
norms = (0x0f << 2) | 0x01;
} else {
/* (let chip) scan for sound carrier */
norms = 0;
if (dev->tvnorm->id & V4L2_STD_PAL) {
......@@ -810,7 +825,7 @@ static int tvaudio_thread_ddep(void *data)
saa_dsp_writel(dev, 0x464 >> 2, 0x000000);
saa_dsp_writel(dev, 0x470 >> 2, 0x101010);
if (tvaudio_sleep(dev,3*HZ))
if (tvaudio_sleep(dev,3000))
goto restart;
value = saa_readl(0x528 >> 2) & 0xffffff;
......
/*
* $Id: saa7134-vbi.c,v 1.3 2004/09/23 13:58:19 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
*
......@@ -113,10 +115,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0;
}
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
struct saa7134_tvnorm *norm = dev->tvnorm;
......@@ -167,9 +169,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
}
static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev;
int llength,lines;
......@@ -188,18 +190,18 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0;
}
static void buffer_queue(struct file *file, struct videobuf_buffer *vb)
static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(dev,&dev->vbi_q,buf);
}
static void buffer_release(struct file *file, struct videobuf_buffer *vb)
static void buffer_release(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
......
/*
* $Id: saa7134-video.c,v 1.15 2004/10/11 14:53:13 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
*
......@@ -916,10 +918,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0;
}
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
unsigned int size;
......@@ -978,9 +980,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
}
static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
*size = fh->fmt->depth * fh->width * fh->height >> 3;
if (0 == *count)
......@@ -989,17 +991,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0;
}
static void buffer_queue(struct file *file, struct videobuf_buffer *vb)
static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(fh->dev,&fh->dev->video_q,buf);
}
static void buffer_release(struct file *file, struct videobuf_buffer *vb)
static void buffer_release(void *priv, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_fh *fh = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_dma_free(fh->dev,buf);
......@@ -1269,13 +1271,15 @@ video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (res_locked(fh->dev,RESOURCE_VIDEO))
return -EBUSY;
return videobuf_read_one(file, saa7134_queue(fh),
data, count, ppos);
return videobuf_read_one(file->private_data, saa7134_queue(fh),
data, count, ppos,
file->f_flags & O_NONBLOCK);
case V4L2_BUF_TYPE_VBI_CAPTURE:
if (!res_get(fh->dev,fh,RESOURCE_VBI))
return -EBUSY;
return videobuf_read_stream(file, saa7134_queue(fh),
data, count, ppos, 1);
return videobuf_read_stream(file->private_data, saa7134_queue(fh),
data, count, ppos, 1,
file->f_flags & O_NONBLOCK);
break;
default:
BUG();
......@@ -1290,7 +1294,8 @@ video_poll(struct file *file, struct poll_table_struct *wait)
struct videobuf_buffer *buf = NULL;
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type)
return videobuf_poll_stream(file, &fh->vbi, wait);
return videobuf_poll_stream(file, file->private_data,
&fh->vbi, wait);
if (res_check(fh,RESOURCE_VIDEO)) {
if (!list_empty(&fh->cap.stream))
......@@ -1303,11 +1308,11 @@ video_poll(struct file *file, struct poll_table_struct *wait)
up(&fh->cap.lock);
return POLLERR;
}
if (0 != fh->cap.ops->buf_prepare(file,fh->cap.read_buf,fh->cap.field)) {
if (0 != fh->cap.ops->buf_prepare(file->private_data,fh->cap.read_buf,fh->cap.field)) {
up(&fh->cap.lock);
return POLLERR;
}
fh->cap.ops->buf_queue(file,fh->cap.read_buf);
fh->cap.ops->buf_queue(file->private_data,fh->cap.read_buf);
fh->cap.read_off = 0;
}
up(&fh->cap.lock);
......@@ -1340,20 +1345,20 @@ static int video_release(struct inode *inode, struct file *file)
/* stop video capture */
if (res_check(fh, RESOURCE_VIDEO)) {
videobuf_streamoff(file,&fh->cap);
videobuf_streamoff(file->private_data,&fh->cap);
res_free(dev,fh,RESOURCE_VIDEO);
}
if (fh->cap.read_buf) {
buffer_release(file,fh->cap.read_buf);
buffer_release(file->private_data,fh->cap.read_buf);
kfree(fh->cap.read_buf);
}
/* stop vbi capture */
if (res_check(fh, RESOURCE_VBI)) {
if (fh->vbi.streaming)
videobuf_streamoff(file,&fh->vbi);
videobuf_streamoff(file->private_data,&fh->vbi);
if (fh->vbi.reading)
videobuf_read_stop(file,&fh->vbi);
videobuf_read_stop(file->private_data,&fh->vbi);
res_free(dev,fh,RESOURCE_VBI);
}
......@@ -2029,7 +2034,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
req.type = q->type;
req.count = gbuffers;
req.memory = V4L2_MEMORY_MMAP;
err = videobuf_reqbufs(file,q,&req);
err = videobuf_reqbufs(file->private_data,q,&req);
if (err < 0)
return err;
memset(mbuf,0,sizeof(*mbuf));
......@@ -2042,16 +2047,17 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
return 0;
}
case VIDIOC_REQBUFS:
return videobuf_reqbufs(file,saa7134_queue(fh),arg);
return videobuf_reqbufs(file->private_data,saa7134_queue(fh),arg);
case VIDIOC_QUERYBUF:
return videobuf_querybuf(saa7134_queue(fh),arg);
case VIDIOC_QBUF:
return videobuf_qbuf(file,saa7134_queue(fh),arg);
return videobuf_qbuf(file->private_data,saa7134_queue(fh),arg);
case VIDIOC_DQBUF:
return videobuf_dqbuf(file,saa7134_queue(fh),arg);
return videobuf_dqbuf(file->private_data,saa7134_queue(fh),arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON:
{
......@@ -2059,13 +2065,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
if (!res_get(dev,fh,res))
return -EBUSY;
return videobuf_streamon(file,saa7134_queue(fh));
return videobuf_streamon(file->private_data,saa7134_queue(fh));
}
case VIDIOC_STREAMOFF:
{
int res = saa7134_resource(fh);
err = videobuf_streamoff(file,saa7134_queue(fh));
err = videobuf_streamoff(file->private_data,saa7134_queue(fh));
if (err < 0)
return err;
res_free(dev,fh,res);
......
/*
* $Id: saa7134.h,v 1.20 2004/09/30 12:21:15 kraxel Exp $
*
* v4l2 device driver for philips saa7134 based TV cards
*
* (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
......@@ -159,6 +161,10 @@ struct saa7134_format {
#define SAA7134_BOARD_CINERGY200 38
#define SAA7134_BOARD_FLYTVPLATINUM 39
#define SAA7134_BOARD_VIDEOMATE_TV_PVR 40
#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS 41
#define SAA7134_BOARD_SABRENT_SBTTVFM 42
#define SAA7134_BOARD_ZOLID_XPERT_TV7134 43
#define SAA7134_EMPIRE_PCI_TV_RADIO_LE 44
#define SAA7134_INPUT_MAX 8
......@@ -434,7 +440,7 @@ struct saa7134_dev {
#define saa_setb(reg,bit) saa_andorb((reg),(bit),(bit))
#define saa_clearb(reg,bit) saa_andorb((reg),(bit),0)
#define saa_wait(d) { udelay(d); }
#define saa_wait(us) { udelay(us); }
/* ----------------------------------------------------------- */
/* saa7134-core.c */
......@@ -474,7 +480,8 @@ extern struct saa7134_board saa7134_boards[];
extern const unsigned int saa7134_bcount;
extern struct pci_device_id __devinitdata saa7134_pci_tbl[];
extern int saa7134_board_init(struct saa7134_dev *dev);
extern int saa7134_board_init1(struct saa7134_dev *dev);
extern int saa7134_board_init2(struct saa7134_dev *dev);
/* ----------------------------------------------------------- */
......
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