From 05a58d29a472973dd746660dba8d7a709de73c95 Mon Sep 17 00:00:00 2001 From: Holger Waechtler Date: Wed, 3 Dec 2003 18:50:49 +0000 Subject: full DiSEqC support by Vincenzo Di Massa --- linux/drivers/media/dvb/b2c2/skystar2.c | 212 +++++++++++++++++--------------- 1 file changed, 113 insertions(+), 99 deletions(-) (limited to 'linux/drivers/media/dvb/b2c2/skystar2.c') diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index 2566898f8..a95b0b422 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -4,11 +4,15 @@ * * Copyright (C) 2003 Vadim Catana, skystar@moldova.cc * - * FIX: DISEQC Tone Burst in flexcop_diseqc_ioctl() + * FIX: DiSEqC Tone Burst in flexcop_diseqc_ioctl() * Vincenzo Di Massa, hawk.it at tiscalinet.it * * IMP: Converted to Linux coding style * Roberto Ragusa, r.ragusa at libero.it + * + * FIX: FULL soft DiSEqC for skystar2 (rev 193) VP310 equipped + * Vincenzo Di Massa, hawk.it at tiscalinet.it + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -24,6 +28,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include #include #include @@ -2260,139 +2265,148 @@ static void set_tuner_polarity(struct adapter *adapter, u8 polarity) write_reg_dw(adapter, 0x204, var); } -static int flexcop_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg) +static void diseqc_send_bit (struct adapter *adapter, int data) { - struct adapter *adapter = fe->before_after_data; + set_tuner_tone(adapter, 1); + udelay(data ? 500 : 1000); + set_tuner_tone(adapter, 0); + udelay(data ? 1000 : 500); +} - struct dvb_frontend_info info; - - switch (cmd) { - - case FE_DISEQC_SEND_BURST: - { - u8 count; - fe_sec_mini_cmd_t b = (fe_sec_mini_cmd_t) arg; - dprintk("%s: FE_SEND_BURST ", __FUNCTION__); - switch ( b ) - { - case SEC_MINI_A: - { - dprintk("SEC_MINI_A\n"); - set_tuner_tone(adapter, 1); // This lines are needed - udelay(500*25); // to do a down-step - set_tuner_tone(adapter, 0); - udelay(500*25); - break; - } - case SEC_MINI_B: - { - dprintk("SEC_MINI_B\n"); - set_tuner_tone(adapter, 0); - udelay(1000*15); - for (count=0;count<9; count++) - { - set_tuner_tone(adapter, 1); - udelay(500); - set_tuner_tone(adapter, 0); - udelay(1000); - } - udelay(1000*15); - break; - } - default: - break; - }; - return 0; - } - - case FE_SLEEP: - { - dprintk("%s: FE_SLEEP\n", __FUNCTION__); +static void diseqc_send_byte (struct adapter *adapter, int data) +{ + int i, par=1, d; - set_tuner_polarity(adapter, 0); + for (i=7; i>=0; i--) { + d = (data>>i)&1; + par ^= d; + diseqc_send_bit(adapter, d); + } - // return -EOPNOTSUPP, to make DVB core also send "FE_SLEEP" command to frontend. - return -EOPNOTSUPP; - } + diseqc_send_bit(adapter, par); +} - case FE_SET_VOLTAGE: - { - dprintk("%s: FE_SET_VOLTAGE\n", __FUNCTION__); - switch ((fe_sec_voltage_t) arg) - { - case SEC_VOLTAGE_13: +static int send_diseqc_msg (struct adapter *adapter, int len, u8 *msg, unsigned long burst) +{ + int i; - dprintk("%s: SEC_VOLTAGE_13, %x\n", __FUNCTION__, SEC_VOLTAGE_13); + set_tuner_tone(adapter, 0); + mdelay(16); - set_tuner_polarity(adapter, 1); + for (i=0; imsg_len, cmd->msg, 0); + break; + } - default: + case FE_DISEQC_SEND_BURST: + send_diseqc_msg (adapter, 0, NULL, (unsigned long)arg); + break; - return -EINVAL; - }; + default: + return -EOPNOTSUPP; + }; - } + return 0; +} - case FE_SET_TONE: - { - dprintk("%s: FE_SET_TONE\n", __FUNCTION__); +static int flexcop_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg) +{ + struct adapter *adapter = fe->before_after_data; - fe->ioctl(fe, FE_GET_INFO, &info); + struct dvb_frontend_info info; + + fe->ioctl(fe, FE_GET_INFO, &info); - if ( strcmp(info.name, "Zarlink MT312") == 0) - { - dprintk("%s: FE_SET_TONE for %s frontend\n", __FUNCTION__, info.name); - - switch ((fe_sec_tone_mode_t) arg) - { - case SEC_TONE_ON: + // we must use different DiSEqC hw + + if ( strcmp(info.name, "Zarlink MT312") == 0){ + //VP310 using mt312 driver for tuning only: diseqc not wired + //use FCII instead + if (!soft_diseqc(adapter,cmd,arg)) + return 0; + } + + switch (cmd) { + case FE_SLEEP: + { + dprintk("%s: FE_SLEEP\n", __FUNCTION__); - dprintk("%s: SEC_TONE_ON, %x\n", __FUNCTION__, SEC_TONE_ON); + set_tuner_polarity(adapter, 0); - set_tuner_tone(adapter, 1); + // return -EOPNOTSUPP, to make DVB core also send "FE_SLEEP" command to frontend. + return -EOPNOTSUPP; + } - return 0; + case FE_SET_VOLTAGE: + { + dprintk("%s: FE_SET_VOLTAGE\n", __FUNCTION__); - case SEC_TONE_OFF: + switch ((fe_sec_voltage_t) arg) + { + case SEC_VOLTAGE_13: - dprintk("%s: SEC_TONE_OFF, %x\n", __FUNCTION__, SEC_TONE_OFF); + dprintk("%s: SEC_VOLTAGE_13, %x\n", __FUNCTION__, SEC_VOLTAGE_13); - set_tuner_tone(adapter, 0); + set_tuner_polarity(adapter, 1); - return 0; + return 0; - default: + case SEC_VOLTAGE_18: - return -EINVAL; - }; + dprintk("%s: SEC_VOLTAGE_18, %x\n", __FUNCTION__, SEC_VOLTAGE_18); - }; - - if ( strcmp(info.name, "STV0299/TSA5059/SL1935 based") == 0) - { - dprintk("%s: FE_SET_TONE for %s frontend\n", __FUNCTION__, info.name); + set_tuner_polarity(adapter, 2); - /* allow the frontend driver to handle this command*/ - return -EOPNOTSUPP; - }; + return 0; - printk("%s: FE_SET_TONE unknown frontend : %s\n", __FUNCTION__, info.name); + default: - return -EINVAL; + return -EINVAL; + }; } + default: return -EOPNOTSUPP; -- cgit v1.2.3