4049FM5 lacks IF settings for TV and FM
0 answers - 4093 bytes -

Thierry MERLE a :
Hello all,
I saw that for SECAM L TV reception tuner-simple.c lacks some little
code to set TV norm. Furthermore, FM station reception was bad for the
same reason
So the aim of the patch is to add IF settings to get proper TV norm
and FM simply working. All is done in accordance of MT4049FM5 datasheet
Here is my patch proposal for tuner-simple.c against latest mercurial
version :
diff -up
2006-06-25
10:31:29.000000000 +0200
2006-06-25
10:37:35.000000000 +0200
@@ -151,6 +151,7 @@ static void default_set_tv_freq(struct i
u16 div;
struct tunertype *tun;
u8 buffer[4];
+ u8 buffer_if[6];
int rc, IFPCoff, i, j;
enum param_type desired_type;
@@ -304,6 +305,45 @@ static void default_set_tv_freq(struct i
c->addr = tuneraddr;
/* FIXME: input */
break;
+
+ case TUNER_MICRTUNE_4049FM5:
+ /* Set i2c IF to default PAL B/G TV-norm */
+ buffer_if[0] = 0x00;
+ buffer_if[1] = 0xD4;
+ buffer_if[2] = 0x01;
+ buffer_if[3] = 0x70;
+ buffer_if[4] = 0x02;
+ buffer_if[5] = 0x09;
+
+ if (t->std & V4L2_STD_PAL_DK) {
+ buffer_if[1] = 0xD4;
+ buffer_if[3] = 0x70;
+ buffer_if[5] = 0x0B;
+ } else if (t->std & V4L2_STD_PAL_I) {
+ buffer_if[1] = 0xD4;
+ buffer_if[3] = 0x70;
+ buffer_if[5] = 0x0A;
+ } else if (t->std & V4L2_STD_SECAM_L) {
+ buffer_if[1] = 0xC4;
+ buffer_if[3] = 0x10;
+ buffer_if[5] = 0x0B;
+ } else if (t->std & V4L2_STD_SECAM_LC) {
+ buffer_if[1] = 0x84;
+ buffer_if[3] = 0x10;
+ buffer_if[5] = 0x13;
+ }
+
+ /* set i2c IF to TV-norm */
+ tuneraddr = c->addr;
+ c->addr = 0x43;
+ if (2 != (rc = i2c_master_send(c,&buffer_if[0],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ if (2 != (rc = i2c_master_send(c,&buffer_if[2],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ if (2 != (rc = i2c_master_send(c,&buffer_if[4],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ c->addr = tuneraddr;
+ break;
}
if (tuners[t->type].params->cb_first_if_lower_freq && div <
t->last_div) {
@@ -361,6 +401,8 @@ static void default_set_radio_freq(struc
struct tunertype *tun;
struct tuner *t = i2c_get_clientdata(c);
u8 buffer[4];
+ u8 buffer_if[6];
+ u8 tuneraddr;
u16 div;
int rc, j;
enum param_type desired_type = TUNER_PARAM_TYPE_RADI;
@@ -402,6 +444,23 @@ static void default_set_radio_freq(struc
case TUNER_MICRTUNE_4049FM5:
div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */
buffer[3] = 0xa4;
+
+ /* Set i2c IF to configure tuner in FM mode */
+ buffer_if[0] = 0x00;
+ buffer_if[1] = 0xDC;
+ buffer_if[2] = 0x01;
+ buffer_if[3] = 0x10;
+ buffer_if[4] = 0x02;
+ buffer_if[5] = 0x1D;
+ tuneraddr = c->addr;
+ c->addr = 0x43;
+ if (2 != (rc = i2c_master_send(c,&buffer_if[0],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ if (2 != (rc = i2c_master_send(c,&buffer_if[2],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ if (2 != (rc = i2c_master_send(c,&buffer_if[4],2)))
+ tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
+ c->addr = tuneraddr;
break;
default:
buffer[3] = 0xa4;
--
Test it, hate it, tell me :)
I could not test it because usbvision driver seems to have problems
with the latest version of v4l. I tested sucessfully with the version
in 2.6.16.19.
Merlum (alias Thierry MERLE)
K I modified usbvision driver (that uses this tuner) and this patch
resolves the norm settings for my WinTV USB III peripheral.
It will solve all problems for video/radio tuning for several WinTV USB,
those based on MT4049FM5.
Can you integrate this patch into mercurial version or this is not so
simple ?
Thanks
P.S. : Something I forgot in my previous post (sorry this is my first
patch on v4l ml) :
Signed-off-by: Thierry MERLE <thierry merle free fr>