0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/signal.h>
0010 #include <linux/sched.h>
0011 #include <linux/interrupt.h>
0012 #include <asm/io.h>
0013
0014 #include <media/dmxdev.h>
0015 #include <media/dvbdev.h>
0016 #include <media/dvb_demux.h>
0017 #include <media/dvb_frontend.h>
0018 #include <media/dvb_net.h>
0019
0020 #include "mb86a16.h"
0021 #include "mantis_common.h"
0022 #include "mantis_ioc.h"
0023 #include "mantis_dvb.h"
0024 #include "mantis_vp1034.h"
0025 #include "mantis_reg.h"
0026
0027 static const struct mb86a16_config vp1034_mb86a16_config = {
0028 .demod_address = 0x08,
0029 .set_voltage = vp1034_set_voltage,
0030 };
0031
0032 #define MANTIS_MODEL_NAME "VP-1034"
0033 #define MANTIS_DEV_TYPE "DVB-S/DSS"
0034
0035 int vp1034_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage)
0036 {
0037 struct mantis_pci *mantis = fe->dvb->priv;
0038
0039 switch (voltage) {
0040 case SEC_VOLTAGE_13:
0041 dprintk(MANTIS_ERROR, 1, "Polarization=[13V]");
0042 mantis_gpio_set_bits(mantis, 13, 1);
0043 mantis_gpio_set_bits(mantis, 14, 0);
0044 break;
0045 case SEC_VOLTAGE_18:
0046 dprintk(MANTIS_ERROR, 1, "Polarization=[18V]");
0047 mantis_gpio_set_bits(mantis, 13, 1);
0048 mantis_gpio_set_bits(mantis, 14, 1);
0049 break;
0050 case SEC_VOLTAGE_OFF:
0051 dprintk(MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
0052 break;
0053 default:
0054 dprintk(MANTIS_ERROR, 1, "Invalid = (%d)", (u32) voltage);
0055 return -EINVAL;
0056 }
0057 mmwrite(0x00, MANTIS_GPIF_DOUT);
0058
0059 return 0;
0060 }
0061
0062 static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
0063 {
0064 struct i2c_adapter *adapter = &mantis->adapter;
0065
0066 int err = 0;
0067
0068 err = mantis_frontend_power(mantis, POWER_ON);
0069 if (err == 0) {
0070 mantis_frontend_soft_reset(mantis);
0071 msleep(250);
0072
0073 dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
0074 fe = dvb_attach(mb86a16_attach, &vp1034_mb86a16_config, adapter);
0075 if (fe) {
0076 dprintk(MANTIS_ERROR, 1,
0077 "found MB86A16 DVB-S/DSS frontend @0x%02x",
0078 vp1034_mb86a16_config.demod_address);
0079
0080 } else {
0081 return -1;
0082 }
0083 } else {
0084 dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
0085 adapter->name,
0086 err);
0087
0088 return -EIO;
0089 }
0090 mantis->fe = fe;
0091 dprintk(MANTIS_ERROR, 1, "Done!");
0092
0093 return 0;
0094 }
0095
0096 struct mantis_hwconfig vp1034_config = {
0097 .model_name = MANTIS_MODEL_NAME,
0098 .dev_type = MANTIS_DEV_TYPE,
0099 .ts_size = MANTIS_TS_204,
0100
0101 .baud_rate = MANTIS_BAUD_9600,
0102 .parity = MANTIS_PARITY_NONE,
0103 .bytes = 0,
0104
0105 .frontend_init = vp1034_frontend_init,
0106 .power = GPIF_A12,
0107 .reset = GPIF_A13,
0108 };