diff mbox

tda18271 add FM filter selction + minor fixes

Message ID 20090914001447.GA15770@systol-ng.god.lan (mailing list archive)
State Superseded
Headers show

Commit Message

spam@systol-ng.god.lan Sept. 14, 2009, 12:14 a.m. UTC
This patch adds support for FM filter selection. The tda18271 has two rf
inputs RF_IN (45-864 MHz) and FM_IN (65-108 MHz). The code automatically
enables the antialiasing filter for radio reception and depending on the
FM input selected configures EB23 register.

Additional fixes:
- Fixed the temerature comensation, see revision history of TDA18271HD_4
  spec.
- Minor cosmetic change in the tda18271_rf_band[]
- Fixed one value and removed a duplicate in tda18271_cid_target[]

Signed-off-by: Henk.Vergonet@gmail.com

Comments

Michael Krufky Sept. 14, 2009, 12:33 p.m. UTC | #1
On Sun, Sep 13, 2009 at 8:14 PM,  <spam@systol-ng.god.lan> wrote:
>
> This patch adds support for FM filter selection. The tda18271 has two rf
> inputs RF_IN (45-864 MHz) and FM_IN (65-108 MHz). The code automatically
> enables the antialiasing filter for radio reception and depending on the
> FM input selected configures EB23 register.
>
> Additional fixes:
> - Fixed the temerature comensation, see revision history of TDA18271HD_4
>  spec.
> - Minor cosmetic change in the tda18271_rf_band[]
> - Fixed one value and removed a duplicate in tda18271_cid_target[]
>
> Signed-off-by: Henk.Vergonet@gmail.com
>
>

Henk,

Thank you for your patch.

I have some other tda18271 patches pending merge currently, so it will
be a few days before I'll be able to test and merge your patch.

In the meanwhile, I'd request that this single patch be broken down
into three separate patches, each with a description of the change and
sign-off.  I know that the patch you sent in is small, I just prefer
to apply changes separately.

Do you have FM radio working on the Zolid board after applying this?

Regards,

Mike
--
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
spam@systol-ng.god.lan Sept. 14, 2009, 3:10 p.m. UTC | #2
On Mon, Sep 14, 2009 at 08:33:46AM -0400, Michael Krufky wrote:
> On Sun, Sep 13, 2009 at 8:14 PM,  <spam@systol-ng.god.lan> wrote:
> >
> > This patch adds support for FM filter selection. The tda18271 has two rf
> > inputs RF_IN (45-864 MHz) and FM_IN (65-108 MHz). The code automatically
> > enables the antialiasing filter for radio reception and depending on the
> > FM input selected configures EB23 register.
> >
> > Additional fixes:
> > - Fixed the temerature comensation, see revision history of TDA18271HD_4
> > ?spec.
> > - Minor cosmetic change in the tda18271_rf_band[]
> > - Fixed one value and removed a duplicate in tda18271_cid_target[]
> >
> > Signed-off-by: Henk.Vergonet@gmail.com
> >
> >
> 
> Henk,
> 
> Thank you for your patch.
> 
> I have some other tda18271 patches pending merge currently, so it will
> be a few days before I'll be able to test and merge your patch.
> 
> In the meanwhile, I'd request that this single patch be broken down
> into three separate patches, each with a description of the change and
> sign-off.  I know that the patch you sent in is small, I just prefer
> to apply changes separately.
> 
Thats fine, I will wait for the pull in v4l-dvb and then redo the patches:
- FM filter selection
- Errata temerature compensation
- Table fixes

if thast ok.

> Do you have FM radio working on the Zolid board after applying this?

Unfortunately not yet, I get static noise with small 'ticks' at regular
intervals. It maybe the way I am testing. Currently I am using:

	mplayer radio://91.3/capture -nocache -rawaudio rate=32000 -radio \
		adevice=hw=1.0:arate=32000

to test.

I will try to see if a can solder some pin headers on the card so I can
use audio bypass to the sound card.

Thanks,

Henk
--
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
Michael Krufky Sept. 14, 2009, 3:21 p.m. UTC | #3
On Mon, Sep 14, 2009 at 11:10 AM,  <spam@systol-ng.god.lan> wrote:
> On Mon, Sep 14, 2009 at 08:33:46AM -0400, Michael Krufky wrote:
>> On Sun, Sep 13, 2009 at 8:14 PM,  <spam@systol-ng.god.lan> wrote:
>> >
>> > This patch adds support for FM filter selection. The tda18271 has two rf
>> > inputs RF_IN (45-864 MHz) and FM_IN (65-108 MHz). The code automatically
>> > enables the antialiasing filter for radio reception and depending on the
>> > FM input selected configures EB23 register.
>> >
>> > Additional fixes:
>> > - Fixed the temerature comensation, see revision history of TDA18271HD_4
>> > ?spec.
>> > - Minor cosmetic change in the tda18271_rf_band[]
>> > - Fixed one value and removed a duplicate in tda18271_cid_target[]
>> >
>> > Signed-off-by: Henk.Vergonet@gmail.com
>> >
>> >
>>
>> Henk,
>>
>> Thank you for your patch.
>>
>> I have some other tda18271 patches pending merge currently, so it will
>> be a few days before I'll be able to test and merge your patch.
>>
>> In the meanwhile, I'd request that this single patch be broken down
>> into three separate patches, each with a description of the change and
>> sign-off.  I know that the patch you sent in is small, I just prefer
>> to apply changes separately.
>>
> Thats fine, I will wait for the pull in v4l-dvb and then redo the patches:
> - FM filter selection
> - Errata temerature compensation
> - Table fixes
>
> if thast ok.
>
>> Do you have FM radio working on the Zolid board after applying this?
>
> Unfortunately not yet, I get static noise with small 'ticks' at regular
> intervals. It maybe the way I am testing. Currently I am using:
>
>        mplayer radio://91.3/capture -nocache -rawaudio rate=32000 -radio \
>                adevice=hw=1.0:arate=32000
>
> to test.
>
> I will try to see if a can solder some pin headers on the card so I can
> use audio bypass to the sound card.

Henk,

Don't wait for them to be merged to v4l-dvb -- Just work against the
tda18271 development repository:

http://kernellabs.com/hg/~mkrufky/tda18271

I maintain this driver, and I actually have some other fixes with
respect to rf tracking filter calibration / compensation that I have
yet to push.  I'm asking you to resend your patches so that I'll queue
them for the next tda18271 merge.

Regards,

Mike
--
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
spam@systol-ng.god.lan Sept. 14, 2009, 4:27 p.m. UTC | #4
On Mon, Sep 14, 2009 at 11:21:17AM -0400, Michael Krufky wrote:
> Don't wait for them to be merged to v4l-dvb -- Just work against the
> tda18271 development repository:
> 
> http://kernellabs.com/hg/~mkrufky/tda18271
> 
> I maintain this driver, and I actually have some other fixes with
> respect to rf tracking filter calibration / compensation that I have
> yet to push.  I'm asking you to resend your patches so that I'll queue
> them for the next tda18271 merge.

Done
--
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
diff mbox

Patch

diff -r 2b49813f8482 linux/drivers/media/common/tuners/tda18271-fe.c
--- a/linux/drivers/media/common/tuners/tda18271-fe.c	Thu Sep 03 09:06:34 2009 -0300
+++ b/linux/drivers/media/common/tuners/tda18271-fe.c	Mon Sep 14 01:45:49 2009 +0200
@@ -99,6 +99,22 @@ 
 	if (tda_fail(ret))
 		goto fail;
 
+	/* update FM filter selection */
+	if (map->std == 0) {
+		/* std == FM radio */
+		regs[R_EB23] |=  0x06; /* 1.5 Mhz cut-off freq */
+	} else if (map->fm_rfn) {
+		/* antenna FM_IN, std != FM radio */
+		regs[R_EB23] |=  0x04; /* set FORCELP */
+		regs[R_EB23] &= ~0x02; /* clear LP_FC */
+	} else {
+		/* antenna RF_IN, std != FM radio */
+		regs[R_EB23] &= ~0x06; /* clear FORCELP, LP_FC */
+	}
+	ret = tda18271_write_regs(fe, R_EB23, 1);
+	if (tda_fail(ret))
+		goto fail;
+
 	/* --------------------------------------------------------------- */
 
 	/* disable Power Level Indicator */
@@ -272,7 +288,7 @@ 
 	tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt);
 
 	/* calculate temperature compensation */
-	rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal);
+	rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal) / 1000;
 
 	regs[R_EB14] = approx + rfcal_comp;
 	ret = tda18271_write_regs(fe, R_EB14, 1);
diff -r 2b49813f8482 linux/drivers/media/common/tuners/tda18271-maps.c
--- a/linux/drivers/media/common/tuners/tda18271-maps.c	Thu Sep 03 09:06:34 2009 -0300
+++ b/linux/drivers/media/common/tuners/tda18271-maps.c	Mon Sep 14 01:45:49 2009 +0200
@@ -229,8 +229,8 @@ 
 static struct tda18271_map tda18271_rf_band[] = {
 	{ .rfmax =  47900, .val = 0x00 },
 	{ .rfmax =  61100, .val = 0x01 },
+	{ .rfmax = 121200, .val = 0x02 },
 /*	{ .rfmax = 152600, .val = 0x02 }, */
-	{ .rfmax = 121200, .val = 0x02 },
 	{ .rfmax = 164700, .val = 0x03 },
 	{ .rfmax = 203500, .val = 0x04 },
 	{ .rfmax = 457800, .val = 0x05 },
@@ -962,10 +962,10 @@ 
 static struct tda18271_cid_target_map tda18271_cid_target[] = {
 	{ .rfmax =  46000, .target = 0x04, .limit =  1800 },
 	{ .rfmax =  52200, .target = 0x0a, .limit =  1500 },
-	{ .rfmax =  79100, .target = 0x01, .limit =  4000 },
+	{ .rfmax =  70100, .target = 0x01, .limit =  4000 },
+/*	{ .rfmax =  79100, .target = 0x01, .limit =  4000 },	*/
 	{ .rfmax = 136800, .target = 0x18, .limit =  4000 },
 	{ .rfmax = 156700, .target = 0x18, .limit =  4000 },
-	{ .rfmax = 156700, .target = 0x18, .limit =  4000 },
 	{ .rfmax = 186250, .target = 0x0a, .limit =  4000 },
 	{ .rfmax = 230000, .target = 0x0a, .limit =  4000 },
 	{ .rfmax = 345000, .target = 0x18, .limit =  4000 },