Commit 055c508e authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] tv tuner driver update

This is a update for the tv tuner module.  It makes the descriptions
more verbose and also has some minor bugfixes + cleanups.
parent e028b61b
...@@ -101,10 +101,16 @@ static struct i2c_client client_template; ...@@ -101,10 +101,16 @@ static struct i2c_client client_template;
/* system switching for Philips FI1216MF MK2 /* system switching for Philips FI1216MF MK2
from datasheet "1996 Jul 09", from datasheet "1996 Jul 09",
standard BG L L'
picture carrier 38.90 38.90 33.95
colour 34.47 34.37 38.38
sound 1 33.40 32.40 40.45
sound 2 33.16 - -
NICAM 33.05 33.05 39.80
*/ */
#define PHILIPS_MF_SET_BG 0x01 /* Bit 2 must be zero, Bit 3 is system output */ #define PHILIPS_MF_SET_BG 0x01 /* Bit 2 must be zero, Bit 3 is system output */
#define PHILIPS_MF_SET_PAL_L 0x03 #define PHILIPS_MF_SET_PAL_L 0x03 // France
#define PHILIPS_MF_SET_PAL_L2 0x02 #define PHILIPS_MF_SET_PAL_L2 0x02 // L'
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -121,7 +127,9 @@ struct tunertype ...@@ -121,7 +127,9 @@ struct tunertype
unsigned char VHF_H; unsigned char VHF_H;
unsigned char UHF; unsigned char UHF;
unsigned char config; unsigned char config;
unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL, 732=16*45.75 NTSC */ unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL,
732 =16*45.75 NTSCi,
940 =58.75 NTSC-Japan */
}; };
/* /*
...@@ -132,16 +140,16 @@ struct tunertype ...@@ -132,16 +140,16 @@ struct tunertype
static struct tunertype tuners[] = { static struct tunertype tuners[] = {
{ "Temic PAL (4002 FH5)", TEMIC, PAL, { "Temic PAL (4002 FH5)", TEMIC, PAL,
16*140.25,16*463.25,0x02,0x04,0x01,0x8e,623}, 16*140.25,16*463.25,0x02,0x04,0x01,0x8e,623},
{ "Philips PAL_I", Philips, PAL_I, { "Philips PAL_I (FI1246 and compatibles)", Philips, PAL_I,
16*140.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, 16*140.25,16*463.25,0xa0,0x90,0x30,0x8e,623},
{ "Philips NTSC", Philips, NTSC, { "Philips NTSC (FI1236 and compatibles)", Philips, NTSC,
16*157.25,16*451.25,0xA0,0x90,0x30,0x8e,732}, 16*157.25,16*451.25,0xA0,0x90,0x30,0x8e,732},
{ "Philips SECAM", Philips, SECAM, { "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)", Philips, SECAM,
16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,623}, 16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,623},
{ "NoTuner", NoTuner, NOTUNER, { "NoTuner", NoTuner, NOTUNER,
0,0,0x00,0x00,0x00,0x00,0x00}, 0,0,0x00,0x00,0x00,0x00,0x00},
{ "Philips PAL", Philips, PAL, { "Philips PAL_BG (FI1216 and compatibles)", Philips, PAL,
16*168.25,16*447.25,0xA0,0x90,0x30,0x8e,623}, 16*168.25,16*447.25,0xA0,0x90,0x30,0x8e,623},
{ "Temic NTSC (4032 FY5)", TEMIC, NTSC, { "Temic NTSC (4032 FY5)", TEMIC, NTSC,
16*157.25,16*463.25,0x02,0x04,0x01,0x8e,732}, 16*157.25,16*463.25,0x02,0x04,0x01,0x8e,732},
...@@ -181,7 +189,7 @@ static struct tunertype tuners[] = { ...@@ -181,7 +189,7 @@ static struct tunertype tuners[] = {
16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732},
{ "Temic PAL/SECAM multi (4046 FM5)", TEMIC, PAL, { "Temic PAL/SECAM multi (4046 FM5)", TEMIC, PAL,
16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623},
{ "Philips PAL_DK", Philips, PAL, { "Philips PAL_DK (FI1256 and compatibles)", Philips, PAL,
16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623},
{ "Philips PAL/SECAM multi (FQ1216ME)", Philips, PAL, { "Philips PAL/SECAM multi (FQ1216ME)", Philips, PAL,
...@@ -200,7 +208,7 @@ static struct tunertype tuners[] = { ...@@ -200,7 +208,7 @@ static struct tunertype tuners[] = {
{ "Temic PAL* auto + FM (4009 FN5)", TEMIC, PAL, { "Temic PAL* auto + FM (4009 FN5)", TEMIC, PAL,
16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623},
{ "SHARP NTSC_JP (2U5JF5540)", SHARP, NTSC, /* 940=16*58.75 NTSC@Japan */ { "SHARP NTSC_JP (2U5JF5540)", SHARP, NTSC, /* 940=16*58.75 NTSC@Japan */
16*137.25,16*317.25,0x01,0x02,0x08,0x8e,940}, 16*137.25,16*317.25,0x01,0x02,0x08,0x8e,732 }, // Corrected to NTSC=732 (was:940)
{ "Samsung PAL TCPM9091PD27", Samsung, PAL, /* from sourceforge v3tv */ { "Samsung PAL TCPM9091PD27", Samsung, PAL, /* from sourceforge v3tv */
16*169,16*464,0xA0,0x90,0x30,0x8e,623}, 16*169,16*464,0xA0,0x90,0x30,0x8e,623},
...@@ -215,8 +223,10 @@ static struct tunertype tuners[] = { ...@@ -215,8 +223,10 @@ static struct tunertype tuners[] = {
16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732},
{ "LG PAL (newer TAPC series)", LGINNOTEK, PAL, { "LG PAL (newer TAPC series)", LGINNOTEK, PAL,
16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,623}, 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,623},
{ "Philips PAL/SECAM multi (FM1216ME)", Philips, PAL, { "Philips PAL/SECAM multi (FM1216ME MK3)", Philips, PAL,
16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 },
{ "LG NTSC (newer TAPC series)", LGINNOTEK, NTSC,
16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732},
}; };
#define TUNERS (sizeof(tuners)/sizeof(struct tunertype)) #define TUNERS (sizeof(tuners)/sizeof(struct tunertype))
...@@ -295,6 +305,13 @@ static int mt2032_init(struct i2c_client *c) ...@@ -295,6 +305,13 @@ static int mt2032_init(struct i2c_client *c)
} }
printk("\n "); printk("\n ");
} }
// Look for MT2032 id:
// part= 0x04(MT2032), 0x06(MT2030), 0x07(MT2040)
if((buf[0x11] != 0x4d) || (buf[0x12] != 0x54) || (buf[0x13] != 0x04)) {
printk("not a MT2032.\n");
return 0;
}
// Initialize Registers per spec. // Initialize Registers per spec.
buf[1]=2; // Index to register 2 buf[1]=2; // Index to register 2
...@@ -621,7 +638,7 @@ static void set_tv_freq(struct i2c_client *c, int freq) ...@@ -621,7 +638,7 @@ static void set_tv_freq(struct i2c_client *c, int freq)
/* tv norm specific stuff for multi-norm tuners */ /* tv norm specific stuff for multi-norm tuners */
switch (t->type) { switch (t->type) {
case TUNER_PHILIPS_SECAM: case TUNER_PHILIPS_SECAM: // FI1216MF
/* 0x01 -> ??? no change ??? */ /* 0x01 -> ??? no change ??? */
/* 0x02 -> PAL BDGHI / SECAM L */ /* 0x02 -> PAL BDGHI / SECAM L */
/* 0x04 -> ??? PAL others / SECAM others ??? */ /* 0x04 -> ??? PAL others / SECAM others ??? */
...@@ -751,7 +768,7 @@ static void set_radio_freq(struct i2c_client *c, int freq) ...@@ -751,7 +768,7 @@ static void set_radio_freq(struct i2c_client *c, int freq)
buffer[1] = div & 0xff; buffer[1] = div & 0xff;
buffer[2] = tun->config; buffer[2] = tun->config;
switch (t->type) { switch (t->type) {
case TUNER_PHILIPS_FM1216ME: case TUNER_PHILIPS_FM1216ME_MK3:
buffer[3] = 0x19; buffer[3] = 0x19;
break; break;
default: default:
...@@ -857,12 +874,14 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -857,12 +874,14 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* --- configuration --- */ /* --- configuration --- */
case TUNER_SET_TYPE: case TUNER_SET_TYPE:
if (t->type != -1) if (t->type != -1) {
printk("tuner: type already set\n");
return 0; return 0;
}
if (*iarg < 0 || *iarg >= TUNERS) if (*iarg < 0 || *iarg >= TUNERS)
return 0; return 0;
t->type = *iarg; t->type = *iarg;
dprintk("tuner: type set to %d (%s)\n", printk("tuner: type set to %d (%s)\n",
t->type,tuners[t->type].name); t->type,tuners[t->type].name);
strncpy(client->name, tuners[t->type].name, sizeof(client->name)); strncpy(client->name, tuners[t->type].name, sizeof(client->name));
if (t->type == TUNER_MT2032) if (t->type == TUNER_MT2032)
...@@ -965,7 +984,7 @@ static struct i2c_driver driver = { ...@@ -965,7 +984,7 @@ static struct i2c_driver driver = {
}; };
static struct i2c_client client_template = static struct i2c_client client_template =
{ {
name: "(unset)", name: "(tuner unset)",
flags: I2C_CLIENT_ALLOW_USE, flags: I2C_CLIENT_ALLOW_USE,
driver: &driver, driver: &driver,
}; };
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/ #define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/
#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/ #define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/
#define TUNER_LG_PAL_NEW_TAPC 37 #define TUNER_LG_PAL_NEW_TAPC 37
#define TUNER_PHILIPS_FM1216ME 38 #define TUNER_PHILIPS_FM1216ME_MK3 38
#define TUNER_LG_NTSC_NEW_TAPC 39
...@@ -84,7 +86,9 @@ ...@@ -84,7 +86,9 @@
#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */
#define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */
#define TUNER_SET_RADIOFREQ _IOW('t',3,int) /* set radio freq */ #if 0 /* obsolete */
#define TUNER_SET_MODE _IOW('t',4,int) /* set tuner mode */ # define TUNER_SET_RADIOFREQ _IOW('t',3,int) /* set radio freq */
# define TUNER_SET_MODE _IOW('t',4,int) /* set tuner mode */
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment