[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-video
Subject:    Re: [PATCH 1/3] GemTek Radio card
From:       Trent Piepho <xyzzy () speakeasy ! org>
Date:       2007-07-29 21:50:12
Message-ID: Pine.LNX.4.58.0707291310370.15067 () shell2 ! speakeasy ! net
[Download RAW message or body]

On Sat, 28 Jul 2007, [ISO-8859-1] Pekka Seppänen wrote:
> Code cleanup for GemTek Radio card driver. Removed unnecessary / invalid
> I/O commands and rewrote code for tuning on-board BU2614FS chip. Adds
> several new module params for power users. Includes automatic device
> probing.

> +
> +module_param(io, int, 0644);
> +MODULE_PARM_DESC(io, "Force I/O port for the GemTek Radio card if

The permissions 0644 on the parameter mean that it can be changed at runtime
with sysfs.  Probably, that doesn't make sense for this parameter, since your
driver won't request the new io port region, so use 0444 permissions.

> +module_param(probe, bool, 0644);
> +MODULE_PARM_DESC(probe, "Enable automatic device probing. Note: only

Should be 0444, it makes no sense to turn auto probing on or off after the
driver has loaded.

> +module_param(shutdown, bool, 0644);
> +module_param(keepmuted, bool, 0644);

These are probably right.

> +module_param(initmute, bool, 0644);
> +MODULE_PARM_DESC(initmute, "Mute card when module is loaded.");

Maybe this should be 0444?

> +module_param(radio_nr, int, 0);

0444

> +	/* It works, just don't ask how. */
> +	/* freq = 78.25*((float)freq/16000.0 + 10.52); */
> +	freq /= 16;
> +	freq += 10520;
> +	freq *= 7825;
> +	freq /= 100000;

This looks like a typical PLL divisor calculation.  The normal form is
divisor = (frequency + IF offset) / ref frequency

IF offset is the intermediate frequency used by the demodulator and ref
frequency is the reference frequency used in the PLL's comparator.

> +	gemtek_bu2614_set(dev, BU2614_STDF, 2); /* 6.25 kHz */
> +	gemtek_bu2614_set(dev, BU2614_SWIN, 0); /* FM-mode */

I looked at the datasheets, and the PLL is using a reference frequency of 12.5
kHz.  STDF is selecting 6.25 kHz, and FM-mode doubles the frequency.

The CXA1538 datasheet seems to indicate that it uses a 10.7 MHz intermediate
frequency.  At least, the IF filters they specify have a 10.7 MHz center
frequency.

V4L2 uses 1/16th kHz units for the low frequency tuners like this.  So, try
this formula:

#define IF_OFFSET	((u32)(10.7*16000)) /* 10.7 MHz in 1/16 kHz units */
#define REF_FREQ	((u32)(12.5*16)     /* 12.5 kHz in 1/16 kHz units */

freq = (freq + IF_OFFSET + REF_FREQ/2) / REF_FREQ;

The formula you're using has an IF offset of 10.52 MHz and a ref frequency of
12.78 kHz.  You might try comparing the frequency you need to tune to get the
best reception to the official frequency of the radio station, and see what
formula works the best.  With several stations, you could use linear regression
to calculate the optimum values.

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic