Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 69061 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.6.9-rc4.orig/drivers/media/video/tda9887.c (-5 / +30 lines)
Lines 6-11 Link Here
6
#include <linux/init.h>
6
#include <linux/init.h>
7
#include <linux/errno.h>
7
#include <linux/errno.h>
8
#include <linux/slab.h>
8
#include <linux/slab.h>
9
#include <linux/delay.h>
9
10
10
#include <media/audiochip.h>
11
#include <media/audiochip.h>
11
#include <media/tuner.h>
12
#include <media/tuner.h>
Lines 393-399 static int tda9887_set_insmod(struct tda Link Here
393
		else
394
		else
394
			buf[1] &= ~cQSS;
395
			buf[1] &= ~cQSS;
395
	}
396
	}
396
397
	
397
	if (adjust >= 0x00 && adjust < 0x20)
398
	if (adjust >= 0x00 && adjust < 0x20)
398
		buf[2] |= adjust;
399
		buf[2] |= adjust;
399
	return 0;
400
	return 0;
Lines 513-519 static int tda9887_status(struct tda9887 Link Here
513
{
514
{
514
	unsigned char buf[1];
515
	unsigned char buf[1];
515
	int rc;
516
	int rc;
516
517
	
517
	memset(buf,0,sizeof(buf));
518
	memset(buf,0,sizeof(buf));
518
        if (1 != (rc = i2c_master_recv(&t->client,buf,1)))
519
        if (1 != (rc = i2c_master_recv(&t->client,buf,1)))
519
                printk(PREFIX "i2c i/o error: rc == %d (should be 1)\n",rc);
520
                printk(PREFIX "i2c i/o error: rc == %d (should be 1)\n",rc);
Lines 534-539 static int tda9887_configure(struct tda9 Link Here
534
	tda9887_set_config(t,buf);
535
	tda9887_set_config(t,buf);
535
	tda9887_set_insmod(t,buf);
536
	tda9887_set_insmod(t,buf);
536
537
538
	if (t->std & V4L2_STD_SECAM_L) {
539
		/* secam fixup (FIXME: move this to tvnorms array?) */
540
		buf[1] &= ~cOutputPort2Inactive;
541
	}
542
537
	dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
543
	dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
538
		buf[1],buf[2],buf[3]);
544
		buf[1],buf[2],buf[3]);
539
	if (debug > 1)
545
	if (debug > 1)
Lines 543-550 static int tda9887_configure(struct tda9 Link Here
543
                printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc);
549
                printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc);
544
550
545
	if (debug > 2) {
551
	if (debug > 2) {
546
		set_current_state(TASK_INTERRUPTIBLE);
552
		msleep(1000);
547
		schedule_timeout(HZ);
548
		tda9887_status(t);
553
		tda9887_status(t);
549
	}
554
	}
550
	return 0;
555
	return 0;
Lines 565-571 static int tda9887_attach(struct i2c_ada Link Here
565
                return -ENOMEM;
570
                return -ENOMEM;
566
	memset(t,0,sizeof(*t));
571
	memset(t,0,sizeof(*t));
567
	t->client      = client_template;
572
	t->client      = client_template;
568
	t->std         = 0;;
573
	t->std         = 0;
569
	t->pinnacle_id = UNSET;
574
	t->pinnacle_id = UNSET;
570
        i2c_set_clientdata(&t->client, t);
575
        i2c_set_clientdata(&t->client, t);
571
        i2c_attach_client(&t->client);
576
        i2c_attach_client(&t->client);
Lines 712-717 tda9887_command(struct i2c_client *clien Link Here
712
	return 0;
717
	return 0;
713
}
718
}
714
719
720
static int tda9887_suspend(struct device * dev, u32 state, u32 level)
721
{
722
	dprintk("tda9887: suspend\n");
723
	return 0;
724
}
725
726
static int tda9887_resume(struct device * dev, u32 level)
727
{
728
	struct i2c_client *c = container_of(dev, struct i2c_client, dev);
729
	struct tda9887 *t = i2c_get_clientdata(c);
730
731
	dprintk("tda9887: resume\n");
732
	tda9887_configure(t);
733
	return 0;
734
}
735
715
/* ----------------------------------------------------------------------- */
736
/* ----------------------------------------------------------------------- */
716
737
717
static struct i2c_driver driver = {
738
static struct i2c_driver driver = {
Lines 722-727 static struct i2c_driver driver = { Link Here
722
        .attach_adapter = tda9887_probe,
743
        .attach_adapter = tda9887_probe,
723
        .detach_client  = tda9887_detach,
744
        .detach_client  = tda9887_detach,
724
        .command        = tda9887_command,
745
        .command        = tda9887_command,
746
	.driver = {
747
		.suspend = tda9887_suspend,
748
		.resume  = tda9887_resume,
749
	},
725
};
750
};
726
static struct i2c_client client_template =
751
static struct i2c_client client_template =
727
{
752
{
(-)linux-2.6.9-rc4.orig/drivers/media/video/tuner.c (-6 / +70 lines)
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
{
(-)linux-2.6.9-rc4.orig/include/media/tuner.h (+5 lines)
Lines 1-3 Link Here
1
1
/* 
2
/* 
2
    tuner.h - definition for different tuners
3
    tuner.h - definition for different tuners
3
4
Lines 69-77 Link Here
69
#define TUNER_PHILIPS_ATSC       42
70
#define TUNER_PHILIPS_ATSC       42
70
#define TUNER_PHILIPS_FM1236_MK3 43
71
#define TUNER_PHILIPS_FM1236_MK3 43
71
#define TUNER_PHILIPS_4IN1       44	/* ATI TV Wonder Pro - Conexant */
72
#define TUNER_PHILIPS_4IN1       44	/* ATI TV Wonder Pro - Conexant */
73
/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ 
72
#define TUNER_MICROTUNE_4049FM5  45
74
#define TUNER_MICROTUNE_4049FM5  45
73
#define TUNER_LG_NTSC_TAPE       47
75
#define TUNER_LG_NTSC_TAPE       47
74
#define TUNER_TNF_8831BGFF       48
76
#define TUNER_TNF_8831BGFF       48
77
#define TUNER_MICROTUNE_4042FI5  49	/* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */
78
#define TUNER_TCL_2002N          50
75
79
76
#define NOTUNER 0
80
#define NOTUNER 0
77
#define PAL     1	/* PAL_BG */
81
#define PAL     1	/* PAL_BG */
Lines 91-96 Link Here
91
#define Microtune 8
95
#define Microtune 8
92
#define HITACHI 9
96
#define HITACHI 9
93
#define Panasonic 10
97
#define Panasonic 10
98
#define TCL     11
94
99
95
#define TUNER_SET_TYPE               _IOW('t',1,int)    /* set tuner type */
100
#define TUNER_SET_TYPE               _IOW('t',1,int)    /* set tuner type */
96
#define TUNER_SET_TVFREQ             _IOW('t',2,int)    /* set tv freq */
101
#define TUNER_SET_TVFREQ             _IOW('t',2,int)    /* set tv freq */

Return to bug 69061