|
@@ -1,5 +1,4 @@
|
|
/*
|
|
/*
|
|
- $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $
|
|
|
|
|
|
|
|
bttv - Bt848 frame grabber driver
|
|
bttv - Bt848 frame grabber driver
|
|
|
|
|
|
@@ -42,6 +41,9 @@
|
|
|
|
|
|
#include "bttvp.h"
|
|
#include "bttvp.h"
|
|
|
|
|
|
|
|
+#include "rds.h"
|
|
|
|
+
|
|
|
|
+
|
|
unsigned int bttv_num; /* number of Bt848s in use */
|
|
unsigned int bttv_num; /* number of Bt848s in use */
|
|
struct bttv bttvs[BTTV_MAX];
|
|
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);
|
|
dprintk("bttv%d: open called (radio)\n",btv->c.nr);
|
|
down(&btv->lock);
|
|
down(&btv->lock);
|
|
- if (btv->radio_user) {
|
|
|
|
- up(&btv->lock);
|
|
|
|
- return -EBUSY;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
btv->radio_user++;
|
|
btv->radio_user++;
|
|
|
|
+
|
|
file->private_data = btv;
|
|
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);
|
|
audio_mux(btv,AUDIO_RADIO);
|
|
|
|
|
|
up(&btv->lock);
|
|
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)
|
|
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--;
|
|
btv->radio_user--;
|
|
|
|
+
|
|
|
|
+ bttv_call_i2c_clients(btv, RDS_CMD_CLOSE, &cmd);
|
|
|
|
+
|
|
return 0;
|
|
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);
|
|
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 =
|
|
static struct file_operations radio_fops =
|
|
{
|
|
{
|
|
.owner = THIS_MODULE,
|
|
.owner = THIS_MODULE,
|
|
.open = radio_open,
|
|
.open = radio_open,
|
|
|
|
+ .read = radio_read,
|
|
.release = radio_release,
|
|
.release = radio_release,
|
|
.ioctl = radio_ioctl,
|
|
.ioctl = radio_ioctl,
|
|
.llseek = no_llseek,
|
|
.llseek = no_llseek,
|
|
|
|
+ .poll = radio_poll,
|
|
};
|
|
};
|
|
|
|
|
|
static struct video_device radio_template =
|
|
static struct video_device radio_template =
|