summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c12
-rw-r--r--v4l/mt352.c61
-rw-r--r--v4l/scripts/update2
3 files changed, 48 insertions, 27 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
index 2d336498c..2f1393589 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.9 2005/01/14 13:29:40 kraxel Exp $
+ * $Id: saa7134-dvb.c,v 1.10 2005/01/14 16:40:20 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
@@ -37,6 +37,10 @@
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
+static unsigned int antenna_pwr = 0;
+module_param(antenna_pwr, int, 0444);
+MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
+
/* ------------------------------------------------------------------ */
static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
@@ -111,7 +115,7 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&off);
- pinnacle_antenna_pwr(dev, 0);
+ pinnacle_antenna_pwr(dev, antenna_pwr);
/* mt352 setup */
mt352_pinnacle_init(fe);
@@ -137,11 +141,13 @@ static struct mt352_config pinnacle_300i = {
static int dvb_init(struct saa7134_dev *dev)
{
/* init struct videobuf_dvb */
+ dev->ts.nr_bufs = 32;
+ dev->ts.nr_packets = 32*4;
dev->dvb.name = dev->name;
videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
- V4L2_FIELD_TOP,
+ V4L2_FIELD_ALTERNATE,
sizeof(struct saa7134_buf),
dev);
diff --git a/v4l/mt352.c b/v4l/mt352.c
index fe9ff3505..8019db1b8 100644
--- a/v4l/mt352.c
+++ b/v4l/mt352.c
@@ -41,13 +41,12 @@
#include "mt352.h"
struct mt352_state {
-
struct i2c_adapter* i2c;
-
struct dvb_frontend_ops ops;
/* configuration settings */
const struct mt352_config* config;
+ int status;
struct dvb_frontend frontend;
};
@@ -81,7 +80,7 @@ int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
return 0;
}
-static u8 mt352_read_register(struct mt352_state* state, u8 reg)
+static int mt352_read_register(struct mt352_state* state, u8 reg)
{
int ret,i;
u8 b0 [] = { reg };
@@ -102,9 +101,11 @@ static u8 mt352_read_register(struct mt352_state* state, u8 reg)
__FUNCTION__, i+1);
}
- if (ret != 2)
+ if (ret != 2) {
printk(KERN_WARNING
"%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
+ return -1;
+ }
return b1[0];
}
@@ -114,7 +115,6 @@ static int mt352_sleep(struct dvb_frontend* fe)
static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };
mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
-
return 0;
}
@@ -287,8 +287,8 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
buf[1] = msb(tps); /* TPS_GIVEN_(1|0) */
buf[2] = lsb(tps);
-// buf[3] = 0x50; // old
- buf[3] = 0xf4; // pinnacle
+ buf[3] = 0x50; // old
+// buf[3] = 0xf4; // pinnacle
mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
mt352_calc_input_freq(state, buf+6);
@@ -435,29 +435,44 @@ static int mt352_get_parameters(struct dvb_frontend* fe,
static int mt352_read_status(struct dvb_frontend* fe, fe_status_t* status)
{
struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
- u8 r;
+ int r0,r1,r3;
+
+ r0 = mt352_read_register (state, STATUS_0);
+ r1 = mt352_read_register (state, STATUS_1);
+ r3 = mt352_read_register (state, STATUS_3);
+ if (-1 == r0 || -1 == r1 || -1 == r3) {
+ /* hmm, read failure. use last as fallback */
+ *status = state->status;
+ return 0;
+ }
*status = 0;
- r = mt352_read_register (state, STATUS_0);
- if (r & (1 << 4))
- *status = FE_HAS_CARRIER;
- if (r & (1 << 1))
- *status |= FE_HAS_VITERBI;
- if (r & (1 << 5))
- *status |= FE_HAS_LOCK;
-
- r = mt352_read_register (state, STATUS_1);
- if (r & (1 << 1))
- *status |= FE_HAS_SYNC;
-
- r = mt352_read_register (state, STATUS_3);
- if (r & (1 << 6))
- *status |= FE_HAS_SIGNAL;
+ if (r0 & (1 << 4))
+ *status |= FE_HAS_CARRIER;
+ if (r0 & (1 << 1))
+ *status |= FE_HAS_VITERBI;
+ if (r0 & (1 << 5))
+ *status |= FE_HAS_LOCK;
+ if (r1 & (1 << 1))
+ *status |= FE_HAS_SYNC;
+ if (r3 & (1 << 6))
+ *status |= FE_HAS_SIGNAL;
if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
(FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC))
*status &= ~FE_HAS_LOCK;
+ if (debug && state->status != *status) {
+ printk("%s:%s%s%s%s%s\n", __FUNCTION__,
+ *status & FE_HAS_CARRIER ? " CARRIER" : "",
+ *status & FE_HAS_VITERBI ? " VITERBI" : "",
+ *status & FE_HAS_LOCK ? " LOCK" : "",
+ *status & FE_HAS_SYNC ? " SYNC" : "",
+ *status & FE_HAS_SIGNAL ? " SIGNAL" : "");
+
+ }
+ state->status = *status;
+
return 0;
}
diff --git a/v4l/scripts/update b/v4l/scripts/update
index 0c2966ab5..b100b9db7 100644
--- a/v4l/scripts/update
+++ b/v4l/scripts/update
@@ -97,7 +97,7 @@ xinsmod saa7134-empress
# dvb stuff
xinsmod cx22702 debug=0
-xinsmod mt352 debug=1
+xinsmod mt352 debug=0
xinsmod video-buf-dvb
#xinsmod cx88-dvb
xinsmod saa7134-dvb