static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
{
struct i2c_adapter *adapter = &mantis->adapter;
+ struct mantis_hwconfig *config = mantis->hwconfig;
int err = 0;
+ gpio_set_bits(mantis, config->reset, 0);
+ msleep(100);
err = mantis_frontend_power(mantis, POWER_ON);
- mantis_frontend_soft_reset(mantis);
-
- dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
- fe = zl10353_attach(&hopper_vp3028_config, adapter);
-
- if (!fe)
- return -1;
+ msleep(100);
+ gpio_set_bits(mantis, config->reset, 1);
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ msleep(250);
+ dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+ fe = zl10353_attach(&hopper_vp3028_config, adapter);
+
+ if (!fe)
+ return -1;
+ } else {
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
+ }
dprintk(MANTIS_ERROR, 1, "Done!");
return 0;
#define MANTIS_NOTICE 1
#define MANTIS_INFO 2
#define MANTIS_DEBUG 3
+#define MANTIS_TMG 9
#define dprintk(y, z, format, arg...) do { \
if (z) { \
printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \
printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
+ else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y)) \
+ printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
} else { \
if (mantis->verbose > y) \
printk(format , ##arg); \
#define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr)))
#define mmread(addr) mread(mantis->mmio + (addr))
-#define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr)
-#define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr)
-#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
#define MANTIS_TS_188 0
#define MANTIS_TS_204 1
.driver_data = (unsigned long) (__configptr) \
}
+enum mantis_i2c_mode {
+ MANTIS_PAGE_MODE = 0,
+ MANTIS_BYTE_MODE,
+};
+
struct mantis_pci;
struct mantis_hwconfig {
u8 power;
u8 reset;
+
+ enum mantis_i2c_mode i2c_mode;
};
struct mantis_pci {
#define I2C_HW_B_MANTIS 0x1c
+#define TRIALS 10000
+
static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
u32 rxd, i, stat, trials;
mmwrite(rxd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
+ dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < TRIALS; trials++) {
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CRACK)
+ break;
+ msleep(1);
+ }
+
+ dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
+
rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
+
+ dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < TRIALS; trials++) {
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CRACK)
+ break;
+ msleep(1);
+ }
+
+ dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
}
dprintk(MANTIS_INFO, 0, "]\n");
while (i < num) {
/* Byte MODE */
- if (((i + 1) < num) &&
- (msgs[i].len < 2) &&
- (msgs[i + 1].len < 2) &&
- (msgs[i + 1].flags & I2C_M_RD)) {
+ if ((config->i2c_mode & MANTIS_BYTE_MODE) &&
+ ((i + 1) < num) &&
+ (msgs[i].len < 2) &&
+ (msgs[i + 1].len < 2) &&
+ (msgs[i + 1].flags & I2C_M_RD)) {
dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n");
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
#include "stv0299.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp1033.h"
+#include "mantis_reg.h"
u8 lgtdqcs001f_inittab[] = {
0x01, 0x15,
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
- fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+ int err = 0;
- if (fe) {
- fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
- dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
- lgtdqcs001f_config.demod_address);
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
+ dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
+ fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+
+ if (fe) {
+ fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
+ lgtdqcs001f_config.demod_address);
+
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
.bytes = 0,
.frontend_init = vp1033_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
#include "mb86a16.h"
#include "mantis_common.h"
#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp1034.h"
#include "mantis_reg.h"
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
- fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found MB86A16 DVB-S/DSS frontend @0x%02x",
- vp1034_mb86a16_config.demod_address);
+ int err = 0;
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
+ fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found MB86A16 DVB-S/DSS frontend @0x%02x",
+ vp1034_mb86a16_config.demod_address);
+
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
.bytes = 0,
.frontend_init = vp1034_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
#include "tda1002x.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp2033.h"
#define MANTIS_MODEL_NAME "VP-2033"
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
- adapter,
- read_pwm(mantis));
+ int err = 0;
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
- vp2033_tda1002x_cu1216_config.demod_address);
- } else {
- fe = tda10023_attach(&vp2033_tda10023_cu1216_config,
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
adapter,
read_pwm(mantis));
if (fe) {
dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
vp2033_tda1002x_cu1216_config.demod_address);
+ } else {
+ fe = tda10023_attach(&vp2033_tda10023_cu1216_config,
+ adapter,
+ read_pwm(mantis));
+
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ vp2033_tda1002x_cu1216_config.demod_address);
+ }
}
- }
- if (fe) {
- fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ if (fe) {
+ fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
}
mantis->fe = fe;
.bytes = 0,
.frontend_init = vp2033_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
#include "tda1002x.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp2040.h"
#define MANTIS_MODEL_NAME "VP-2040"
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- fe = tda10021_attach(&vp2040_tda1002x_cu1216_config,
- adapter,
- read_pwm(mantis));
+ int err = 0;
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
- vp2040_tda1002x_cu1216_config.demod_address);
- } else {
- fe = tda10023_attach(&vp2040_tda10023_cu1216_config,
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ fe = tda10021_attach(&vp2040_tda1002x_cu1216_config,
adapter,
read_pwm(mantis));
if (fe) {
dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
vp2040_tda1002x_cu1216_config.demod_address);
+ } else {
+ fe = tda10023_attach(&vp2040_tda10023_cu1216_config,
+ adapter,
+ read_pwm(mantis));
+
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ vp2040_tda1002x_cu1216_config.demod_address);
+ }
}
- }
- if (fe) {
- fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ if (fe) {
+ fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_DEBUG, 1, "Done!");
.bytes = 0,
.frontend_init = vp2040_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
msleep(100);
gpio_set_bits(mantis, config->reset, 1);
- dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
- fe = zl10353_attach(&mantis_vp3030_config, adapter);
+ if (err == 0) {
+ msleep(250);
+ dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+ fe = zl10353_attach(&mantis_vp3030_config, adapter);
- if (!fe)
- return -1;
+ if (!fe)
+ return -1;
- tda665x_attach(fe, &env57h12d5_config, adapter);
+ tda665x_attach(fe, &env57h12d5_config, adapter);
+ } else {
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
+
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
.frontend_init = vp3030_frontend_init,
.power = GPIF_A12,
.reset = GPIF_A13,
+
+ .i2c_mode = MANTIS_BYTE_MODE
};