* [patch] v4l: tuner update
@ 2005-01-20 15:26 Gerd Knorr
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Knorr @ 2005-01-20 15:26 UTC (permalink / raw)
To: Andrew Morton, Linux Kernel Mailing List
- add new tuner types.
- add support for digital tv tuning.
- make tda9887 output ports more configurable.
Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
drivers/media/video/tda9887.c | 38 +++++++++++++++------
drivers/media/video/tuner.c | 60 +++++++++++++++++++---------------
include/media/tuner.h | 8 +++-
3 files changed, 69 insertions(+), 37 deletions(-)
Index: linux-2.6.10/include/media/tuner.h
===================================================================
--- linux-2.6.10.orig/include/media/tuner.h 2004-12-29 23:57:53.000000000 +0100
+++ linux-2.6.10/include/media/tuner.h 2005-01-19 14:12:25.168221195 +0100
@@ -77,6 +77,7 @@
#define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */
#define TUNER_TCL_2002N 50
#define TUNER_PHILIPS_FM1256_IH3 51
+#define TUNER_THOMSON_DTT7610 52
#define NOTUNER 0
#define PAL 1 /* PAL_BG */
@@ -97,6 +98,7 @@
#define HITACHI 9
#define Panasonic 10
#define TCL 11
+#define THOMSON 12
#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */
#define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */
@@ -108,10 +110,12 @@
#define TDA9887_SET_CONFIG _IOW('t',5,int)
/* tv card specific */
# define TDA9887_PRESENT (1<<0)
-# define TDA9887_PORT1 (1<<1)
-# define TDA9887_PORT2 (1<<2)
+# define TDA9887_PORT1_INACTIVE (1<<1)
+# define TDA9887_PORT2_INACTIVE (1<<2)
# define TDA9887_QSS (1<<3)
# define TDA9887_INTERCARRIER (1<<4)
+# define TDA9887_PORT1_ACTIVE (1<<5)
+# define TDA9887_PORT2_ACTIVE (1<<6)
/* config options */
# define TDA9887_DEEMPHASIS_MASK (3<<16)
# define TDA9887_DEEMPHASIS_NONE (1<<16)
Index: linux-2.6.10/drivers/media/video/tuner.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/tuner.c 2004-12-30 00:00:10.000000000 +0100
+++ linux-2.6.10/drivers/media/video/tuner.c 2005-01-19 14:12:25.169221007 +0100
@@ -1,5 +1,5 @@
/*
- * $Id: tuner.c,v 1.31 2004/11/10 11:07:24 kraxel Exp $
+ * $Id: tuner.c,v 1.36 2005/01/14 13:29:40 kraxel Exp $
*/
#include <linux/module.h>
@@ -62,7 +62,7 @@ struct tuner {
v4l2_std_id std;
int using_v4l2;
- unsigned int radio;
+ enum v4l2_tuner_type mode;
unsigned int input;
// only for MT2032
@@ -265,6 +265,11 @@ static struct tunertype tuners[] = {
{ "Philips PAL/SECAM_D (FM 1256 I-H3)", Philips, PAL,
16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 },
+ { "Thomson DDT 7610 ATSC/NTSC)", THOMSON, ATSC,
+ 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732},
+ { "Philips FQ1286", Philips, NTSC,
+ 16*160.00,16*454.00,0x41,0x42,0x04,0x8e,940}, // UHF band untested
+
};
#define TUNERS ARRAY_SIZE(tuners)
@@ -663,7 +668,8 @@ static void mt2050_set_if_freq(struct i2
int ret;
unsigned char buf[6];
- dprintk("mt2050_set_if_freq freq=%d\n",freq);
+ dprintk("mt2050_set_if_freq freq=%d if1=%d if2=%d\n",
+ freq,if1,if2);
f_lo1=freq+if1;
f_lo1=(f_lo1/1000000)*1000000;
@@ -688,9 +694,10 @@ static void mt2050_set_if_freq(struct i2
div2a=(lo2/8)-1;
div2b=lo2-(div2a+1)*8;
- dprintk("lo1 lo2 = %d %d\n", lo1, lo2);
- dprintk("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",num1,num2,div1a,div1b,div2a,div2b);
-
+ if (debug > 1) {
+ printk("lo1 lo2 = %d %d\n", lo1, lo2);
+ printk("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",num1,num2,div1a,div1b,div2a,div2b);
+ }
buf[0]=1;
buf[1]= 4*div1b + num1;
@@ -702,7 +709,7 @@ static void mt2050_set_if_freq(struct i2
buf[5]=div2a;
if(num2!=0) buf[5]=buf[5]|0x40;
- if(debug) {
+ if (debug > 1) {
int i;
printk("bufs is: ");
for(i=0;i<6;i++)
@@ -727,6 +734,10 @@ static void mt2050_set_tv_freq(struct i2
// PAL
if2 = 38900*1000;
}
+ if (V4L2_TUNER_DIGITAL_TV == t->mode) {
+ // testing for DVB ...
+ if2 = 36150*1000;
+ }
mt2050_set_if_freq(c, freq*62500, if2);
mt2050_set_antenna(c, tv_antenna);
}
@@ -1069,14 +1080,18 @@ static void set_freq(struct i2c_client *
{
struct tuner *t = i2c_get_clientdata(c);
- if (t->radio) {
+ switch (t->mode) {
+ case V4L2_TUNER_RADIO:
dprintk("tuner: radio freq set to %lu.%02lu\n",
freq/16,freq%16*100/16);
set_radio_freq(c,freq);
- } else {
+ break;
+ case V4L2_TUNER_ANALOG_TV:
+ case V4L2_TUNER_DIGITAL_TV:
dprintk("tuner: tv freq set to %lu.%02lu\n",
freq/16,freq%16*100/16);
set_tv_freq(c, freq);
+ break;
}
t->freq = freq;
}
@@ -1237,9 +1252,9 @@ tuner_command(struct i2c_client *client,
set_type(client,*iarg,client->adapter->name);
break;
case AUDC_SET_RADIO:
- if (!t->radio) {
+ if (V4L2_TUNER_RADIO != t->mode) {
set_tv_freq(client,400 * 16);
- t->radio = 1;
+ t->mode = V4L2_TUNER_RADIO;
}
break;
case AUDC_CONFIG_PINNACLE:
@@ -1271,7 +1286,7 @@ tuner_command(struct i2c_client *client,
struct video_channel *vc = arg;
CHECK_V4L2;
- t->radio = 0;
+ t->mode = V4L2_TUNER_ANALOG_TV;
if (vc->norm < ARRAY_SIZE(map))
t->std = map[vc->norm];
tuner_fixup_std(t);
@@ -1292,7 +1307,7 @@ tuner_command(struct i2c_client *client,
struct video_tuner *vt = arg;
CHECK_V4L2;
- if (t->radio)
+ if (V4L2_TUNER_RADIO == t->mode)
vt->signal = tuner_signal(client);
return 0;
}
@@ -1301,7 +1316,7 @@ tuner_command(struct i2c_client *client,
struct video_audio *va = arg;
CHECK_V4L2;
- if (t->radio)
+ if (V4L2_TUNER_RADIO == t->mode)
va->mode = (tuner_stereo(client) ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO);
return 0;
}
@@ -1311,7 +1326,7 @@ tuner_command(struct i2c_client *client,
v4l2_std_id *id = arg;
SWITCH_V4L2;
- t->radio = 0;
+ t->mode = V4L2_TUNER_ANALOG_TV;
t->std = *id;
tuner_fixup_std(t);
if (t->freq)
@@ -1323,15 +1338,10 @@ tuner_command(struct i2c_client *client,
struct v4l2_frequency *f = arg;
SWITCH_V4L2;
- if (V4L2_TUNER_ANALOG_TV == f->type) {
- t->radio = 0;
- }
- if (V4L2_TUNER_RADIO == f->type) {
- if (!t->radio) {
- set_tv_freq(client,400*16);
- t->radio = 1;
- }
- }
+ if (V4L2_TUNER_RADIO == f->type &&
+ V4L2_TUNER_RADIO != t->mode)
+ set_tv_freq(client,400*16);
+ t->mode = f->type;
t->freq = f->frequency;
set_freq(client,t->freq);
break;
@@ -1341,7 +1351,7 @@ tuner_command(struct i2c_client *client,
struct v4l2_tuner *tuner = arg;
SWITCH_V4L2;
- if (t->radio)
+ if (V4L2_TUNER_RADIO == t->mode)
tuner->signal = tuner_signal(client);
break;
}
Index: linux-2.6.10/drivers/media/video/tda9887.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/tda9887.c 2004-12-29 23:59:46.000000000 +0100
+++ linux-2.6.10/drivers/media/video/tda9887.c 2005-01-19 14:12:25.169221007 +0100
@@ -1,4 +1,5 @@
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/types.h>
@@ -27,6 +28,7 @@
/* Addresses to scan */
static unsigned short normal_i2c[] = {
+ 0x84 >>1,
0x86 >>1,
0x96 >>1,
I2C_CLIENT_END,
@@ -374,8 +376,8 @@ static int tda9887_set_tvnorm(struct tda
return 0;
}
-static unsigned int port1 = 1;
-static unsigned int port2 = 1;
+static unsigned int port1 = UNSET;
+static unsigned int port2 = UNSET;
static unsigned int qss = UNSET;
static unsigned int adjust = 0x10;
module_param(port1, int, 0644);
@@ -385,10 +387,19 @@ module_param(adjust, int, 0644);
static int tda9887_set_insmod(struct tda9887 *t, char *buf)
{
- if (port1)
- buf[1] |= cOutputPort1Inactive;
- if (port2)
- buf[1] |= cOutputPort2Inactive;
+ if (UNSET != port1) {
+ if (port1)
+ buf[1] |= cOutputPort1Inactive;
+ else
+ buf[1] &= ~cOutputPort1Inactive;
+ }
+ if (UNSET != port2) {
+ if (port2)
+ buf[1] |= cOutputPort2Inactive;
+ else
+ buf[1] &= ~cOutputPort2Inactive;
+ }
+
if (UNSET != qss) {
if (qss)
buf[1] |= cQSS;
@@ -403,10 +414,15 @@ static int tda9887_set_insmod(struct tda
static int tda9887_set_config(struct tda9887 *t, char *buf)
{
- if (t->config & TDA9887_PORT1)
+ if (t->config & TDA9887_PORT1_ACTIVE)
+ buf[1] &= ~cOutputPort1Inactive;
+ if (t->config & TDA9887_PORT1_INACTIVE)
buf[1] |= cOutputPort1Inactive;
- if (t->config & TDA9887_PORT2)
+ if (t->config & TDA9887_PORT2_ACTIVE)
+ buf[1] &= ~cOutputPort2Inactive;
+ if (t->config & TDA9887_PORT2_INACTIVE)
buf[1] |= cOutputPort2Inactive;
+
if (t->config & TDA9887_QSS)
buf[1] |= cQSS;
if (t->config & TDA9887_INTERCARRIER)
@@ -437,14 +453,14 @@ static int tda9887_set_pinnacle(struct t
{
unsigned int bCarrierMode = UNSET;
- if (t->std & V4L2_STD_PAL) {
+ if (t->std & V4L2_STD_625_50) {
if ((1 == t->pinnacle_id) || (7 == t->pinnacle_id)) {
bCarrierMode = cIntercarrier;
} else {
bCarrierMode = cQSS;
}
}
- if (t->std & V4L2_STD_NTSC) {
+ if (t->std & V4L2_STD_525_60) {
if ((5 == t->pinnacle_id) || (6 == t->pinnacle_id)) {
bCarrierMode = cIntercarrier;
} else {
@@ -529,6 +545,8 @@ static int tda9887_configure(struct tda9
int rc;
memset(buf,0,sizeof(buf));
+ buf[1] |= cOutputPort1Inactive;
+ buf[1] |= cOutputPort2Inactive;
tda9887_set_tvnorm(t,buf);
if (UNSET != t->pinnacle_id) {
tda9887_set_pinnacle(t,buf);
--
#define printk(args...) fprintf(stderr, ## args)
^ permalink raw reply [flat|nested] 4+ messages in thread* [patch] v4l: tuner update
@ 2005-03-08 10:45 Gerd Knorr
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Knorr @ 2005-03-08 10:45 UTC (permalink / raw)
To: Andrew Morton, Linux Kernel Mailing List
Minor update for the tuner module: Add some new entries,
fix a bug in the tda8290 driver.
Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
drivers/media/video/mt20xx.c | 3 ++-
drivers/media/video/tda8290.c | 4 ++--
drivers/media/video/tuner-simple.c | 9 ++++++++-
include/media/tuner.h | 4 ++++
4 files changed, 16 insertions(+), 4 deletions(-)
Index: linux-2.6.11/include/media/tuner.h
===================================================================
--- linux-2.6.11.orig/include/media/tuner.h 2005-03-07 18:13:01.000000000 +0100
+++ linux-2.6.11/include/media/tuner.h 2005-03-08 10:32:50.000000000 +0100
@@ -93,6 +93,10 @@
#define TUNER_THOMSON_DTT7610 52
#define TUNER_PHILIPS_FQ1286 53
#define TUNER_PHILIPS_TDA8290 54
+#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */
+
+#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */
+#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */
#define NOTUNER 0
#define PAL 1 /* PAL_BG */
Index: linux-2.6.11/drivers/media/video/tuner-simple.c
===================================================================
--- linux-2.6.11.orig/drivers/media/video/tuner-simple.c 2005-03-07 18:13:01.000000000 +0100
+++ linux-2.6.11/drivers/media/video/tuner-simple.c 2005-03-08 10:32:50.000000000 +0100
@@ -1,5 +1,5 @@
/*
- * $Id: tuner-simple.c,v 1.4 2005/02/15 15:59:35 kraxel Exp $
+ * $Id: tuner-simple.c,v 1.10 2005/03/08 08:38:00 kraxel Exp $
*
* i2c tv tuner chip device driver
* controls all those simple 4-control-bytes style tuners.
@@ -204,6 +204,13 @@ static struct tunertype tuners[] = {
16*160.00,16*454.00,0x41,0x42,0x04,0x8e,940}, // UHF band untested
{ "tda8290+75", Philips,PAL|NTSC,
/* see tda8290.c for details */ },
+ { "LG PAL (TAPE series)", LGINNOTEK, PAL,
+ 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623},
+
+ { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL,
+ 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 },
+ { "Philips FQ1236A MK4", Philips, NTSC,
+ 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
};
unsigned const int tuner_count = ARRAY_SIZE(tuners);
Index: linux-2.6.11/drivers/media/video/mt20xx.c
===================================================================
--- linux-2.6.11.orig/drivers/media/video/mt20xx.c 2005-03-07 18:13:01.000000000 +0100
+++ linux-2.6.11/drivers/media/video/mt20xx.c 2005-03-07 18:13:02.000000000 +0100
@@ -1,5 +1,5 @@
/*
- * $Id: mt20xx.c,v 1.3 2005/02/15 15:59:35 kraxel Exp $
+ * $Id: mt20xx.c,v 1.4 2005/03/04 09:24:56 kraxel Exp $
*
* i2c tv tuner chip device driver
* controls microtune tuners, mt2032 + mt2050 at the moment.
@@ -7,6 +7,7 @@
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/videodev.h>
+#include <linux/moduleparam.h>
#include <media/tuner.h>
/* ---------------------------------------------------------------------- */
Index: linux-2.6.11/drivers/media/video/tda8290.c
===================================================================
--- linux-2.6.11.orig/drivers/media/video/tda8290.c 2005-03-07 18:13:01.000000000 +0100
+++ linux-2.6.11/drivers/media/video/tda8290.c 2005-03-07 18:13:02.000000000 +0100
@@ -1,5 +1,5 @@
/*
- * $Id: tda8290.c,v 1.5 2005/02/15 15:59:35 kraxel Exp $
+ * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $
*
* i2c tv tuner chip device driver
* controls the philips tda8290+75 tuner chip combo.
@@ -123,7 +123,7 @@ static int tda8290_tune(struct i2c_clien
struct i2c_msg easy_mode =
{ I2C_ADDR_TDA8290, 0, 2, t->i2c_easy_mode };
struct i2c_msg set_freq =
- { I2C_ADDR_TDA8290, 0, 8, t->i2c_set_freq };
+ { I2C_ADDR_TDA8275, 0, 8, t->i2c_set_freq };
i2c_transfer(c->adapter, &easy_mode, 1);
i2c_transfer(c->adapter, i2c_msg_prolog, ARRAY_SIZE(i2c_msg_prolog));
--
#define printk(args...) fprintf(stderr, ## args)
^ permalink raw reply [flat|nested] 4+ messages in thread* [patch] v4l: tuner update
@ 2004-10-22 12:51 Gerd Knorr
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Knorr @ 2004-10-22 12:51 UTC (permalink / raw)
To: Andrew Morton, Kernel List
Hi,
This is an update for the v4l tuner modules (tuner.o + tda9887.o).
Changes:
* fix two tuner config entries.
* switch insmod options to new 2.6-ish style.
* add suspend/resume functions.
The patch also removes all trailing whitespaces. I've a script
to remove them from my sources now, that should kill those no-op
whitespace changes in my patches after merging this initial cleanup.
Gerd
Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
drivers/media/video/tda9887.c | 31 +++++-
drivers/media/video/tuner.c | 169 ++++++++++++++++++++--------------
include/media/tuner.h | 2
3 files changed, 131 insertions(+), 71 deletions(-)
Index: linux-2004-10-20/include/media/tuner.h
===================================================================
--- linux-2004-10-20.orig/include/media/tuner.h 2004-10-21 11:44:59.000000000 +0200
+++ linux-2004-10-20/include/media/tuner.h 2004-10-21 14:59:24.000000000 +0200
@@ -1,5 +1,5 @@
-/*
+/*
tuner.h - definition for different tuners
Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
Index: linux-2004-10-20/drivers/media/video/tuner.c
===================================================================
--- linux-2004-10-20.orig/drivers/media/video/tuner.c 2004-10-21 11:45:23.000000000 +0200
+++ linux-2004-10-20/drivers/media/video/tuner.c 2004-10-21 15:38:19.311450244 +0200
@@ -1,4 +1,9 @@
+/*
+ * $Id: tuner.c,v 1.27 2004/10/20 09:43:34 kraxel Exp $
+ */
+
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
@@ -15,30 +20,34 @@
#include <media/tuner.h>
#include <media/audiochip.h>
-/* Addresses to scan */
+#define UNSET (-1U)
+
+/* standard i2c insmod options */
static unsigned short normal_i2c[] = {I2C_CLIENT_END};
static unsigned short normal_i2c_range[] = {0x60,0x6f,I2C_CLIENT_END};
I2C_CLIENT_INSMOD;
-#define UNSET (-1U)
-
-/* insmod options */
-static unsigned int debug = 0;
+/* insmod options used at init time => read/only */
static unsigned int type = UNSET;
static unsigned int addr = 0;
+module_param(type, int, 444);
+module_param(addr, int, 444);
+
+/* insmod options used at runtime => read/write */
+static unsigned int debug = 0;
+static unsigned int tv_antenna = 1;
+static unsigned int radio_antenna = 0;
+static unsigned int optimize_vco = 1;
+module_param(debug, int, 644);
+module_param(tv_antenna, int, 644);
+module_param(radio_antenna, int, 644);
+module_param(optimize_vco, int, 644);
+
static unsigned int tv_range[2] = { 44, 958 };
static unsigned int radio_range[2] = { 65, 108 };
-static unsigned int tv_antenna = 1;
-static unsigned int radio_antenna = 0;
-MODULE_PARM(debug,"i");
-MODULE_PARM(type,"i");
-MODULE_PARM(addr,"i");
-MODULE_PARM(tv_range,"2i");
-MODULE_PARM(radio_range,"2i");
-MODULE_PARM(tv_antenna,"i");
-MODULE_PARM(radio_antenna,"i");
-#define optimize_vco 1
+module_param_array(tv_range, int, NULL, 644);
+module_param_array(radio_range, int, NULL, 644);
MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
@@ -52,10 +61,10 @@ struct tuner {
unsigned int freq; /* keep track of the current settings */
v4l2_std_id std;
int using_v4l2;
-
+
unsigned int radio;
unsigned int input;
-
+
// only for MT2032
unsigned int xogc;
unsigned int radio_if2;
@@ -71,11 +80,11 @@ static struct i2c_client client_template
/* tv standard selection for Temic 4046 FM5
this value takes the low bits of control byte 2
- from datasheet Rev.01, Feb.00
+ from datasheet Rev.01, Feb.00
standard BG I L L2 D
picture IF 38.9 38.9 38.9 33.95 38.9
sound 1 33.4 32.9 32.4 40.45 32.4
- sound 2 33.16
+ sound 2 33.16
NICAM 33.05 32.348 33.05 33.05
*/
#define TEMIC_SET_PAL_I 0x05
@@ -97,7 +106,7 @@ static struct i2c_client client_template
#define PHILIPS_SET_PAL_I 0x01 /* Bit 2 always zero !*/
#define PHILIPS_SET_PAL_BGDK 0x09
#define PHILIPS_SET_PAL_L2 0x0a
-#define PHILIPS_SET_PAL_L 0x0b
+#define PHILIPS_SET_PAL_L 0x0b
/* system switching for Philips FI1216MF MK2
from datasheet "1996 Jul 09",
@@ -115,20 +124,20 @@ static struct i2c_client client_template
/* ---------------------------------------------------------------------- */
-struct tunertype
+struct tunertype
{
char *name;
unsigned char Vendor;
unsigned char Type;
-
+
unsigned short thresh1; /* band switch VHF_LO <=> VHF_HI */
unsigned short thresh2; /* band switch VHF_HI <=> UHF */
unsigned char VHF_L;
unsigned char VHF_H;
unsigned char UHF;
- unsigned char config;
- unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL,
- 732 =16*45.75 NTSCi,
+ unsigned char config;
+ unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL,
+ 732 =16*45.75 NTSCi,
940 =16*58.75 NTSC-Japan
704 =16*44 ATSC */
};
@@ -171,7 +180,7 @@ static struct tunertype tuners[] = {
{ "Alps TSBC5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */
16*133.25,16*351.25,0x01,0x02,0x08,0x8e,608},
{ "Temic PAL_BG (4006FH5)", TEMIC, PAL,
- 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623},
+ 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623},
{ "Alps TSCH6",Alps,NTSC,
16*137.25,16*385.25,0x14,0x12,0x11,0x8e,732},
@@ -245,14 +254,14 @@ static struct tunertype tuners[] = {
{ "Panasonic VP27s/ENGE4324D", Panasonic, NTSC,
16*160.00,16*454.00,0x01,0x02,0x08,0xce,940},
{ "LG NTSC (TAPE series)", LGINNOTEK, NTSC,
- 16*160.00,16*442.00,0x01,0x02,0x04,0xc8,732 },
+ 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
{ "Tenna TNF 8831 BGFF)", Philips, PAL,
16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623},
{ "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC,
16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732},
{ "TCL 2002N", TCL, NTSC,
- 16*172.00,16*448.00,0x01,0x02,0x08,0x88,732},
+ 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732},
};
#define TUNERS ARRAY_SIZE(tuners)
@@ -421,7 +430,7 @@ static int mt2032_compute_freq(unsigned
if(rfin >400*1000*1000)
buf[6]=0xe4;
else
- buf[6]=0xf4; // set PKEN per rev 1.2
+ buf[6]=0xf4; // set PKEN per rev 1.2
buf[7]=8+xogc;
buf[8]=0xc3; //reserved
buf[9]=0x4e; //reserved
@@ -442,10 +451,10 @@ static int mt2032_check_lo_lock(struct i
i2c_master_recv(c,buf,1);
dprintk("mt2032 Reg.E=0x%02x\n",buf[0]);
lock=buf[0] &0x06;
-
+
if (lock==6)
break;
-
+
dprintk("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]);
udelay(1000);
}
@@ -467,7 +476,7 @@ static int mt2032_optimize_vco(struct i2
if(tad1 ==1) return lock;
if(tad1==2) {
- if(sel==0)
+ if(sel==0)
return lock;
else sel--;
}
@@ -520,13 +529,13 @@ static void mt2032_set_if_freq(struct i2
// wait for PLLs to lock (per manual), retry LINT if not.
for(lint_try=0; lint_try<2; lint_try++) {
lock=mt2032_check_lo_lock(c);
-
+
if(optimize_vco)
lock=mt2032_optimize_vco(c,sel,lock);
if(lock==6) break;
-
- printk("mt2032: re-init PLLs by LINT\n");
- buf[0]=7;
+
+ printk("mt2032: re-init PLLs by LINT\n");
+ buf[0]=7;
buf[1]=0x80 +8+t->xogc; // set LINT to re-init PLLs
i2c_master_send(c,buf,2);
mdelay(10);
@@ -651,46 +660,46 @@ static void mt2050_set_if_freq(struct i2
unsigned int f_lo1,f_lo2,lo1,lo2,f_lo1_modulo,f_lo2_modulo,num1,num2,div1a,div1b,div2a,div2b;
int ret;
unsigned char buf[6];
-
+
dprintk("mt2050_set_if_freq freq=%d\n",freq);
-
+
f_lo1=freq+if1;
f_lo1=(f_lo1/1000000)*1000000;
-
+
f_lo2=f_lo1-freq-if2;
f_lo2=(f_lo2/50000)*50000;
-
+
lo1=f_lo1/4000000;
lo2=f_lo2/4000000;
-
+
f_lo1_modulo= f_lo1-(lo1*4000000);
f_lo2_modulo= f_lo2-(lo2*4000000);
-
+
num1=4*f_lo1_modulo/4000000;
num2=4096*(f_lo2_modulo/1000)/4000;
-
+
// todo spurchecks
-
+
div1a=(lo1/12)-1;
div1b=lo1-(div1a+1)*12;
-
+
div2a=(lo2/8)-1;
div2b=lo2-(div2a+1)*8;
-
+
dprintk("lo1 lo2 = %d %d\n", lo1, lo2);
dprintk("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",num1,num2,div1a,div1b,div2a,div2b);
-
-
+
+
buf[0]=1;
buf[1]= 4*div1b + num1;
if(freq<275*1000*1000) buf[1] = buf[1]|0x80;
-
+
buf[2]=div1a;
buf[3]=32*div2b + num2/256;
buf[4]=num2-(num2/256)*256;
buf[5]=div2a;
if(num2!=0) buf[5]=buf[5]|0x40;
-
+
if(debug) {
int i;
printk("bufs is: ");
@@ -698,7 +707,7 @@ static void mt2050_set_if_freq(struct i2
printk("%x ",buf[i]);
printk("\n");
}
-
+
ret=i2c_master_send(c,buf,6);
if (ret!=6)
printk("mt2050_set_if_freq failed with %d\n",ret);
@@ -708,7 +717,7 @@ static void mt2050_set_tv_freq(struct i2
{
struct tuner *t = i2c_get_clientdata(c);
unsigned int if2;
-
+
if (t->std & V4L2_STD_525_60) {
// NTSC
if2 = 45750*1000;
@@ -724,7 +733,7 @@ static void mt2050_set_radio_freq(struct
{
struct tuner *t = i2c_get_clientdata(c);
int if2 = t->radio_if2;
-
+
mt2050_set_if_freq(c, freq*62500, if2);
mt2050_set_antenna(c, radio_antenna);
}
@@ -734,19 +743,19 @@ static int mt2050_init(struct i2c_client
struct tuner *t = i2c_get_clientdata(c);
unsigned char buf[2];
int ret;
-
+
buf[0]=6;
buf[1]=0x10;
ret=i2c_master_send(c,buf,2); // power
-
+
buf[0]=0x0f;
buf[1]=0x0f;
ret=i2c_master_send(c,buf,2); // m1lo
-
+
buf[0]=0x0d;
ret=i2c_master_send(c,buf,1);
i2c_master_recv(c,buf,1);
-
+
dprintk("mt2050: sro is %x\n",buf[0]);
t->tv_freq = mt2050_set_tv_freq;
t->radio_freq = mt2050_set_radio_freq;
@@ -759,7 +768,7 @@ static int microtune_init(struct i2c_cli
char *name;
unsigned char buf[21];
int company_code;
-
+
memset(buf,0,sizeof(buf));
t->tv_freq = NULL;
t->radio_freq = NULL;
@@ -828,13 +837,17 @@ static void default_set_tv_freq(struct i
unsigned char buffer[4];
int rc;
- tun=&tuners[t->type];
- if (freq < tun->thresh1)
+ tun = &tuners[t->type];
+ if (freq < tun->thresh1) {
config = tun->VHF_L;
- else if (freq < tun->thresh2)
+ dprintk("tv: VHF lowrange\n");
+ } else if (freq < tun->thresh2) {
config = tun->VHF_H;
- else
+ dprintk("tv: VHF high range\n");
+ } else {
config = tun->UHF;
+ dprintk("tv: UHF range\n");
+ }
/* tv norm specific stuff for multi-norm tuners */
@@ -887,7 +900,7 @@ static void default_set_tv_freq(struct i
/* 0x02 -> NTSC antenna input 1 */
/* 0x03 -> NTSC antenna input 2 */
config &= ~0x03;
- if (t->std & V4L2_STD_ATSC)
+ if (!(t->std & V4L2_STD_ATSC))
config |= 2;
/* FIXME: input */
break;
@@ -897,7 +910,7 @@ static void default_set_tv_freq(struct i
tun->config |= 0x40;
break;
}
-
+
/*
* Philips FI1216MK2 remark from specification :
* for channel selection involving band switching, and to ensure
@@ -1131,7 +1144,7 @@ static int tuner_attach(struct i2c_adapt
if (this_adap > 0)
return -1;
this_adap++;
-
+
client_template.adapter = adap;
client_template.addr = addr;
@@ -1233,7 +1246,7 @@ tuner_command(struct i2c_client *client,
break;
}
break;
-
+
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
@@ -1328,7 +1341,25 @@ tuner_command(struct i2c_client *client,
/* nothing */
break;
}
-
+
+ return 0;
+}
+
+static int tuner_suspend(struct device * dev, u32 state, u32 level)
+{
+ dprintk("tuner: suspend\n");
+ /* FIXME: power down ??? */
+ return 0;
+}
+
+static int tuner_resume(struct device * dev, u32 level)
+{
+ struct i2c_client *c = container_of(dev, struct i2c_client, dev);
+ struct tuner *t = i2c_get_clientdata(c);
+
+ dprintk("tuner: resume\n");
+ if (t->freq)
+ set_freq(c,t->freq);
return 0;
}
@@ -1342,6 +1373,10 @@ static struct i2c_driver driver = {
.attach_adapter = tuner_probe,
.detach_client = tuner_detach,
.command = tuner_command,
+ .driver = {
+ .suspend = tuner_suspend,
+ .resume = tuner_resume,
+ },
};
static struct i2c_client client_template =
{
Index: linux-2004-10-20/drivers/media/video/tda9887.c
===================================================================
--- linux-2004-10-20.orig/drivers/media/video/tda9887.c 2004-10-21 11:46:23.000000000 +0200
+++ linux-2004-10-20/drivers/media/video/tda9887.c 2004-10-21 14:59:24.000000000 +0200
@@ -535,6 +535,11 @@ static int tda9887_configure(struct tda9
tda9887_set_config(t,buf);
tda9887_set_insmod(t,buf);
+ if (t->std & V4L2_STD_SECAM_L) {
+ /* secam fixup (FIXME: move this to tvnorms array?) */
+ buf[1] &= ~cOutputPort2Inactive;
+ }
+
dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
buf[1],buf[2],buf[3]);
if (debug > 1)
@@ -565,11 +570,11 @@ static int tda9887_attach(struct i2c_ada
return -ENOMEM;
memset(t,0,sizeof(*t));
t->client = client_template;
- t->std = 0;;
+ t->std = 0;
t->pinnacle_id = UNSET;
i2c_set_clientdata(&t->client, t);
i2c_attach_client(&t->client);
-
+
return 0;
}
@@ -618,7 +623,7 @@ tda9887_command(struct i2c_client *clien
t->radio = 1;
tda9887_configure(t);
break;
-
+
case AUDC_CONFIG_PINNACLE:
{
int *i = arg;
@@ -712,6 +717,22 @@ tda9887_command(struct i2c_client *clien
return 0;
}
+static int tda9887_suspend(struct device * dev, u32 state, u32 level)
+{
+ dprintk("tda9887: suspend\n");
+ return 0;
+}
+
+static int tda9887_resume(struct device * dev, u32 level)
+{
+ struct i2c_client *c = container_of(dev, struct i2c_client, dev);
+ struct tda9887 *t = i2c_get_clientdata(c);
+
+ dprintk("tda9887: resume\n");
+ tda9887_configure(t);
+ return 0;
+}
+
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
@@ -722,6 +743,10 @@ static struct i2c_driver driver = {
.attach_adapter = tda9887_probe,
.detach_client = tda9887_detach,
.command = tda9887_command,
+ .driver = {
+ .suspend = tda9887_suspend,
+ .resume = tda9887_resume,
+ },
};
static struct i2c_client client_template =
{
--
return -ENOSIG;
^ permalink raw reply [flat|nested] 4+ messages in thread* [patch] v4l: tuner update
@ 2004-09-16 9:10 Gerd Knorr
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Knorr @ 2004-09-16 9:10 UTC (permalink / raw)
To: Andrew Morton, Kernel List
Hi,
This is a update for the analof tv tuner module, it adds support for
two new tuner chips.
please apply,
Gerd
diff -up linux-2.6.9-rc2/drivers/media/video/tuner.c linux/drivers/media/video/tuner.c
--- linux-2.6.9-rc2/drivers/media/video/tuner.c 2004-09-14 10:37:22.000000000 +0200
+++ linux/drivers/media/video/tuner.c 2004-09-16 10:06:33.000000000 +0200
@@ -129,7 +129,8 @@ struct tunertype
unsigned char config;
unsigned short IFPCoff; /* 622.4=16*38.90 MHz PAL,
732 =16*45.75 NTSCi,
- 940 =58.75 NTSC-Japan */
+ 940 =16*58.75 NTSC-Japan
+ 704 =16*44 ATSC */
};
/*
@@ -244,10 +245,14 @@ static struct tunertype tuners[] = {
{ "Panasonic VP27s/ENGE4324D", Panasonic, NTSC,
16*160.00,16*454.00,0x01,0x02,0x08,0xce,940},
{ "LG NTSC (TAPE series)", LGINNOTEK, NTSC,
- 16*170.00, 16*450.00, 0x01,0x02,0x04,0x8e,732 },
+ 16*160.00,16*442.00,0x01,0x02,0x04,0xc8,732 },
{ "Tenna TNF 8831 BGFF)", Philips, PAL,
16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623},
+ { "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC,
+ 16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732},
+ { "TCL 2002N", TCL, NTSC,
+ 16*172.00,16*448.00,0x01,0x02,0x08,0x88,732},
};
#define TUNERS ARRAY_SIZE(tuners)
@@ -550,7 +555,7 @@ static void mt2032_set_tv_freq(struct i2
// NTSC
from = 40750*1000;
to = 46750*1000;
- if2 = 45750*1000;
+ if2 = 45750*1000;
} else {
// PAL
from = 32900*1000;
@@ -854,7 +859,7 @@ static void default_set_tv_freq(struct i
} else if (t->std & V4L2_STD_PAL_DK) {
config |= TEMIC_SET_PAL_DK;
-
+
} else if (t->std & V4L2_STD_SECAM_L) {
config |= TEMIC_SET_PAL_L;
@@ -886,8 +891,12 @@ static void default_set_tv_freq(struct i
config |= 2;
/* FIXME: input */
break;
- }
+ case TUNER_MICROTUNE_4042FI5:
+ /* Set the charge pump for fast tuning */
+ tun->config |= 0x40;
+ break;
+ }
/*
* Philips FI1216MK2 remark from specification :
@@ -921,6 +930,37 @@ static void default_set_tv_freq(struct i
if (4 != (rc = i2c_master_send(c,buffer,4)))
printk("tuner: i2c i/o error: rc == %d (should be 4)\n",rc);
+ if (t->type == TUNER_MICROTUNE_4042FI5) {
+ // FIXME - this may also work for other tuners
+ unsigned long timeout = jiffies + msecs_to_jiffies(1);
+ u8 status_byte = 0;
+
+ /* Wait until the PLL locks */
+ for (;;) {
+ if (time_after(jiffies,timeout))
+ return;
+ if (1 != (rc = i2c_master_recv(c,&status_byte,1))) {
+ dprintk("tuner: i2c i/o read error: rc == %d (should be 1)\n",rc);
+ break;
+ }
+ /* bit 6 is PLL locked indicator */
+ if (status_byte & 0x40)
+ break;
+ udelay(10);
+ }
+
+ /* Set the charge pump for optimized phase noise figure */
+ tun->config &= ~0x40;
+ buffer[0] = (div>>8) & 0x7f;
+ buffer[1] = div & 0xff;
+ buffer[2] = tun->config;
+ buffer[3] = config;
+ dprintk("tuner: tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ buffer[0],buffer[1],buffer[2],buffer[3]);
+
+ if (4 != (rc = i2c_master_send(c,buffer,4)))
+ dprintk("tuner: i2c i/o error: rc == %d (should be 4)\n",rc);
+ }
}
static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
diff -up linux-2.6.9-rc2/include/media/tuner.h linux/include/media/tuner.h
--- linux-2.6.9-rc2/include/media/tuner.h 2004-09-14 10:36:54.000000000 +0200
+++ linux/include/media/tuner.h 2004-09-16 10:06:33.000000000 +0200
@@ -1,3 +1,4 @@
+
/*
tuner.h - definition for different tuners
@@ -69,9 +70,12 @@
#define TUNER_PHILIPS_ATSC 42
#define TUNER_PHILIPS_FM1236_MK3 43
#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */
+/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */
#define TUNER_MICROTUNE_4049FM5 45
#define TUNER_LG_NTSC_TAPE 47
#define TUNER_TNF_8831BGFF 48
+#define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */
+#define TUNER_TCL_2002N 50
#define NOTUNER 0
#define PAL 1 /* PAL_BG */
@@ -91,6 +95,7 @@
#define Microtune 8
#define HITACHI 9
#define Panasonic 10
+#define TCL 11
#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */
#define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */
--
return -ENOSIG;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-03-08 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 15:26 [patch] v4l: tuner update Gerd Knorr
-- strict thread matches above, loose matches on Subject: below --
2005-03-08 10:45 Gerd Knorr
2004-10-22 12:51 Gerd Knorr
2004-09-16 9:10 Gerd Knorr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).