diff options
author | Andrew de Quincy <devnull@localhost> | 2004-11-19 00:00:39 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2004-11-19 00:00:39 +0000 |
commit | 0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e (patch) | |
tree | d94cb8d062b9a0bfea21e3ef8172efb1c5259a5f /linux/drivers/media/dvb | |
parent | d30da5221dd4bcc278caaf35a0e497415432d072 (diff) | |
download | mediapointer-dvb-s2-0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e.tar.gz mediapointer-dvb-s2-0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e.tar.bz2 |
Added vp310 support
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/b2c2/skystar2.c | 87 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/mt312.c | 81 | ||||
-rw-r--r-- | linux/drivers/media/dvb/frontends/mt312.h | 3 |
3 files changed, 102 insertions, 69 deletions
diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index cdde800a8..27c3b4274 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -2026,7 +2026,6 @@ static int dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) return 0; } -#if 0 /* lnb control */ static void set_tuner_tone(struct adapter *adapter, u8 tone) { @@ -2061,7 +2060,6 @@ static void set_tuner_tone(struct adapter *adapter, u8 tone) write_reg_dw(adapter, 0x200, 0x40ff8000); } } -#endif static void set_tuner_polarity(struct adapter *adapter, u8 polarity) { @@ -2089,7 +2087,6 @@ static void set_tuner_polarity(struct adapter *adapter, u8 polarity) write_reg_dw(adapter, 0x204, var); } -#if 0 static void diseqc_send_bit(struct adapter *adapter, int data) { set_tuner_tone(adapter, 1); @@ -2139,42 +2136,41 @@ static int send_diseqc_msg(struct adapter *adapter, int len, u8 *msg, unsigned l return 0; } - -static int soft_diseqc(struct adapter *adapter, unsigned int cmd, void *arg) +static int flexcop_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) { - switch (cmd) { - case FE_SET_TONE: - switch ((fe_sec_tone_mode_t) arg) { - case SEC_TONE_ON: - set_tuner_tone(adapter, 1); - break; - case SEC_TONE_OFF: - set_tuner_tone(adapter, 0); - break; - default: - return -EINVAL; - }; + struct adapter* adapter = (struct adapter*) fe->dvb->priv; + + switch(tone) { + case SEC_TONE_ON: + set_tuner_tone(adapter, 1); break; + case SEC_TONE_OFF: + set_tuner_tone(adapter, 0); + break; + default: + return -EINVAL; + }; - case FE_DISEQC_SEND_MASTER_CMD: - { - struct dvb_diseqc_master_cmd *cmd = arg; + return 0; +} - send_diseqc_msg(adapter, cmd->msg_len, cmd->msg, 0); - break; - } +static int flexcop_diseqc_send_master_cmd(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) +{ + struct adapter* adapter = (struct adapter*) fe->dvb->priv; - case FE_DISEQC_SEND_BURST: - send_diseqc_msg(adapter, 0, NULL, (unsigned long) arg); - break; + send_diseqc_msg(adapter, cmd->msg_len, cmd->msg, 0); - default: - return -EOPNOTSUPP; - }; + return 0; +} + +static int flexcop_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd) +{ + struct adapter* adapter = (struct adapter*) fe->dvb->priv; + + send_diseqc_msg(adapter, 0, NULL, minicmd); return 0; } -#endif static int flexcop_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) { @@ -2377,16 +2373,31 @@ static struct mt352_config samsung_tdtc9251dh0_config = { .pll_set = samsung_tdtc9251dh0_pll_set, }; -static int skystar2_23_samsung_unknown_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) +static int skystar23_samsung_unknown_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { - // FIXME: do something + u8 buf[4]; + u32 div; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + struct adapter* adapter = (struct adapter*) fe->dvb->priv; + + div = (params->frequency + (125/2)) / 125; + + buf[0] = (div >> 8) & 0x7f; + buf[1] = (div >> 0) & 0xff; + buf[2] = 0x84 | ((div >> 10) & 0x60); + buf[3] = 0x80; + + if (params->frequency < 1550000) + buf[3] |= 0x02; + + if (i2c_transfer (&adapter->i2c_adap, &msg, 1) != 1) return -EIO; return 0; } -static struct mt312_config skystar2_23_samsung_unknown_config = { +static struct mt312_config skystar23_samsung_unknown_config = { .demod_address = 0x0e, - .pll_set = skystar2_23_samsung_unknown_pll_set, + .pll_set = skystar23_samsung_unknown_pll_set, }; @@ -2414,10 +2425,12 @@ static void frontend_init(struct adapter *skystar2) break; } - // try the skystar2 v2.3 first (mt312/Samsung unknown(??)) - skystar2->fe = mt312_attach(&skystar2_23_samsung_unknown_config, &skystar2->i2c_adap); + // try the skystar2 v2.3 (mt312/Samsung unknown(??)) + skystar2->fe = vp310_attach(&skystar23_samsung_unknown_config, &skystar2->i2c_adap); if (skystar2->fe != NULL) { - // FIXME: these may be incorrect + skystar2->fe->ops->diseqc_send_master_cmd = flexcop_diseqc_send_master_cmd; + skystar2->fe->ops->diseqc_send_burst = flexcop_diseqc_send_burst; + skystar2->fe->ops->set_tone = flexcop_set_tone; skystar2->fe->ops->set_voltage = flexcop_set_voltage; skystar2->fe_sleep = skystar2->fe->ops->sleep; skystar2->fe->ops->sleep = flexcop_sleep; diff --git a/linux/drivers/media/dvb/frontends/mt312.c b/linux/drivers/media/dvb/frontends/mt312.c index 1b31e982c..4f4fef72a 100644 --- a/linux/drivers/media/dvb/frontends/mt312.c +++ b/linux/drivers/media/dvb/frontends/mt312.c @@ -393,7 +393,7 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) { struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; int ret; - u8 status[3], vit_mode; + u8 status[3]; *s = 0; @@ -413,17 +413,6 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s) if (status[0] & 0x01) *s |= FE_HAS_LOCK; /* qpsk lock */ - // VP310 doesn't have AUTO, so we "implement it here" ACCJr - if ((state->id == ID_VP310) && !(status[0] & 0x01)) { - if ((ret = mt312_readreg(state, VIT_MODE, &vit_mode)) < 0) - return ret; - vit_mode ^= 0x40; - if ((ret = mt312_writereg(state, VIT_MODE, vit_mode)) < 0) - return ret; - if ((ret = mt312_writereg(state, GO, 0x01)) < 0) - return ret; - } - return 0; } @@ -638,61 +627,88 @@ static void mt312_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops mt312_ops; +static struct dvb_frontend_ops vp310_mt312_ops; -struct dvb_frontend* mt312_attach(const struct mt312_config* config, +struct dvb_frontend* vp310_attach(const struct mt312_config* config, struct i2c_adapter* i2c) { struct mt312_state* state = NULL; /* allocate memory for the internal state */ state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL); - if (state == NULL) goto error; + if (state == NULL) + goto error; /* setup the state */ state->config = config; state->i2c = i2c; - memcpy(&state->ops, &mt312_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops)); + strcpy(state->ops.info.name, "Zarlink VP310 DVB-S"); /* check if the demod is there */ - if (mt312_readreg(state, ID, &state->id) < 0) goto error; - switch(state->id) { - case ID_VP310: - state->frequency = 90; - printk("mt312: Detected Zarlink VP310\n"); - break; + if (mt312_readreg(state, ID, &state->id) < 0) + goto error; + if (state->id != ID_VP310) { + goto error; + } - case ID_MT312: - state->frequency = 60; - printk("mt312: Detected Zarlink MT312\n"); - break; + /* create dvb_frontend */ + state->frequency = 90; + state->frontend.ops = &state->ops; + state->frontend.demodulator_priv = state; + return &state->frontend; - default: +error: + if (state) + kfree(state); + return NULL; +} + +struct dvb_frontend* mt312_attach(const struct mt312_config* config, + struct i2c_adapter* i2c) +{ + struct mt312_state* state = NULL; + + /* allocate memory for the internal state */ + state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL); + if (state == NULL) + goto error; + + /* setup the state */ + state->config = config; + state->i2c = i2c; + memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops)); + strcpy(state->ops.info.name, "Zarlink MT312 DVB-S"); + + /* check if the demod is there */ + if (mt312_readreg(state, ID, &state->id) < 0) + goto error; + if (state->id != ID_MT312) { goto error; } /* create dvb_frontend */ + state->frequency = 60; state->frontend.ops = &state->ops; state->frontend.demodulator_priv = state; return &state->frontend; error: - if (state) kfree(state); + if (state) + kfree(state); return NULL; } -static struct dvb_frontend_ops mt312_ops = { +static struct dvb_frontend_ops vp310_mt312_ops = { .info = { - .name = "Zarlink VP310/MT312 DVB-S", + .name = "Zarlink ???? DVB-S", .type = FE_QPSK, .frequency_min = 950000, .frequency_max = 2150000, .frequency_stepsize = (MT312_PLL_CLK / 1000) / 128, - /*.frequency_tolerance = 29500, FIXME: binary compatibility waste? */ .symbol_rate_min = MT312_SYS_CLK / 128, .symbol_rate_max = MT312_SYS_CLK / 2, - /*.symbol_rate_tolerance = 500, FIXME: binary compatibility waste? 2% */ .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | @@ -729,3 +745,4 @@ MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(mt312_attach); +EXPORT_SYMBOL(vp310_attach); diff --git a/linux/drivers/media/dvb/frontends/mt312.h b/linux/drivers/media/dvb/frontends/mt312.h index cece3ca84..b3a53a73a 100644 --- a/linux/drivers/media/dvb/frontends/mt312.h +++ b/linux/drivers/media/dvb/frontends/mt312.h @@ -41,4 +41,7 @@ struct mt312_config extern struct dvb_frontend* mt312_attach(const struct mt312_config* config, struct i2c_adapter* i2c); +extern struct dvb_frontend* vp310_attach(const struct mt312_config* config, + struct i2c_adapter* i2c); + #endif // MT312_H |