summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-04-05 16:57:07 +0000
committerGerd Knorr <devnull@localhost>2004-04-05 16:57:07 +0000
commitf6e629e507a2c37232181f9f5d029422e65b1b20 (patch)
treea6d7c60c824c9dc221d34dc4f0e37fcce3c0a6bc
parent68ecec9ea3f3e0827fec88258e323cdc611e2308 (diff)
downloadmediapointer-dvb-s2-f6e629e507a2c37232181f9f5d029422e65b1b20.tar.gz
mediapointer-dvb-s2-f6e629e507a2c37232181f9f5d029422e65b1b20.tar.bz2
- added tda9887 debug code.
- scripts/saa7134.pl fix.
-rw-r--r--linux/drivers/media/video/tda9887.c152
-rw-r--r--v4l/scripts/cardlist2
-rw-r--r--v4l/scripts/saa7134.pl7
-rw-r--r--v4l/scripts/update1
4 files changed, 149 insertions, 13 deletions
diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c
index 448e8942c..2490d41e4 100644
--- a/linux/drivers/media/video/tda9887.c
+++ b/linux/drivers/media/video/tda9887.c
@@ -49,6 +49,7 @@ MODULE_LICENSE("GPL");
/* ---------------------------------------------------------------------- */
+#define PREFIX "tda9885/6/7: "
#define dprintk if (debug) printk
struct tda9887 {
@@ -62,6 +63,131 @@ static struct i2c_client client_template;
/* ---------------------------------------------------------------------- */
+#if 0
+static void dump_read_message(unsigned char *buf)
+{
+ static char *afc[16] = {
+ "- 12.5 kHz",
+ "- 37.5 kHz",
+ "- 62.5 kHz",
+ "- 87.5 kHz",
+ "-112.5 kHz",
+ "-137.5 kHz",
+ "-162.5 kHz",
+ "-187.5 kHz [mix]",
+ "+187.5 kHz [max]",
+ "+162.5 kHz",
+ "+137.5 kHz",
+ "+112.5 kHz",
+ "+ 87.5 kHz",
+ "+ 62.5 kHz",
+ "+ 37.5 kHz",
+ "+ 12.5 kHz",
+ };
+ printk(PREFIX "read: 0x%2x\n", buf[0]);
+ printk(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no");
+ printk(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]);
+ printk(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out");
+ printk(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low");
+}
+#endif
+
+static void dump_write_message(unsigned char *buf)
+{
+ static char *sound[4] = {
+ "AM/TV",
+ "FM/radio",
+ "FM/TV",
+ "FM/radio"
+ };
+ static char *adjust[32] = {
+ "-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
+ "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1",
+ "0", "+1", "+2", "+3", "+4", "+5", "+6", "+7",
+ "+8", "+9", "+10", "+11", "+12", "+13", "+14", "+15"
+ };
+ static char *deemph[4] = {
+ "no", "no", "75", "50"
+ };
+ static char *carrier[4] = {
+ "4.5 MHz",
+ "5.5 MHz",
+ "6.0 MHz",
+ "6.5 MHz / AM"
+ };
+ static char *vif[8] = {
+ "58.75 MHz",
+ "45.75 MHz",
+ "38.9 MHz",
+ "38.0 MHz",
+ "33.9 MHz",
+ "33.4 MHz",
+ "45.75 MHz + pin13",
+ "38.9 MHz + pin13",
+ };
+ static char *rif[4] = {
+ "44 MHz",
+ "52 MHz",
+ "52 MHz",
+ "44 MHz",
+ };
+
+ printk(PREFIX "write: byte B 0x%02x\n",buf[1]);
+ printk(" B0 video mode : %s\n",
+ (buf[1] & 0x01) ? "video trap" : "sound trap");
+ printk(" B1 auto mute fm : %s\n",
+ (buf[1] & 0x02) ? "yes" : "no");
+ printk(" B2 carrier mode : %s\n",
+ (buf[1] & 0x04) ? "QSS" : "Intercarrier");
+ printk(" B3-4 tv sound/radio : %s\n",
+ sound[(buf[1] & 0x18) >> 3]);
+ printk(" B5 force mute audio: %s\n",
+ (buf[1] & 0x20) ? "yes" : "no");
+ printk(" B6 output port 1 : %s\n",
+ (buf[1] & 0x40) ? "high" : "low");
+ printk(" B7 output port 2 : %s\n",
+ (buf[1] & 0x80) ? "high" : "low");
+
+ printk(PREFIX "write: byte C 0x%02x\n",buf[2]);
+ printk(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]);
+ printk(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]);
+ printk(" C7 audio gain : %s\n",
+ (buf[2] & 0x80) ? "-6" : "0");
+
+ printk(PREFIX "write: byte E 0x%02x\n",buf[3]);
+ printk(" E0-1 sound carrier : %s\n",
+ carrier[(buf[3] & 0x03)]);
+ printk(" E6 l pll ganting : %s\n",
+ (buf[3] & 0x40) ? "36" : "13");
+
+ if (buf[1] & 0x08) {
+ /* radio */
+ printk(" E2-4 video if : %s\n",
+ rif[(buf[3] & 0x0c) >> 2]);
+ printk(" E7 vif agc output : %s\n",
+ (buf[3] & 0x80)
+ ? ((buf[3] & 0x10) ? "fm-agc radio" : "sif-agc radio")
+ : "fm radio carrier afc");
+ } else {
+ /* video */
+ printk(" E2-4 video if : %s\n",
+ vif[(buf[3] & 0x1c) >> 2]);
+ printk(" E5 tuner gain : %s\n",
+ (buf[3] & 0x80)
+ ? ((buf[3] & 0x20) ? "external" : "normal")
+ : ((buf[3] & 0x20) ? "minimum" : "normal"));
+ printk(" E7 vif agc output : %s\n",
+ (buf[3] & 0x80)
+ ? ((buf[3] & 0x20)
+ ? "pin3 port, pin22 vif agc out"
+ : "pin22 port, pin3 vif acg ext in")
+ : "pin3+pin22 port");
+ }
+ printk("--\n");
+}
+
+/* ---------------------------------------------------------------------- */
+
//
// TDA defines
//
@@ -272,10 +398,12 @@ static int tda9887_miro(struct tda9887 *t)
cGating_18 | // E6: Gating (18%)
cAgcOutOFF; // E7: VAGC (off)
- dprintk("tda9885/6/7: 0x%02x 0x%02x 0x%02x [pinnacle_id=%d]\n",
+ dprintk(PREFIX "0x%02x 0x%02x 0x%02x [pinnacle_id=%d]\n",
bData[1],bData[2],bData[3],t->pinnacle_id);
+ if (debug > 1)
+ dump_write_message(bData);
if (4 != (rc = i2c_master_send(&t->client,bData,4)))
- printk("tda9885/6/7: i2c i/o error: rc == %d (should be 4)\n",rc);
+ printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc);
return 0;
}
@@ -299,11 +427,11 @@ static int tda9887_configure(struct tda9887 *t)
int rc;
if (t->radio) {
- dprintk("tda9885/6/7: FM Radio mode\n");
+ dprintk(PREFIX "FM Radio mode\n");
buf = buf_fm_stereo;
} else if (t->tvnorm == VIDEO_MODE_PAL) {
- dprintk("tda9885/6/7: PAL-%c mode\n",pal[0]);
+ dprintk(PREFIX "PAL-%c mode\n",pal[0]);
switch (pal[0]) {
case 'b':
case 'g':
@@ -322,27 +450,29 @@ static int tda9887_configure(struct tda9887 *t)
}
} else if (t->tvnorm == VIDEO_MODE_NTSC) {
- dprintk("tda9885/6/7: NTSC mode\n");
+ dprintk(PREFIX "NTSC mode\n");
buf = buf_ntsc;
} else if (t->tvnorm == VIDEO_MODE_SECAM) {
- dprintk("tda9885/6/7: SECAM mode\n");
+ dprintk(PREFIX "SECAM mode\n");
buf = buf_pal_l;
} else if (t->tvnorm == 6 /* BTTV hack */) {
- dprintk("tda9885/6/7: NTSC-Japan mode\n");
+ dprintk(PREFIX "NTSC-Japan mode\n");
buf = buf_ntsc_jp;
}
if (NULL == buf) {
- printk("tda9885/6/7 unknown norm=%d\n",t->tvnorm);
+ printk(PREFIX "unknown norm=%d\n",t->tvnorm);
return 0;
}
- dprintk("tda9885/6/7: 0x%02x 0x%02x 0x%02x\n",
+ dprintk(PREFIX "0x%02x 0x%02x 0x%02x\n",
buf[1],buf[2],buf[3]);
+ if (debug > 1)
+ dump_write_message(buf);
if (4 != (rc = i2c_master_send(&t->client,buf,4)))
- printk("tda9885/6/7: i2c i/o error: rc == %d (should be 4)\n",rc);
+ printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc);
return 0;
}
@@ -360,7 +490,7 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr,
client_template.adapter = adap;
client_template.addr = addr;
- printk("tda9887: chip found @ 0x%x\n", addr<<1);
+ printk(PREFIX "chip found @ 0x%x\n", addr<<1);
if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
return -ENOMEM;
diff --git a/v4l/scripts/cardlist b/v4l/scripts/cardlist
index 57b903dcb..ebfe5aec3 100644
--- a/v4l/scripts/cardlist
+++ b/v4l/scripts/cardlist
@@ -10,6 +10,6 @@ cat tuner.c \
| perl -ne '/"([^"]+)"/; printf("tuner=%d - %s\n",$i++,$1)' \
> doc/CARDLIST.tuner
-scripts/saa7134.pl saa7134-cards.c \
+scripts/saa7134.pl saa7134.h saa7134-cards.c \
> doc/CARDLIST.saa7134
diff --git a/v4l/scripts/saa7134.pl b/v4l/scripts/saa7134.pl
index 0be247c80..69648339a 100644
--- a/v4l/scripts/saa7134.pl
+++ b/v4l/scripts/saa7134.pl
@@ -21,11 +21,16 @@ my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
+ # defines in header file
+ if (/#define\s+(SAA7134_BOARD_\w+)\s+(\d+)/) {
+ $data{$1}->{nr} = $2;
+ next;
+ }
# saa7134_boards
if (/\[(SAA7134_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
- $data{$id}->{nr} = $nr++;
+# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
diff --git a/v4l/scripts/update b/v4l/scripts/update
index 073d7a654..9f10aa772 100644
--- a/v4l/scripts/update
+++ b/v4l/scripts/update
@@ -51,6 +51,7 @@ xinsmod video-buf debug=2
xinsmod btcx-risc debug=0
xinsmod ir-common debug=0 repeat=0
xinsmod tuner debug=0
+xinsmod tda9887 debug=2
xinsmod msp3400 debug=0
# bttv