diff mbox

[02/21,media] tuner/xc2028: Fix frequency offset for radio mode.

Message ID 4E5E7E2B.90603@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Aug. 31, 2011, 6:32 p.m. UTC
Em 04-08-2011 04:14, Thierry Reding escreveu:
> In radio mode, no frequency offset is needed. While at it, split off the
> frequency offset computation for digital TV into a separate function.

Nah, it is better to keep the offset calculation there. there is already
a set_freq for DVB. breaking the frequency logic even further seems to
increase the driver's logic. Also, patch is simpler and easier to review.

The patch bellow seems to be better. On a quick review, I think that the 
	send_seq(priv, {0x00, 0x00})
sequence may be wrong. I suspect that the device is just discarding that,
but changing it needs more testing.

-

[media] tuner/xc2028: Fix frequency offset for radio mode

In radio mode, no frequency offset should be used.
  
Instead of taking Thierry's patch that creates a separate function
to calculate the digital offset, it seemed better to just keep
everything at the same place.

Reported-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thierry Reding Sept. 1, 2011, 5:10 a.m. UTC | #1
* Mauro Carvalho Chehab wrote:
> Em 04-08-2011 04:14, Thierry Reding escreveu:
> > In radio mode, no frequency offset is needed. While at it, split off the
> > frequency offset computation for digital TV into a separate function.
> 
> Nah, it is better to keep the offset calculation there. there is already
> a set_freq for DVB. breaking the frequency logic even further seems to
> increase the driver's logic. Also, patch is simpler and easier to review.

Okay, no problem. Feel free to replace the patch with yours.

> The patch bellow seems to be better. On a quick review, I think that the 
> 	send_seq(priv, {0x00, 0x00})
> sequence may be wrong. I suspect that the device is just discarding that,
> but changing it needs more testing.

I ran across that as well, but I didn't dare touch it because I wasn't sure
what the broader impact would be.

Thierry
Andrew Goff Sept. 1, 2011, 12:45 p.m. UTC | #2
Hi Thierry,

I have been having problems with the radio tuner in my leadtek 1800h 
card. This card has the xc2028 tuner. Using fmtools i would get an error 
message similar to - frequency out of range 0.0 - 0.0.

After seeing you patches at the beginning of last month I installed the 
recent drivers at the time and applied your patches. The frequency out 
of range error went away but the only sound I got was static. I then 
discovered the frequency is out by 2.7MHz, so if I want to listen to 
104.9 I need to tune the radio to 107.6.

On Ubuntu 10.04 the card works fine, the errors started when applying 
the recent V4L drivers that I require for another card.

Are you able to help resolve this problem and get this card working 
properly again.

Thanks

Andrew



On 1/09/2011 3:10 PM, Thierry Reding wrote:
> * Mauro Carvalho Chehab wrote:
>> Em 04-08-2011 04:14, Thierry Reding escreveu:
>>> In radio mode, no frequency offset is needed. While at it, split off the
>>> frequency offset computation for digital TV into a separate function.
>>
>> Nah, it is better to keep the offset calculation there. there is already
>> a set_freq for DVB. breaking the frequency logic even further seems to
>> increase the driver's logic. Also, patch is simpler and easier to review.
>
> Okay, no problem. Feel free to replace the patch with yours.
>
>> The patch bellow seems to be better. On a quick review, I think that the
>> 	send_seq(priv, {0x00, 0x00})
>> sequence may be wrong. I suspect that the device is just discarding that,
>> but changing it needs more testing.
>
> I ran across that as well, but I didn't dare touch it because I wasn't sure
> what the broader impact would be.
>
> Thierry
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mauro Carvalho Chehab Sept. 1, 2011, 2:31 p.m. UTC | #3
Em 01-09-2011 09:45, Andrew Goff escreveu:
> Hi Thierry,
> 
> I have been having problems with the radio tuner in my leadtek 1800h card. This card has the xc2028 tuner. Using fmtools i would get an error message similar to - frequency out of range 0.0 - 0.0.

This is due to a bug at the tuner core.

> After seeing you patches at the beginning of last month I installed the recent drivers at the time and applied your patches. The frequency out of range error went away but the only sound I got was static. I then discovered the frequency is out by 2.7MHz, so if I want to listen to 104.9 I need to tune the radio to 107.6.

Try to remove Thierry xc3028 patch. His patches were applied already at the main tree
(I applied them very early today).

> 
> On Ubuntu 10.04 the card works fine, the errors started when applying the recent V4L drivers that I require for another card.
> 
> Are you able to help resolve this problem and get this card working properly again.
> 
> Thanks
> 
> Andrew
> 
> 
> 
> On 1/09/2011 3:10 PM, Thierry Reding wrote:
>> * Mauro Carvalho Chehab wrote:
>>> Em 04-08-2011 04:14, Thierry Reding escreveu:
>>>> In radio mode, no frequency offset is needed. While at it, split off the
>>>> frequency offset computation for digital TV into a separate function.
>>>
>>> Nah, it is better to keep the offset calculation there. there is already
>>> a set_freq for DVB. breaking the frequency logic even further seems to
>>> increase the driver's logic. Also, patch is simpler and easier to review.
>>
>> Okay, no problem. Feel free to replace the patch with yours.
>>
>>> The patch bellow seems to be better. On a quick review, I think that the
>>>     send_seq(priv, {0x00, 0x00})
>>> sequence may be wrong. I suspect that the device is just discarding that,
>>> but changing it needs more testing.
>>
>> I ran across that as well, but I didn't dare touch it because I wasn't sure
>> what the broader impact would be.
>>
>> Thierry

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Sept. 2, 2011, 8:19 a.m. UTC | #4
* Andrew Goff wrote:
> Hi Thierry,
> 
> I have been having problems with the radio tuner in my leadtek 1800h
> card. This card has the xc2028 tuner. Using fmtools i would get an
> error message similar to - frequency out of range 0.0 - 0.0.
> 
> After seeing you patches at the beginning of last month I installed
> the recent drivers at the time and applied your patches. The
> frequency out of range error went away but the only sound I got was
> static. I then discovered the frequency is out by 2.7MHz, so if I
> want to listen to 104.9 I need to tune the radio to 107.6.
> 
> On Ubuntu 10.04 the card works fine, the errors started when
> applying the recent V4L drivers that I require for another card.
> 
> Are you able to help resolve this problem and get this card working
> properly again.

So you are saying that the card was previously working for you, but when you
apply the xc2028 patches from my series on top the tuning is off by 2.7 MHz?

I don't know the Leadtek 1800 at all, but perhaps it's actually compensating
for the offset before passing the frequency to the tuner?

Thierry
diff mbox

Patch

diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index b6b2868..3acbaa0 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -940,11 +940,16 @@  static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
 	 * that xc2028 will be in a safe state.
 	 * Maybe this might also be needed for DTV.
 	 */
-	if (new_type == V4L2_TUNER_ANALOG_TV) {
+	switch (new_type) {
+	case V4L2_TUNER_ANALOG_TV:
 		rc = send_seq(priv, {0x00, 0x00});
 
-		/* Analog modes require offset = 0 */
-	} else {
+		/* Analog mode requires offset = 0 */
+		break;
+	case V4L2_TUNER_RADIO:
+		/* Radio mode requires offset = 0 */
+		break;
+	case V4L2_TUNER_DIGITAL_TV:
 		/*
 		 * Digital modes require an offset to adjust to the
 		 * proper frequency. The offset depends on what