summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2005-01-04 16:31:20 +0000
committerGerd Knorr <devnull@localhost>2005-01-04 16:31:20 +0000
commitd11bf9fb3ca8e03aa181518279de67fcd51ee374 (patch)
tree4ad254e15a99aa03cfb729c21331c9da4004a45d
parent5bac93165c075e9bde153e2abd14d5c5a550d90a (diff)
downloadmediapointer-dvb-s2-d11bf9fb3ca8e03aa181518279de67fcd51ee374.tar.gz
mediapointer-dvb-s2-d11bf9fb3ca8e03aa181518279de67fcd51ee374.tar.bz2
- more pinnacle 300i stuff (not working yet).
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c63
-rw-r--r--v4l/Make.config6
-rw-r--r--v4l/mt352.c41
-rw-r--r--v4l/scripts/update8
4 files changed, 81 insertions, 37 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
index b6cb37003..325631fd0 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.6 2004/12/10 12:33:39 kraxel Exp $
+ * $Id: saa7134-dvb.c,v 1.7 2005/01/04 16:31:20 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
@@ -39,15 +39,16 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------------ */
-static int mt352_init(struct dvb_frontend* fe)
+static int mt352_pinnacle_init(struct dvb_frontend* fe)
{
- static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; // check
- static u8 reset [] = { RESET, 0x80 }; // ok
- static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; // ok
+ static u8 clock_config [] = { CLOCK_CTL, 0x3d, 0x39 };
+ static u8 reset [] = { RESET, 0x80 };
+ static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
+ static u8 agc_cfg [] = { AGC_TARGET, 0x20, 0x20 };
+ static u8 capt_range_cfg[] = { CAPT_RANGE, 0x31 };
#if 0
- static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; // check
- static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; // ???
- static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; // ???
+ // general purpose port pins
+ static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
#endif
struct saa7134_dev *dev= fe->dvb->priv;
@@ -57,31 +58,59 @@ static int mt352_init(struct dvb_frontend* fe)
udelay(200);
mt352_write(fe, reset, sizeof(reset));
mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
+ mt352_write(fe, agc_cfg, sizeof(agc_cfg));
+ mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
#if 0
- 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)
+static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* params,
+ u8* pllbuf)
{
+ static u8 buf[][3] = {
+ /* set bandwidth (ADC frequency is 20.333 MHz) */
+ [ BANDWIDTH_6_MHZ ] = { TRL_NOMINAL_RATE_1, 0x56, 0x55 },
+ [ 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;
+ struct v4l2_frequency f;
+ int bw = params->u.ofdm.bandwidth;
- printk("%s: %s called\n",dev->name,__FUNCTION__);
- /* FIXME */
+ printk("%s: %s called (freq=%d,bw=%d)\n",dev->name,__FUNCTION__,
+ params->frequency,bw);
+
+ /* set frequency */
+ f.tuner = 0;
+ f.type = V4L2_TUNER_ANALOG_TV; /* FIXME */
+ f.frequency = params->frequency / 1000 * 16 / 1000;
+ saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
memset(pllbuf,0,5);
+
+ if (bw < ARRAY_SIZE(buf) && NULL != buf[bw]) {
+#if 1
+ /* dirty hack time -- fixup mt352 buffer which has
+ * 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;
+#else
+ mt352_write(fe, buf[bw], 3);
+#endif
+ }
+
return 0;
}
static struct mt352_config pinnacle_300i = {
.demod_address = 0x3c >> 1,
- .demod_init = mt352_init,
- .pll_set = mt352_pll_set,
+ .demod_init = mt352_pinnacle_init,
+ .pll_set = mt352_pinnacle_pll_set,
};
/* ------------------------------------------------------------------ */
diff --git a/v4l/Make.config b/v4l/Make.config
index c3c14b78f..b941e3ff8 100644
--- a/v4l/Make.config
+++ b/v4l/Make.config
@@ -8,9 +8,9 @@ CONFIG_VIDEO_TUNER := m
CONFIG_VIDEO_TVAUDIO := m
CONFIG_VIDEO_CX88 := m
-# doesn't build without patches from dvb cvs
-# use "make DVB=1" to build with DVB support.
-ifeq ($(DVB),1)
+# doesn't build on kernels older than 2.6.10
+# Hmm, need a more clever check once we have 2.6.11 ...
+ifeq ($(KERNELRELEASE),2.6.10)
CONFIG_VIDEO_CX88_DVB := m
CONFIG_VIDEO_SAA7134_DVB := m
else
diff --git a/v4l/mt352.c b/v4l/mt352.c
index 4638207be..9d7ddefc1 100644
--- a/v4l/mt352.c
+++ b/v4l/mt352.c
@@ -107,11 +107,14 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
struct dvb_frontend_parameters *param)
{
struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
- unsigned char buf[14];
+ unsigned char buf[13];
+ static unsigned char go[2] = { 0x5b, 0x01 };
unsigned int tps = 0;
struct dvb_ofdm_parameters *op = &param->u.ofdm;
- int i;
+ int regs, tune, i;
+ dprintk("%s: hello\n",__FUNCTION__);
+
switch (op->code_rate_HP) {
case FEC_2_3:
tps |= (1 << 7);
@@ -243,21 +246,30 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
state->config->pll_set(fe, param, buf+8);
- buf[13] = 0x01; /* TUNER_GO!! */
+ if (0 != buf[8]) {
+ /* default */
+ regs = 13;
+ tune = 0;
+ } else {
+ /* no tuner address given => don't write these registers */
+ regs = 8;
+ tune = 1;
+ }
/* Only send the tuning request if the tuner doesn't have the requested
* parameters already set. Enhances tuning time and prevents stream
* breakup when retuning the same transponder. */
- for (i = 1; i < 13; i++) {
+ for (i = 1; i < regs; i++) {
if (buf[i] != mt352_read_register(state, i + 0x50)) {
- mt352_write(fe, buf, sizeof(buf));
+ mt352_write(fe, buf, regs);
+ tune = 1;
break;
}
- if (8 == i && 0 == buf[i])
- /* no tuner address given => skip that part */
- break;
}
+ if (tune)
+ mt352_write(fe, go, sizeof(go)); /* set TUNER_GO */
+
return 0;
}
@@ -381,7 +393,7 @@ 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;
- *status = 0;
+ *status = 0;
r = mt352_read_register (state, STATUS_0);
if (r & (1 << 4))
*status = FE_HAS_CARRIER;
@@ -462,22 +474,24 @@ static int mt352_init(struct dvb_frontend* fe)
static u8 mt352_reset_attach [] = { RESET, 0xC0 };
+ dprintk("%s: hello\n",__FUNCTION__);
+
if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 ||
(mt352_read_register(state, CONFIG) & 0x20) == 0) {
- /* Do a "hard" reset */
+ /* Do a "hard" reset */
mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
return state->config->demod_init(fe);
}
return 0;
- }
+}
static void mt352_release(struct dvb_frontend* fe)
{
struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
- kfree(state);
- }
+ kfree(state);
+}
static struct dvb_frontend_ops mt352_ops;
@@ -489,6 +503,7 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
/* allocate memory for the internal state */
state = (struct mt352_state*) kmalloc(sizeof(struct mt352_state), GFP_KERNEL);
if (state == NULL) goto error;
+ memset(state,0,sizeof(*state));
/* setup the state */
state->config = config;
diff --git a/v4l/scripts/update b/v4l/scripts/update
index 8ac84be67..8e5c3e5e0 100644
--- a/v4l/scripts/update
+++ b/v4l/scripts/update
@@ -73,8 +73,8 @@ xinsmod tveeprom debug=0
xinsmod dvb-pll debug=1
xinsmod btcx-risc debug=0
xinsmod ir-common debug=1 repeat=0
-xinsmod tuner debug=0
-xinsmod tda9887 debug=0 port2=0
+xinsmod tuner debug=1
+xinsmod tda9887 debug=0
xinsmod msp3400 debug=0
# bttv
@@ -97,7 +97,7 @@ xinsmod saa7134-empress
# dvb stuff
xinsmod cx22702 debug=0
-xinsmod mt352 debug=0
+xinsmod mt352 debug=1
xinsmod video-buf-dvb
-xinsmod cx88-dvb
xinsmod saa7134-dvb
+xinsmod cx88-dvb