summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/b2c2/skystar2.c
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-11-19 00:00:39 +0000
committerAndrew de Quincy <devnull@localhost>2004-11-19 00:00:39 +0000
commit0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e (patch)
treed94cb8d062b9a0bfea21e3ef8172efb1c5259a5f /linux/drivers/media/dvb/b2c2/skystar2.c
parentd30da5221dd4bcc278caaf35a0e497415432d072 (diff)
downloadmediapointer-dvb-s2-0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e.tar.gz
mediapointer-dvb-s2-0e83d7e078fe1b3053d16b7ab0d3e37bf2f3745e.tar.bz2
Added vp310 support
Diffstat (limited to 'linux/drivers/media/dvb/b2c2/skystar2.c')
-rw-r--r--linux/drivers/media/dvb/b2c2/skystar2.c87
1 files changed, 50 insertions, 37 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;