Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179535
b: refs/heads/master
c: bc832fa
h: refs/heads/master
i:
  179533: 415765d
  179531: 37903eb
  179527: e62873e
  179519: 239df12
v: v3
  • Loading branch information
Manu Abraham authored and Mauro Carvalho Chehab committed Jan 17, 2010
1 parent b822230 commit 7aaae75
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 76 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e978a8284080d801d20cda377d9cf7c12fe68b9
refs/heads/master: bc832fa2c0310c25ed60204616ccef4f8db088f3
27 changes: 20 additions & 7 deletions trunk/drivers/media/dvb/mantis/hopper_vp3028.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,30 @@ struct zl10353_config hopper_vp3028_config = {
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;
Expand Down
13 changes: 10 additions & 3 deletions trunk/drivers/media/dvb/mantis/mantis_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#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) { \
Expand All @@ -43,6 +44,8 @@
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); \
Expand All @@ -54,9 +57,6 @@

#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
Expand All @@ -75,6 +75,11 @@
.driver_data = (unsigned long) (__configptr) \
}

enum mantis_i2c_mode {
MANTIS_PAGE_MODE = 0,
MANTIS_BYTE_MODE,
};

struct mantis_pci;

struct mantis_hwconfig {
Expand All @@ -91,6 +96,8 @@ struct mantis_hwconfig {

u8 power;
u8 reset;

enum mantis_i2c_mode i2c_mode;
};

struct mantis_pci {
Expand Down
47 changes: 37 additions & 10 deletions trunk/drivers/media/dvb/mantis/mantis_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#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;
Expand All @@ -55,13 +57,25 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
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]);
Expand Down Expand Up @@ -93,12 +107,24 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
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");

Expand All @@ -122,10 +148,11 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in

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");

Expand All @@ -136,8 +163,8 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in

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;
Expand Down
36 changes: 27 additions & 9 deletions trunk/drivers/media/dvb/mantis/mantis_vp1033.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

#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,
Expand Down Expand Up @@ -163,19 +166,32 @@ static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
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!");

Expand All @@ -192,4 +208,6 @@ struct mantis_hwconfig vp1033_config = {
.bytes = 0,

.frontend_init = vp1033_frontend_init,
.power = GPIF_A12,
.reset = GPIF_A13,
};
32 changes: 24 additions & 8 deletions trunk/drivers/media/dvb/mantis/mantis_vp1034.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "mb86a16.h"
#include "mantis_common.h"
#include "mantis_ioc.h"
#include "mantis_dvb.h"
#include "mantis_vp1034.h"
#include "mantis_reg.h"

Expand Down Expand Up @@ -74,17 +75,30 @@ static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
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!");

Expand All @@ -101,4 +115,6 @@ struct mantis_hwconfig vp1034_config = {
.bytes = 0,

.frontend_init = vp1034_frontend_init,
.power = GPIF_A12,
.reset = GPIF_A13,
};
50 changes: 34 additions & 16 deletions trunk/drivers/media/dvb/mantis/mantis_vp2033.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#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"
Expand Down Expand Up @@ -123,32 +125,46 @@ static int vp2033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
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;
Expand All @@ -167,4 +183,6 @@ struct mantis_hwconfig vp2033_config = {
.bytes = 0,

.frontend_init = vp2033_frontend_init,
.power = GPIF_A12,
.reset = GPIF_A13,
};
Loading

0 comments on commit 7aaae75

Please sign in to comment.