summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-12-09 12:51:35 +0000
committerGerd Knorr <devnull@localhost>2004-12-09 12:51:35 +0000
commit17d7470d78bd886cab06e6f0848bac4ac8edf1db (patch)
tree2e681fb9a605d3e2ba2feb0007aec272c8833431 /linux/drivers/media/video/saa7134
parent39aa684c82354e2c6c357eed2fd37c38f29c461f (diff)
downloadmediapointer-dvb-s2-17d7470d78bd886cab06e6f0848bac4ac8edf1db.tar.gz
mediapointer-dvb-s2-17d7470d78bd886cab06e6f0848bac4ac8edf1db.tar.bz2
- work on dvb pll stuff.
- misc dvb updates. - pinnacle 300i stuff (not working yet).
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r--linux/drivers/media/video/saa7134/saa6752hs.c7
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-cards.c31
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c82
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c31
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c5
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h3
6 files changed, 126 insertions, 33 deletions
diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c
index dc35bf34d..943ddd41c 100644
--- a/linux/drivers/media/video/saa7134/saa6752hs.c
+++ b/linux/drivers/media/video/saa7134/saa6752hs.c
@@ -428,12 +428,13 @@ static int saa6752hs_init(struct i2c_client* client)
buf[4] = 0xB0;
buf[5] = buf2[0];
switch(h->params.vi_aspect_ratio) {
+ case V4L2_MPEG_ASPECT_16_9:
+ buf[6] = buf2[1] | 0x40;
+ break;
case V4L2_MPEG_ASPECT_4_3:
+ default:
buf[6] = buf2[1] & 0xBF;
break;
-
- case V4L2_MPEG_ASPECT_16_9:
- buf[6] = buf2[1] | 0x40;
break;
}
buf[7] = buf2[2];
diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c
index 493fcc84f..02c17edd5 100644
--- a/linux/drivers/media/video/saa7134/saa7134-cards.c
+++ b/linux/drivers/media/video/saa7134/saa7134-cards.c
@@ -1,6 +1,6 @@
/*
- * $Id: saa7134-cards.c,v 1.44 2004/11/30 11:26:38 kraxel Exp $
+ * $Id: saa7134-cards.c,v 1.45 2004/12/09 12:51:35 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* card-specific stuff.
@@ -1354,6 +1354,31 @@ struct saa7134_board saa7134_boards[] = {
.gpio = 0x0c8000,
},
},
+ [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = {
+ .name = "Pinnacle PCTV 300i DVB-T + PAL",
+ .audio_clock = 0x00187de7,
+ .tuner_type = TUNER_MT2032,
+ .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER,
+ .mpeg = SAA7134_MPEG_DVB,
+ .inputs = {{
+ .name = name_tv,
+ .vmux = 3,
+ .amux = TV,
+ .tv = 1,
+ },{
+ .name = name_comp1,
+ .vmux = 0,
+ .amux = LINE2,
+ },{
+ .name = name_comp2,
+ .vmux = 1,
+ .amux = LINE2,
+ },{
+ .name = name_svideo,
+ .vmux = 8,
+ .amux = LINE2,
+ }},
+ },
};
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -1565,8 +1590,8 @@ struct pci_device_id saa7134_pci_tbl[] = {
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x11bd,
- .subdevice = 0x002d, /* 300i DVB-T + PAL */
- .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
+ .subdevice = 0x002d,
+ .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
index b51f0acb1..b2cbaee4c 100644
--- a/linux/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-dvb.c,v 1.4 2004/11/07 14:44:59 kraxel Exp $
+ * $Id: saa7134-dvb.c,v 1.5 2004/12/09 12:51:35 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
@@ -30,15 +30,65 @@
#include "saa7134-reg.h"
#include "saa7134.h"
+#include "dvb-pll.h"
+#include "mt352.h"
+#include "mt352_priv.h" /* FIXME */
+
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
/* ------------------------------------------------------------------ */
-static int dvb_init(struct saa7134_dev *dev)
+static int mt352_init(struct dvb_frontend* fe)
{
- printk("%s: %s\n",dev->name,__FUNCTION__);
+ static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
+ static u8 reset [] = { RESET, 0x80 };
+#if 0
+ static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
+ static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
+ static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
+ static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
+#endif
+ struct saa7134_dev *dev= fe->dvb->priv;
+
+ printk("%s: %s called\n",dev->name,__FUNCTION__);
+
+ mt352_write(fe, clock_config, sizeof(clock_config));
+ udelay(200);
+ mt352_write(fe, reset, sizeof(reset));
+#if 0
+ mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
+
+ mt352_write(fe, agc_cfg, sizeof(agc_cfg));
+ mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
+ mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
+#endif
+ return 0;
+}
+
+static int mt352_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params,
+ u8* pllbuf)
+{
+ struct saa7134_dev *dev= fe->dvb->priv;
+ printk("%s: %s called\n",dev->name,__FUNCTION__);
+ /* FIXME */
+ memset(pllbuf,0,5);
+ return 0;
+}
+
+static struct mt352_config pinnacle_300i = {
+ .demod_address = 0x3c >> 1,
+// .demod_address = 0x1e >> 1,
+ .demod_init = mt352_init,
+ .pll_set = mt352_pll_set,
+};
+
+/* ------------------------------------------------------------------ */
+
+static int dvb_init(struct saa7134_dev *dev)
+{
/* init struct videobuf_dvb */
dev->dvb.name = dev->name;
videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
@@ -48,12 +98,32 @@ static int dvb_init(struct saa7134_dev *dev)
sizeof(struct saa7134_buf),
dev);
- /* TODO: init frontend */
- if (NULL == dev->dvb.frontend)
+ switch (dev->board) {
+ case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
+ printk("%s: pinnacle 300i dvb setup\n",dev->name);
+ {
+ u8 buf[16];
+ dev->i2c_client.addr = 0x3c >> 1;
+ memset(buf,0,sizeof(buf));
+ buf[0] = CHIP_ID;
+ i2c_master_send(&dev->i2c_client,buf,1);
+ i2c_master_recv(&dev->i2c_client,buf,1);
+ }
+ dev->dvb.frontend = mt352_attach(&pinnacle_300i,
+ &dev->i2c_adap);
+ break;
+ default:
+ printk("%s: Huh? unknown DVB card?\n",dev->name);
+ break;
+ }
+
+ if (NULL == dev->dvb.frontend) {
+ printk("%s: frontend initialization failed\n",dev->name);
return -1;
+ }
/* register everything else */
- return videobuf_dvb_register(&dev->dvb);
+ return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev);
}
static int dvb_fini(struct saa7134_dev *dev)
diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
index cce9ddc3e..78c07db8a 100644
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-i2c.c,v 1.7 2004/11/07 13:17:15 kraxel Exp $
+ * $Id: saa7134-i2c.c,v 1.8 2004/12/09 12:51:35 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
@@ -214,6 +214,13 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
if (!i2c_is_busy_wait(dev))
return -EIO;
status = i2c_get_status(dev);
+#if 1 /* debug */
+ if (DONE_READ == status) {
+ unsigned char data = saa_readb(SAA7134_I2C_DATA);
+ d2printk(KERN_DEBUG "%s: i2c data <= 0x%x\n",dev->name,data);
+ d1printk(" [%02x]",data);
+ }
+#endif
if (i2c_is_error(status))
return -EIO;
return 0;
@@ -248,10 +255,12 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
if (!i2c_reset(dev))
return -EIO;
+ d2printk("start xfer\n");
d1printk(KERN_DEBUG "%s: i2c xfer:",dev->name);
for (i = 0; i < num; i++) {
if (!(msgs[i].flags & I2C_M_NOSTART) || 0 == i) {
/* send address */
+ d2printk("send address\n");
addr = msgs[i].addr << 1;
if (msgs[i].flags & I2C_M_RD)
addr |= 1;
@@ -262,6 +271,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
if (msgs[i].flags & I2C_M_RD) {
/* read bytes */
+ d2printk("read bytes\n");
for (byte = 0; byte < msgs[i].len; byte++) {
d1printk(" =");
rc = i2c_recv_byte(dev);
@@ -272,6 +282,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
} else {
/* write bytes */
+ d2printk("write bytes\n");
for (byte = 0; byte < msgs[i].len; byte++) {
data = msgs[i].buf[byte];
d1printk(" %02x", data);
@@ -281,6 +292,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
}
}
+ d2printk("xfer done\n");
d1printk(" >");
i2c_set_attr(dev,STOP);
rc = -EIO;
@@ -313,18 +325,6 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL;
}
-#ifndef I2C_PEC
-static void inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
static int attach_inform(struct i2c_client *client)
{
struct saa7134_dev *dev = client->adapter->algo_data;
@@ -345,12 +345,7 @@ static struct i2c_algorithm saa7134_algo = {
};
static struct i2c_adapter saa7134_adap_template = {
-#ifdef I2C_PEC
.owner = THIS_MODULE,
-#else
- .inc_use = inc_use,
- .dec_use = dec_use,
-#endif
#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
#endif
diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c
index 36a623fca..c3164350b 100644
--- a/linux/drivers/media/video/saa7134/saa7134-video.c
+++ b/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-video.c,v 1.23 2004/12/02 14:23:54 kraxel Exp $
+ * $Id: saa7134-video.c,v 1.24 2004/12/09 12:51:35 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
@@ -1474,6 +1474,7 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
f->fmt.pix.width = maxw;
if (f->fmt.pix.height > maxh)
f->fmt.pix.height = maxh;
+ f->fmt.pix.width &= ~0x03;
f->fmt.pix.bytesperline =
(f->fmt.pix.width * fmt->depth) >> 3;
f->fmt.pix.sizeimage =
@@ -2269,7 +2270,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)
dev->ctl_hue = ctrl_by_id(V4L2_CID_HUE)->default_value;
dev->ctl_saturation = ctrl_by_id(V4L2_CID_SATURATION)->default_value;
dev->ctl_volume = ctrl_by_id(V4L2_CID_AUDIO_VOLUME)->default_value;
- dev->ctl_mute = ctrl_by_id(V4L2_CID_AUDIO_MUTE)->default_value;
+ dev->ctl_mute = 1; // ctrl_by_id(V4L2_CID_AUDIO_MUTE)->default_value;
dev->ctl_invert = ctrl_by_id(V4L2_CID_PRIVATE_INVERT)->default_value;
dev->ctl_automute = ctrl_by_id(V4L2_CID_PRIVATE_AUTOMUTE)->default_value;
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index f0e4bd6d5..29b041093 100644
--- a/linux/drivers/media/video/saa7134/saa7134.h
+++ b/linux/drivers/media/video/saa7134/saa7134.h
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134.h,v 1.32 2004/11/30 11:26:38 kraxel Exp $
+ * $Id: saa7134.h,v 1.33 2004/12/09 12:51:35 kraxel Exp $
*
* v4l2 device driver for philips saa7134 based TV cards
*
@@ -191,6 +191,7 @@ struct saa7134_format {
#define SAA7134_BOARD_CINERGY400_CARDBUS 47
#define SAA7134_BOARD_CINERGY600_MK3 48
#define SAA7134_BOARD_VIDEOMATE_GOLD_PLUS 49
+#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50
#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8