Lines 129-135
struct tunertype
Link Here
|
129 |
unsigned char config; |
129 |
unsigned char config; |
130 |
unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL, |
130 |
unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL, |
131 |
732 =16*45.75 NTSCi, |
131 |
732 =16*45.75 NTSCi, |
132 |
940 =58.75 NTSC-Japan */ |
132 |
940 =16*58.75 NTSC-Japan |
|
|
133 |
704 =16*44 ATSC */ |
133 |
}; |
134 |
}; |
134 |
|
135 |
|
135 |
/* |
136 |
/* |
Lines 244-253
static struct tunertype tuners[] = {
Link Here
|
244 |
{ "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, |
245 |
{ "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, |
245 |
16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, |
246 |
16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, |
246 |
{ "LG NTSC (TAPE series)", LGINNOTEK, NTSC, |
247 |
{ "LG NTSC (TAPE series)", LGINNOTEK, NTSC, |
247 |
16*170.00, 16*450.00, 0x01,0x02,0x04,0x8e,732 }, |
248 |
16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
248 |
|
249 |
|
249 |
{ "Tenna TNF 8831 BGFF)", Philips, PAL, |
250 |
{ "Tenna TNF 8831 BGFF)", Philips, PAL, |
250 |
16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, |
251 |
16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, |
|
|
252 |
{ "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC, |
253 |
16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732}, |
254 |
{ "TCL 2002N", TCL, NTSC, |
255 |
16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732}, |
251 |
|
256 |
|
252 |
}; |
257 |
}; |
253 |
#define TUNERS ARRAY_SIZE(tuners) |
258 |
#define TUNERS ARRAY_SIZE(tuners) |
Lines 550-556
static void mt2032_set_tv_freq(struct i2
Link Here
|
550 |
// NTSC |
555 |
// NTSC |
551 |
from = 40750*1000; |
556 |
from = 40750*1000; |
552 |
to = 46750*1000; |
557 |
to = 46750*1000; |
553 |
if2 = 45750*1000; |
558 |
if2 = 45750*1000; |
554 |
} else { |
559 |
} else { |
555 |
// PAL |
560 |
// PAL |
556 |
from = 32900*1000; |
561 |
from = 32900*1000; |
Lines 854-860
static void default_set_tv_freq(struct i
Link Here
|
854 |
|
859 |
|
855 |
} else if (t->std & V4L2_STD_PAL_DK) { |
860 |
} else if (t->std & V4L2_STD_PAL_DK) { |
856 |
config |= TEMIC_SET_PAL_DK; |
861 |
config |= TEMIC_SET_PAL_DK; |
857 |
|
862 |
|
858 |
} else if (t->std & V4L2_STD_SECAM_L) { |
863 |
} else if (t->std & V4L2_STD_SECAM_L) { |
859 |
config |= TEMIC_SET_PAL_L; |
864 |
config |= TEMIC_SET_PAL_L; |
860 |
|
865 |
|
Lines 882-893
static void default_set_tv_freq(struct i
Link Here
|
882 |
/* 0x02 -> NTSC antenna input 1 */ |
887 |
/* 0x02 -> NTSC antenna input 1 */ |
883 |
/* 0x03 -> NTSC antenna input 2 */ |
888 |
/* 0x03 -> NTSC antenna input 2 */ |
884 |
config &= ~0x03; |
889 |
config &= ~0x03; |
885 |
if (t->std & V4L2_STD_ATSC) |
890 |
if (!(t->std & V4L2_STD_ATSC)) |
886 |
config |= 2; |
891 |
config |= 2; |
887 |
/* FIXME: input */ |
892 |
/* FIXME: input */ |
888 |
break; |
893 |
break; |
889 |
} |
|
|
890 |
|
894 |
|
|
|
895 |
case TUNER_MICROTUNE_4042FI5: |
896 |
/* Set the charge pump for fast tuning */ |
897 |
tun->config |= 0x40; |
898 |
break; |
899 |
} |
891 |
|
900 |
|
892 |
/* |
901 |
/* |
893 |
* Philips FI1216MK2 remark from specification : |
902 |
* Philips FI1216MK2 remark from specification : |
Lines 921-926
static void default_set_tv_freq(struct i
Link Here
|
921 |
if (4 != (rc = i2c_master_send(c,buffer,4))) |
930 |
if (4 != (rc = i2c_master_send(c,buffer,4))) |
922 |
printk("tuner: i2c i/o error: rc == %d (should be 4)\n",rc); |
931 |
printk("tuner: i2c i/o error: rc == %d (should be 4)\n",rc); |
923 |
|
932 |
|
|
|
933 |
if (t->type == TUNER_MICROTUNE_4042FI5) { |
934 |
// FIXME - this may also work for other tuners |
935 |
unsigned long timeout = jiffies + msecs_to_jiffies(1); |
936 |
u8 status_byte = 0; |
937 |
|
938 |
/* Wait until the PLL locks */ |
939 |
for (;;) { |
940 |
if (time_after(jiffies,timeout)) |
941 |
return; |
942 |
if (1 != (rc = i2c_master_recv(c,&status_byte,1))) { |
943 |
dprintk("tuner: i2c i/o read error: rc == %d (should be 1)\n",rc); |
944 |
break; |
945 |
} |
946 |
/* bit 6 is PLL locked indicator */ |
947 |
if (status_byte & 0x40) |
948 |
break; |
949 |
udelay(10); |
950 |
} |
951 |
|
952 |
/* Set the charge pump for optimized phase noise figure */ |
953 |
tun->config &= ~0x40; |
954 |
buffer[0] = (div>>8) & 0x7f; |
955 |
buffer[1] = div & 0xff; |
956 |
buffer[2] = tun->config; |
957 |
buffer[3] = config; |
958 |
dprintk("tuner: tv 0x%02x 0x%02x 0x%02x 0x%02x\n", |
959 |
buffer[0],buffer[1],buffer[2],buffer[3]); |
960 |
|
961 |
if (4 != (rc = i2c_master_send(c,buffer,4))) |
962 |
dprintk("tuner: i2c i/o error: rc == %d (should be 4)\n",rc); |
963 |
} |
924 |
} |
964 |
} |
925 |
|
965 |
|
926 |
static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) |
966 |
static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) |
Lines 1121-1126
static int tuner_attach(struct i2c_adapt
Link Here
|
1121 |
return 0; |
1161 |
return 0; |
1122 |
} |
1162 |
} |
1123 |
|
1163 |
|
|
|
1164 |
// #include <linux/pci.h> |
1165 |
|
1124 |
static int tuner_probe(struct i2c_adapter *adap) |
1166 |
static int tuner_probe(struct i2c_adapter *adap) |
1125 |
{ |
1167 |
{ |
1126 |
if (0 != addr) { |
1168 |
if (0 != addr) { |
Lines 1292-1297
tuner_command(struct i2c_client *client,
Link Here
|
1292 |
return 0; |
1334 |
return 0; |
1293 |
} |
1335 |
} |
1294 |
|
1336 |
|
|
|
1337 |
static int tuner_suspend(struct device * dev, u32 state, u32 level) |
1338 |
{ |
1339 |
dprintk("tuner: suspend\n"); |
1340 |
/* power down ??? */ |
1341 |
return 0; |
1342 |
} |
1343 |
|
1344 |
static int tuner_resume(struct device * dev, u32 level) |
1345 |
{ |
1346 |
struct i2c_client *c = container_of(dev, struct i2c_client, dev); |
1347 |
struct tuner *t = i2c_get_clientdata(c); |
1348 |
|
1349 |
dprintk("tuner: resume\n"); |
1350 |
if (t->freq) |
1351 |
set_freq(c,t->freq); |
1352 |
return 0; |
1353 |
} |
1354 |
|
1295 |
/* ----------------------------------------------------------------------- */ |
1355 |
/* ----------------------------------------------------------------------- */ |
1296 |
|
1356 |
|
1297 |
static struct i2c_driver driver = { |
1357 |
static struct i2c_driver driver = { |
Lines 1302-1307
static struct i2c_driver driver = {
Link Here
|
1302 |
.attach_adapter = tuner_probe, |
1362 |
.attach_adapter = tuner_probe, |
1303 |
.detach_client = tuner_detach, |
1363 |
.detach_client = tuner_detach, |
1304 |
.command = tuner_command, |
1364 |
.command = tuner_command, |
|
|
1365 |
.driver = { |
1366 |
.suspend = tuner_suspend, |
1367 |
.resume = tuner_resume, |
1368 |
}, |
1305 |
}; |
1369 |
}; |
1306 |
static struct i2c_client client_template = |
1370 |
static struct i2c_client client_template = |
1307 |
{ |
1371 |
{ |