public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* saa7134 and RDS
@ 2009-03-02  4:33 Dmitri Belimov
  2009-03-04  0:43 ` hermann pitton
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitri Belimov @ 2009-03-02  4:33 UTC (permalink / raw)
  To: video4linux-list

Hi All.

I want use RDS on our TV cards. But now saa7134 not work with saa6588.
I found this old patch from Hans J. Koch. Why this patch is not in mercurial??
Yes I know that patch for v4l ver.1 and for old kernel. But why not?? 
v4l has other way for RDS on saa7134 boards?

I finally succeeded adding support for the saa6588 RDS decoder to the saa7134 
driver. I tested it with a Terratec Cinergy 600, and it seems to work. With 
the attached patch applied to saa7134-video.c, I can do

modprobe saa6588 xtal=1

and can then read RDS data from /dev/radio.

I'd be pleased if you could apply that patch.

Cheers,
Hans

Signed-off-by: Hans J. Koch <koch@xxxxxxxxx>

--- orig/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-video.c	2006-05-06 13:27:49.000000000 +0200
+++ mine/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-video.c	2006-05-05 14:38:11.000000000 +0200
@@ -31,6 +31,7 @@
 #include "saa7134-reg.h"
 #include "saa7134.h"
 #include <media/v4l2-common.h>
+#include <media/rds.h>
 
 #ifdef CONFIG_VIDEO_V4L1_COMPAT
 /* Include V4L1 specific functions. Should be removed soon */
@@ -1374,6 +1375,7 @@ static int video_release(struct inode *i
 	struct saa7134_fh  *fh  = file->private_data;
 	struct saa7134_dev *dev = fh->dev;
 	unsigned long flags;
+	struct rds_command cmd;
 
 	/* turn off overlay */
 	if (res_check(fh, RESOURCE_OVERLAY)) {
@@ -1409,6 +1411,7 @@ static int video_release(struct inode *i
 	saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
 
 	saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
+	saa7134_i2c_call_clients(dev, RDS_CMD_CLOSE, &cmd);
 
 	/* free stuff */
 	videobuf_mmap_free(&fh->cap);
@@ -2284,6 +2287,35 @@ static int radio_ioctl(struct inode *ino
 	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 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;
+
+	saa7134_i2c_call_clients(dev, 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;
+	saa7134_i2c_call_clients(dev, RDS_CMD_POLL, &cmd);
+
+	return cmd.result;
+}
+
 static struct file_operations video_fops =
 {
 	.owner	  = THIS_MODULE,
@@ -2305,6 +2337,8 @@ static struct file_operations radio_fops
 	.open	  = video_open,
 	.release  = video_release,
 	.ioctl	  = radio_ioctl,
+	.read	  = radio_read,
+	.poll	  = radio_poll,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
 	.compat_ioctl	= v4l_compat_ioctl32,
 #endif

--


With my best regards, Dmitry.

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: saa7134 and RDS
@ 2009-03-04 10:03 Hans Verkuil
  2009-03-04 12:02 ` Dmitri Belimov
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Verkuil @ 2009-03-04 10:03 UTC (permalink / raw)
  To: Hans J. Koch
  Cc: hermann pitton, Dmitri Belimov, Hans J. Koch,
	Hans-Jürgen Koch, video4linux-list, linux-media


> On Wed, Mar 04, 2009 at 01:43:08AM +0100, hermann pitton wrote:
>> Hi,
>>
>> Am Montag, den 02.03.2009, 13:33 +0900 schrieb Dmitri Belimov:
>> > Hi All.
>> >
>> > I want use RDS on our TV cards. But now saa7134 not work with saa6588.
>> > I found this old patch from Hans J. Koch. Why this patch is not in
>> mercurial??
>> > Yes I know that patch for v4l ver.1 and for old kernel. But why not??
>> > v4l has other way for RDS on saa7134 boards?
>>
>> I think the patch got lost, because it was not clear who should pull it
>> in. Likely Hartmut or Mauro would have picked it up in 2006 if pinged
>> directly.
>
> The main reason was that at that time there was a conflict with the i2c
> ir keyboard driver. I couldn't fix it immediately and was occupied with
> different things afterwards. I don't know if saa7134 i2c got fixed
> in the meantime.
>
>>
>> Please try to work with Hans to get it in now. There was also a
>> suggestion to add a has_rds capability flag and about how to deal with
>> different RDS decoders later, IIRC.
>
> Right. We should have a flag you could set to something like
>   .has_rds = RDS_SAA6588
> so that the rds driver could be loaded automagically.
>
> But I'm afraid I cannot spend much time on this work ATM, sorry.
>
> Thanks,
> Hans

Dmitri,

I have a patch pending to fix this for the saa7134 driver. The i2c
problems are resolved, so this shouldn't be a problem anymore.

The one thing that is holding this back is that I first want to finalize
the RFC regarding the RDS support. I posted an RFC a few weeks ago, but I
need to make a second version and for that I need to do a bit of research
into the US version of RDS. And I haven't found the time to do that yet.

I'll see if I can get the patch merged anyway.

Regards,

        Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: saa7134 and RDS
@ 2009-03-05 12:07 Hans Verkuil
  2009-03-05 16:36 ` Hans Verkuil
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Verkuil @ 2009-03-05 12:07 UTC (permalink / raw)
  To: Dmitri Belimov
  Cc: Hans J. Koch, hermann pitton, Hans J. Koch, video4linux-list,
	linux-media


> Hi Hans
>
> I build fresh video4linux with your patch and my config for our cards.
> In a dmesg i see : found RDS decoder.
> cat /dev/radio0 give me some slow junk data. Is this RDS data??
> Have you any tools for testing RDS?
> I try build rdsd from Hans J. Koch, but build crashed with:
>
> rdshandler.cpp: In member function ‘void
> std::RDShandler::delete_client(std::RDSclient*)’:
> rdshandler.cpp:363: error: no matching function for call to
> ‘find(__gnu_cxx::__normal_iterator<std::RDSclient**,
> std::vector<std::RDSclient*, std::allocator<std::RDSclient*> > >,
> __gnu_cxx::__normal_iterator<std::RDSclient**,
> std::vector<std::RDSclient*, std::allocator<std::RDSclient*> > >,
> std::RDSclient*&)’

Ah yes, that's right. I had to hack the C++ source to make this compile.
I'll see if I can post a patch for this tonight.

          Hans

> P.S. Debian Lenny.
>
> With my best regards, Dmitry.
>
>> On Wednesday 04 March 2009 13:02:46 Dmitri Belimov wrote:
>> > > Dmitri,
>> > >
>> > > I have a patch pending to fix this for the saa7134 driver. The i2c
>> > > problems are resolved, so this shouldn't be a problem anymore.
>> >
>> > Good news!
>> >
>> > > The one thing that is holding this back is that I first want to
>> > > finalize the RFC regarding the RDS support. I posted an RFC a few
>> > > weeks ago, but I need to make a second version and for that I
>> > > need to do a bit of research into the US version of RDS. And I
>> > > haven't found the time to do that yet.
>> >
>> > Yes, I found your discussion in linux-media mailing list. If you
>> > need any information from chip vendor I'll try find. I can get it
>> > under NDA and help you.
>> >
>> > > I'll see if I can get the patch merged anyway.
>>
>> I've attached my patch for the saa7134. I want to wait with the final
>> pull request until I've finished the RDS RFC, but this gives you
>> something to play with.
>>
>> Regards,
>>
>> 	Hans
>>
>> --
>> Hans Verkuil - video4linux developer - sponsored by TANDBERG
>
>


-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-03-10  8:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02  4:33 saa7134 and RDS Dmitri Belimov
2009-03-04  0:43 ` hermann pitton
2009-03-04  9:32   ` Hans J. Koch
  -- strict thread matches above, loose matches on Subject: below --
2009-03-04 10:03 Hans Verkuil
2009-03-04 12:02 ` Dmitri Belimov
2009-03-04 17:45   ` Hans Verkuil
2009-03-05 12:01     ` Dmitri Belimov
2009-03-07  1:50       ` Hans J. Koch
2009-03-05 12:07 Hans Verkuil
2009-03-05 16:36 ` Hans Verkuil
2009-03-07  1:55   ` Hans J. Koch
2009-03-07  8:54     ` Hans Verkuil
2009-03-07  9:02       ` Dmitri Belimov
2009-03-07  9:19         ` Hans Verkuil
2009-03-10  2:49           ` Dmitri Belimov
2009-03-10  7:17             ` Hans Verkuil
2009-03-10  8:04               ` Dmitri Belimov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox