aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-driver.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-09-09 13:03:39 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 13:57:49 -0700
commit24a70fdce872d70171b1f49dcd1a7c3a4e8396b2 (patch)
treeb640622565ce6a49befd142ca6770d20caafea82 /drivers/media/video/bttv-driver.c
parent[PATCH] v4l: common part Updates and tuner additions (diff)
downloadlinux-dev-24a70fdce872d70171b1f49dcd1a7c3a4e8396b2.tar.xz
linux-dev-24a70fdce872d70171b1f49dcd1a7c3a4e8396b2.zip
[PATCH] v4l: BTTV updates and card additions
- Remove $Id CVS logs for V4L files - Added DVICO FusionHDTV 5 Lite card. - Added Acorp Y878F. - CodingStyle fixes. - Added tuner_addr to bttv cards structure. - linux/version.h replaced by linux/utsname.h on bttvp.h - kernel module for acquiring RDS data from a SAA6588. - Allow multiple open() and reading calls to /dev/radio on bttv-driver.c - added i2c address for lgdt330x. Signed-off-by: Hans J. Koch <koch@hjk-az.de> Signed-off-by: Michael Krufky <mkrufky@m1k.net> 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>
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r--drivers/media/video/bttv-driver.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 087efb4dea09..53ecdbf46222 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,4 @@
/*
- $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $
bttv - Bt848 frame grabber driver
@@ -42,6 +41,9 @@
#include "bttvp.h"
+#include "rds.h"
+
+
unsigned int bttv_num; /* number of Bt848s in use */
struct bttv bttvs[BTTV_MAX];
@@ -3128,15 +3130,12 @@ static int radio_open(struct inode *inode, struct file *file)
dprintk("bttv%d: open called (radio)\n",btv->c.nr);
down(&btv->lock);
- if (btv->radio_user) {
- up(&btv->lock);
- return -EBUSY;
- }
+
btv->radio_user++;
+
file->private_data = btv;
- i2c_vidiocschan(btv);
- bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
+ bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
audio_mux(btv,AUDIO_RADIO);
up(&btv->lock);
@@ -3145,9 +3144,13 @@ static int radio_open(struct inode *inode, struct file *file)
static int radio_release(struct inode *inode, struct file *file)
{
- struct bttv *btv = file->private_data;
+ struct bttv *btv = file->private_data;
+ struct rds_command cmd;
btv->radio_user--;
+
+ bttv_call_i2c_clients(btv, RDS_CMD_CLOSE, &cmd);
+
return 0;
}
@@ -3203,13 +3206,42 @@ static int radio_ioctl(struct inode *inode, struct file *file,
return video_usercopy(inode, file, cmd, arg, radio_do_ioctl);
}
+static ssize_t radio_read(struct file *file, char __user *data,
+ size_t count, loff_t *ppos)
+{
+ struct bttv *btv = file->private_data;
+ struct rds_command cmd;
+ cmd.block_count = count/3;
+ cmd.buffer = data;
+ cmd.instance = file;
+ cmd.result = -ENODEV;
+
+ bttv_call_i2c_clients(btv, RDS_CMD_READ, &cmd);
+
+ return cmd.result;
+}
+
+static unsigned int radio_poll(struct file *file, poll_table *wait)
+{
+ struct bttv *btv = file->private_data;
+ struct rds_command cmd;
+ cmd.instance = file;
+ cmd.event_list = wait;
+ cmd.result = -ENODEV;
+ bttv_call_i2c_clients(btv, RDS_CMD_POLL, &cmd);
+
+ return cmd.result;
+}
+
static struct file_operations radio_fops =
{
.owner = THIS_MODULE,
.open = radio_open,
+ .read = radio_read,
.release = radio_release,
.ioctl = radio_ioctl,
.llseek = no_llseek,
+ .poll = radio_poll,
};
static struct video_device radio_template =