Skip to content

Commit

Permalink
V4L/DVB (11282): saa7134: add RDS support.
Browse files Browse the repository at this point in the history
The Terratec Cinergy 600 TV MK3 supports the RDS decoder saa6588.
Add support to saa7134 for such devices.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent ffe84b7 commit 2983baf
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/media/video/saa7134/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config VIDEO_SAA7134
select VIDEO_TUNER
select VIDEO_TVEEPROM
select CRC32
select VIDEO_SAA6588 if VIDEO_HELPER_CHIPS_AUTO
---help---
This is a video4linux driver for Philips SAA713x based
TV cards.
Expand Down
1 change: 1 addition & 0 deletions drivers/media/video/saa7134/saa7134-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,7 @@ struct saa7134_board saa7134_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
.rds_addr = 0x10,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{
.name = name_tv,
Expand Down
11 changes: 11 additions & 0 deletions drivers/media/video/saa7134/saa7134-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,17 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
sd->grp_id = GRP_EMPRESS;
}

if (saa7134_boards[dev->board].rds_addr) {
unsigned short addrs[2] = { 0, I2C_CLIENT_END };
struct v4l2_subdev *sd;

addrs[0] = saa7134_boards[dev->board].rds_addr;
sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa6588",
"saa6588", addrs);
if (sd)
printk(KERN_INFO "%s: found RDS decoder\n", dev->name);
}

request_submodules(dev);

v4l2_prio_init(&dev->prio);
Expand Down
37 changes: 37 additions & 0 deletions drivers/media/video/saa7134/saa7134-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
#include <media/rds.h>

/* ------------------------------------------------------------------ */

Expand Down Expand Up @@ -1462,6 +1463,7 @@ static int video_release(struct file *file)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_dev *dev = fh->dev;
struct rds_command cmd;
unsigned long flags;

/* turn off overlay */
Expand Down Expand Up @@ -1495,6 +1497,8 @@ static int video_release(struct file *file)
saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);

saa_call_all(dev, core, s_standby, 0);
if (fh->radio)
saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd);

/* free stuff */
videobuf_mmap_free(&fh->cap);
Expand All @@ -1515,6 +1519,37 @@ static int video_mmap(struct file *file, struct vm_area_struct * vma)
return videobuf_mmap_mapper(saa7134_queue(fh), vma);
}

static ssize_t radio_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_dev *dev = fh->dev;
struct rds_command cmd;

cmd.block_count = count/3;
cmd.buffer = data;
cmd.instance = file;
cmd.result = -ENODEV;

saa_call_all(dev, core, ioctl, RDS_CMD_READ, &cmd);

return cmd.result;
}

static unsigned int radio_poll(struct file *file, poll_table *wait)
{
struct saa7134_fh *fh = file->private_data;
struct saa7134_dev *dev = fh->dev;
struct rds_command cmd;

cmd.instance = file;
cmd.event_list = wait;
cmd.result = -ENODEV;
saa_call_all(dev, core, ioctl, RDS_CMD_POLL, &cmd);

return cmd.result;
}

/* ------------------------------------------------------------------ */

static int saa7134_try_get_set_fmt_vbi_cap(struct file *file, void *priv,
Expand Down Expand Up @@ -2439,8 +2474,10 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
static const struct v4l2_file_operations radio_fops = {
.owner = THIS_MODULE,
.open = video_open,
.read = radio_read,
.release = video_release,
.ioctl = video_ioctl2,
.poll = radio_poll,
};

static const struct v4l2_ioctl_ops radio_ioctl_ops = {
Expand Down
1 change: 1 addition & 0 deletions drivers/media/video/saa7134/saa7134.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ struct saa7134_board {
unsigned char tuner_addr;
unsigned char radio_addr;
unsigned char empress_addr;
unsigned char rds_addr;

unsigned int tda9887_conf;
unsigned int tuner_config;
Expand Down

0 comments on commit 2983baf

Please sign in to comment.