Bug 36552

Summary: Radio of ProVideo PV951, and other possible, is break of.
Product: v4l-dvb Reporter: Roman Savochenko (rom_as)
Component: bt8xxAssignee: Mauro Carvalho Chehab (mchehab)
Status: REOPENED ---    
Severity: high CC: alan, mchehab
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.2 Subsystem:
Regression: No Bisected commit-id:

Description Roman Savochenko 2011-06-02 19:14:33 UTC
From version 2.6.38 and 2.6.39 I am detected impossibility using radio for ProVideo PV951.
The TV tuner work fine and full on versions 2.6.30-2.6.32.

In dmesg, on 2.6.38, I see correct detect information:
[root@roman bt8xx]# dmesg | grep bttv
[    8.696808] bttv: driver version 0.9.18 loaded
[    8.696812] bttv: using 8 buffers with 2080k (520 pages) each for capture
[    8.696880] bttv: Bt8xx card found (0).
[    8.697273] bttv 0000:01:09.0: PCI INT A -> Link[APC2] -> GSI 17 (level, low) -> IRQ 17
[    8.697283] bttv0: Bt878 (rev 17) at 0000:01:09.0, irq: 17, latency: 32, mmio: 0xfdeff000
[    8.697317] bttv0: using: ProVideo PV951 [card=42,insmod option]
[    8.697362] bttv0: gpio: en=00000000, out=00000000 in=00ffffff [init]
[    8.697421] bttv0: tuner type=2
[    9.469224] bttv0: registered device video0
[    9.469276] bttv0: registered device vbi0
[    9.469323] bttv0: registered device radio0
[    9.484292] bttv0: PLL: 28636363 => 35468950 .. ok

But at send ioctl requests to /dev/radio0 I get errors: "Invalid argument", for VIDIOCGTUNER, VIDIOCGAUDIO.
Comment 1 Mauro Carvalho Chehab 2011-06-02 19:20:55 UTC
This is not a bug. The legacy V4L1 API were removed. You need to update your radio program to one that uses V4L2 API.
Comment 2 Roman Savochenko 2011-07-02 09:32:09 UTC
(In reply to comment #1)
> This is not a bug. The legacy V4L1 API were removed. You need to update your
> radio program to one that uses V4L2 API.
Thanks you for direction, you are right.
I have rewrited the code for gkrellm-radio module to V4L2 and it work fine up to kernel 2.6.38. But on last 2.6.39 I get other problem.
The function VIDIOC_G_TUNER return zero value for "rangelow" and "rangehigh" and radio do not work.

My VIDIOC_G_TUNER call code:
struct v4l2_tuner vt;
vt.index = 0;
if(ioctl(radio_fd, VIDIOC_G_TUNER, &vt) < 0) return;
fact = (vt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16;                                                                       
rangelow =  ((float)vt.rangelow)/fact;                                                                                          
rangehigh = ((float)vt.rangehigh)/fact;
Comment 3 Roman Savochenko 2011-07-28 11:20:49 UTC
For addition I call "v4l2-ctl -d /dev/radio --all -L" for different kernels:
---------- For kernels 2.6.32 - 2.6.38:-----------
Driver Info (not using libv4l2):
	Driver name   : bttv
	Card type     : BT878 radio (ProVideo PV951)
	Bus info      : PCI:0000:01:09.0
	Driver version: 0.9.18
	Capabilities  : 0x00010000
		Tuner
Video input : 0 (Radio: ok)
Audio input : 0 (Radio)
Frequency: 1622900 (101.431250 MHz)
Tuner:
	Name                 : Radio
	Capabilities         : 62.5 Hz stereo 
	Frequency range      : 65.0 MHz - 108.0 MHz
	Signal strength/AFC  : 25%/0
	Current audio mode   : stereo
	Available subchannels: stereo 
                           mute (bool) : default=0 value=1
-------------------------------------------------

---------- For kernels 2.6.39.2(3):-----------
Driver Info (not using libv4l2):
	Driver name   : bttv
	Card type     : BT878 radio (ProVideo PV951)
	Bus info      : PCI:0000:01:09.0
	Driver version: 0.9.18
	Capabilities  : 0x00010000
		Tuner
Video input : 0 (Radio: ok)
Audio input : 0 (Radio)
Frequency: 0 (0.000000 MHz)
Tuner:
	Name                 : Radio
	Capabilities         : 62.5 kHz 
	Frequency range      : 0.0 MHz - 0.0 MHz
	Signal strength/AFC  : 0%/0
	Current audio mode   : mono
	Available subchannels: 
                           mute (bool) : default=0 value=1
------------------------------------------------
Comment 4 Mauro Carvalho Chehab 2011-08-02 12:59:38 UTC
This is probably an already-fixed regression. The patches for it were at Kernel 3.0. Greg recently emailed the additions of those patches on his tree, so, they'll likely appear at the next 2.6.39 stable Kernel.

Could you please double check if everything is ok with 3.0 kernel?

Thanks!
Comment 5 Roman Savochenko 2011-08-05 19:44:21 UTC
(In reply to comment #4)
> Could you please double check if everything is ok with 3.0 kernel?
On kernel version 3.0.0 the bug also present now.
Comment 6 Roman Savochenko 2011-08-08 17:31:11 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Could you please double check if everything is ok with 3.0 kernel?
> On kernel version 3.0.0 the bug also present now.
And on 3.0.1 the bug present.
Comment 7 Roman Savochenko 2012-05-15 12:57:24 UTC
The problem appear by partial check for option "bttv radio=1". For that
option /dev/radio0 is created but checking for radio into function
check_mode() see only to device's flag ".has_radio", which clear for
"ProVideo PV951 (42)" card.

Replacing card to "Pace TV & Radio Card (101)" resolve the problem for me.

I think for fix that behavior need set flag ".has_radio" or RADIO mask
for flag "bttv radio=1".