aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-29 05:26:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:47 -0400
commit2983baf8d6c1a564b6bbcc3e142f2e9408d9cbbe (patch)
tree2106263db61b44b4e278900714aca862730f4913
parentffe84b7a31bb39a26d74ff5a9ee921cd2c23e29c (diff)
V4L/DVB (11282): saa7134: add RDS support.
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>
-rw-r--r--drivers/media/video/saa7134/Kconfig1
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c11
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c37
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
5 files changed, 51 insertions, 0 deletions
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index a2089acb0309..0ba68987bfce 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -6,6 +6,7 @@ config VIDEO_SAA7134
6 select VIDEO_TUNER 6 select VIDEO_TUNER
7 select VIDEO_TVEEPROM 7 select VIDEO_TVEEPROM
8 select CRC32 8 select CRC32
9 select VIDEO_SAA6588 if VIDEO_HELPER_CHIPS_AUTO
9 ---help--- 10 ---help---
10 This is a video4linux driver for Philips SAA713x based 11 This is a video4linux driver for Philips SAA713x based
11 TV cards. 12 TV cards.
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 3a038133b260..a790a7246a63 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1704,6 +1704,7 @@ struct saa7134_board saa7134_boards[] = {
1704 .radio_type = UNSET, 1704 .radio_type = UNSET,
1705 .tuner_addr = ADDR_UNSET, 1705 .tuner_addr = ADDR_UNSET,
1706 .radio_addr = ADDR_UNSET, 1706 .radio_addr = ADDR_UNSET,
1707 .rds_addr = 0x10,
1707 .tda9887_conf = TDA9887_PRESENT, 1708 .tda9887_conf = TDA9887_PRESENT,
1708 .inputs = {{ 1709 .inputs = {{
1709 .name = name_tv, 1710 .name = name_tv,
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 4c24c9c7bb5b..dafa0d88bed0 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -990,6 +990,17 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
990 sd->grp_id = GRP_EMPRESS; 990 sd->grp_id = GRP_EMPRESS;
991 } 991 }
992 992
993 if (saa7134_boards[dev->board].rds_addr) {
994 unsigned short addrs[2] = { 0, I2C_CLIENT_END };
995 struct v4l2_subdev *sd;
996
997 addrs[0] = saa7134_boards[dev->board].rds_addr;
998 sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa6588",
999 "saa6588", addrs);
1000 if (sd)
1001 printk(KERN_INFO "%s: found RDS decoder\n", dev->name);
1002 }
1003
993 request_submodules(dev); 1004 request_submodules(dev);
994 1005
995 v4l2_prio_init(&dev->prio); 1006 v4l2_prio_init(&dev->prio);
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 6a4ae89a81a9..404f70eeb355 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -30,6 +30,7 @@
30#include "saa7134-reg.h" 30#include "saa7134-reg.h"
31#include "saa7134.h" 31#include "saa7134.h"
32#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
33#include <media/rds.h>
33 34
34/* ------------------------------------------------------------------ */ 35/* ------------------------------------------------------------------ */
35 36
@@ -1462,6 +1463,7 @@ static int video_release(struct file *file)
1462{ 1463{
1463 struct saa7134_fh *fh = file->private_data; 1464 struct saa7134_fh *fh = file->private_data;
1464 struct saa7134_dev *dev = fh->dev; 1465 struct saa7134_dev *dev = fh->dev;
1466 struct rds_command cmd;
1465 unsigned long flags; 1467 unsigned long flags;
1466 1468
1467 /* turn off overlay */ 1469 /* turn off overlay */
@@ -1495,6 +1497,8 @@ static int video_release(struct file *file)
1495 saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); 1497 saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
1496 1498
1497 saa_call_all(dev, core, s_standby, 0); 1499 saa_call_all(dev, core, s_standby, 0);
1500 if (fh->radio)
1501 saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd);
1498 1502
1499 /* free stuff */ 1503 /* free stuff */
1500 videobuf_mmap_free(&fh->cap); 1504 videobuf_mmap_free(&fh->cap);
@@ -1515,6 +1519,37 @@ static int video_mmap(struct file *file, struct vm_area_struct * vma)
1515 return videobuf_mmap_mapper(saa7134_queue(fh), vma); 1519 return videobuf_mmap_mapper(saa7134_queue(fh), vma);
1516} 1520}
1517 1521
1522static ssize_t radio_read(struct file *file, char __user *data,
1523 size_t count, loff_t *ppos)
1524{
1525 struct saa7134_fh *fh = file->private_data;
1526 struct saa7134_dev *dev = fh->dev;
1527 struct rds_command cmd;
1528
1529 cmd.block_count = count/3;
1530 cmd.buffer = data;
1531 cmd.instance = file;
1532 cmd.result = -ENODEV;
1533
1534 saa_call_all(dev, core, ioctl, RDS_CMD_READ, &cmd);
1535
1536 return cmd.result;
1537}
1538
1539static unsigned int radio_poll(struct file *file, poll_table *wait)
1540{
1541 struct saa7134_fh *fh = file->private_data;
1542 struct saa7134_dev *dev = fh->dev;
1543 struct rds_command cmd;
1544
1545 cmd.instance = file;
1546 cmd.event_list = wait;
1547 cmd.result = -ENODEV;
1548 saa_call_all(dev, core, ioctl, RDS_CMD_POLL, &cmd);
1549
1550 return cmd.result;
1551}
1552
1518/* ------------------------------------------------------------------ */ 1553/* ------------------------------------------------------------------ */
1519 1554
1520static int saa7134_try_get_set_fmt_vbi_cap(struct file *file, void *priv, 1555static int saa7134_try_get_set_fmt_vbi_cap(struct file *file, void *priv,
@@ -2439,8 +2474,10 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
2439static const struct v4l2_file_operations radio_fops = { 2474static const struct v4l2_file_operations radio_fops = {
2440 .owner = THIS_MODULE, 2475 .owner = THIS_MODULE,
2441 .open = video_open, 2476 .open = video_open,
2477 .read = radio_read,
2442 .release = video_release, 2478 .release = video_release,
2443 .ioctl = video_ioctl2, 2479 .ioctl = video_ioctl2,
2480 .poll = radio_poll,
2444}; 2481};
2445 2482
2446static const struct v4l2_ioctl_ops radio_ioctl_ops = { 2483static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 11396687b69c..a2dd326de5b9 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -333,6 +333,7 @@ struct saa7134_board {
333 unsigned char tuner_addr; 333 unsigned char tuner_addr;
334 unsigned char radio_addr; 334 unsigned char radio_addr;
335 unsigned char empress_addr; 335 unsigned char empress_addr;
336 unsigned char rds_addr;
336 337
337 unsigned int tda9887_conf; 338 unsigned int tda9887_conf;
338 unsigned int tuner_config; 339 unsigned int tuner_config;