summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2005-01-13 17:22:33 +0000
committerGerd Knorr <devnull@localhost>2005-01-13 17:22:33 +0000
commitbc5318acb6a825d4efc39704e8fbc5b25e7a69e2 (patch)
treeff76038c6ddc278f58d517d71c10e50adb96ece2 /linux/drivers/media/video/saa7134
parent5e7e4300bdef43bbc9db1f4661e1867a18ab8aff (diff)
downloadmediapointer-dvb-s2-bc5318acb6a825d4efc39704e8fbc5b25e7a69e2.tar.gz
mediapointer-dvb-s2-bc5318acb6a825d4efc39704e8fbc5b25e7a69e2.tar.bz2
- card-specific and other fixes from various people.
- more pinnacle 300i work (still not functional :-/).
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-cards.c44
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c87
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h5
3 files changed, 124 insertions, 12 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c
index 3e3455ecd..519a42c35 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.47 2005/01/11 14:17:48 kraxel Exp $
+ * $Id: saa7134-cards.c,v 1.48 2005/01/13 17:22:33 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* card-specific stuff.
@@ -1003,8 +1003,8 @@ struct saa7134_board saa7134_boards[] = {
.vmux = 8,
}},
},
- [SAA7134_BOARD_AVERMEDIA_305] = {
- .name = "AverMedia 305",
+ [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = {
+ .name = "AverMedia AverTV Studio 305",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_FM1256_IH3,
.tda9887_conf = TDA9887_PRESENT,
@@ -1409,6 +1409,37 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2,
},
},
+ [SAA7134_BOARD_AVERMEDIA_305] = {
+ /* much like the "studio" version but without radio
+ * and another tuner (sirspiritus@yandex.ru) */
+ .name = "AverMedia AverTV/305",
+ .audio_clock = 0x00187de7,
+ .tuner_type = TUNER_PHILIPS_FQ1216ME,
+ .tda9887_conf = TDA9887_PRESENT,
+ .gpiomask = 0x3,
+ .inputs = {{
+ .name = name_tv,
+ .vmux = 1,
+ .amux = LINE2,
+ .tv = 1,
+ },{
+ .name = name_comp1,
+ .vmux = 0,
+ .amux = LINE2,
+ },{
+ .name = name_comp2,
+ .vmux = 3,
+ .amux = LINE2,
+ },{
+ .name = name_svideo,
+ .vmux = 8,
+ .amux = LINE2,
+ }},
+ .mute = {
+ .name = name_mute,
+ .amux = LINE1,
+ },
+ },
};
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -1589,6 +1620,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
.subvendor = 0x1461, /* Avermedia Technologies Inc */
.subdevice = 0x2115,
+ .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305,
+ },{
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
+ .subvendor = 0x1461, /* Avermedia Technologies Inc */
+ .subdevice = 0x2108,
.driver_data = SAA7134_BOARD_AVERMEDIA_305,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
@@ -1794,6 +1831,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
case SAA7134_BOARD_ECS_TVP3XP:
case SAA7134_BOARD_ECS_TVP3XP_4CB5:
case SAA7134_BOARD_MD2819:
+ case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
case SAA7134_BOARD_AVERMEDIA_305:
case SAA7134_BOARD_AVERMEDIA_307:
// case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
index 325631fd0..968a9080c 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.7 2005/01/04 16:31:20 kraxel Exp $
+ * $Id: saa7134-dvb.c,v 1.8 2005/01/13 17:22:33 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
@@ -39,6 +39,27 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------------ */
+static int mt352_pinnacle_fixup(struct dvb_frontend* fe)
+{
+ static u8 wr[][2] = {
+ { 0x67, 0x28 },
+ { 0x68, 0xa0 },
+
+ { 0x7b, 0x04 },
+
+ { 0x88, 0x0d },
+ { 0x8a, 0x28 },
+ { 0x8c, 0x0f },
+ };
+ struct saa7134_dev *dev= fe->dvb->priv;
+ int i;
+
+ printk("%s: %s called\n",dev->name,__FUNCTION__);
+ for (i = 0; i < ARRAY_SIZE(wr); i++) {
+ mt352_write(fe, wr[i], 2);
+ }
+}
+
static int mt352_pinnacle_init(struct dvb_frontend* fe)
{
static u8 clock_config [] = { CLOCK_CTL, 0x3d, 0x39 };
@@ -67,6 +88,34 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
return 0;
}
+static int mt352_pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
+{
+ u32 ok;
+
+ if (!on) {
+ saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
+ saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
+ return 0;
+ }
+
+ saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
+ saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
+ udelay(10);
+
+ saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 28));
+ saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
+ udelay(10);
+ saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
+ udelay(10);
+ ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
+ printk("%s: %s %s\n", dev->name, __FUNCTION__,
+ ok ? "on" : "off");
+
+ if (!ok)
+ saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
+ return ok;
+}
+
static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
struct dvb_frontend_parameters* params,
u8* pllbuf)
@@ -77,19 +126,34 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
[ BANDWIDTH_7_MHZ ] = { TRL_NOMINAL_RATE_1, 0x64, 0xB8 },
[ BANDWIDTH_8_MHZ ] = { TRL_NOMINAL_RATE_1, 0x73, 0x1C },
};
- struct saa7134_dev *dev= fe->dvb->priv;
+ static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
+ static int off = TDA9887_PRESENT | TDA9887_PORT2_ACTIVE;
+ struct saa7134_dev *dev = fe->dvb->priv;
struct v4l2_frequency f;
int bw = params->u.ofdm.bandwidth;
printk("%s: %s called (freq=%d,bw=%d)\n",dev->name,__FUNCTION__,
params->frequency,bw);
- /* set frequency */
+ mt352_pinnacle_antenna_pwr(dev, 0);
+
+ /* set frequency (mt2050) */
f.tuner = 0;
- f.type = V4L2_TUNER_ANALOG_TV; /* FIXME */
+ f.type = V4L2_TUNER_DIGITAL_TV;
f.frequency = params->frequency / 1000 * 16 / 1000;
+ saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on);
saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
- memset(pllbuf,0,5);
+ saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&off);
+
+ /* mt352 setup */
+ mt352_pinnacle_init(fe);
+ mt352_pinnacle_fixup(fe);
+
+ pllbuf[0] = 0xc2;
+ pllbuf[1] = 0x00;
+ pllbuf[2] = 0x00;
+ pllbuf[3] = 0x80;
+ pllbuf[4] = 0x00;
if (bw < ARRAY_SIZE(buf) && NULL != buf[bw]) {
#if 1
@@ -97,8 +161,8 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
* adc freq 20.48 MHz values hardcoded */
pllbuf[-4] = buf[bw][1];
pllbuf[-3] = buf[bw][2];
- pllbuf[-2] = 0x31; /* if 36.1667 + adc 20.333 */
- pllbuf[-1] = 0xD9;
+ pllbuf[-2] = 0x31; /* if 36.15 + adc 20.333 */
+ pllbuf[-1] = 0xB8;
#else
mt352_write(fe, buf[bw], 3);
#endif
@@ -148,7 +212,16 @@ static int dvb_init(struct saa7134_dev *dev)
static int dvb_fini(struct saa7134_dev *dev)
{
+ static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
+
printk("%s: %s\n",dev->name,__FUNCTION__);
+
+ switch (dev->board) {
+ case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
+ /* otherwise we don't detect the tuner on next insmod */
+ saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on);
+ break;
+ };
videobuf_dvb_unregister(&dev->dvb);
return 0;
}
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index bab2b7575..50b51ffa3 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.34 2004/12/14 15:33:30 kraxel Exp $
+ * $Id: saa7134.h,v 1.35 2005/01/13 17:22:33 kraxel Exp $
*
* v4l2 device driver for philips saa7134 based TV cards
*
@@ -176,7 +176,7 @@ struct saa7134_format {
#define SAA7134_BOARD_AVACSSMARTTV 32
#define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33
#define SAA7134_BOARD_NOVAC_PRIMETV7133 34
-#define SAA7134_BOARD_AVERMEDIA_305 35
+#define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35
#define SAA7133_BOARD_UPMOST_PURPLE_TV 36
#define SAA7134_BOARD_ITEMS_MTV005 37
#define SAA7134_BOARD_CINERGY200 38
@@ -193,6 +193,7 @@ struct saa7134_format {
#define SAA7134_BOARD_VIDEOMATE_GOLD_PLUS 49
#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50
#define SAA7134_BOARD_PROVIDEO_PV952 51
+#define SAA7134_BOARD_AVERMEDIA_305 52
#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8