From 54d859ec563d2f0cbbc03e45e204325c5f2118bf Mon Sep 17 00:00:00 2001 From: Andreas Regel Date: Tue, 7 Apr 2009 16:09:52 -0300 Subject: [PATCH] V4L/DVB (11583): isl6423: Various fixes to use external modulation Use external modulation Signed-off-by: Andreas Regel Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/isl6423.c | 35 +++++++++++++++++++-------- drivers/media/dvb/ttpci/budget-ci.c | 1 + 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb/frontends/isl6423.c b/drivers/media/dvb/frontends/isl6423.c index c1943dcb8db6..dca5bebfeeb5 100644 --- a/drivers/media/dvb/frontends/isl6423.c +++ b/drivers/media/dvb/frontends/isl6423.c @@ -73,6 +73,7 @@ static int isl6423_write(struct isl6423_dev *isl6423, u8 reg) struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = ®, .len = 1 }; + dprintk(FE_DEBUG, 1, "write reg %02X", reg); err = i2c_transfer(i2c, &msg, 1); if (err < 0) goto exit; @@ -133,6 +134,9 @@ static int isl6423_voltage_boost(struct dvb_frontend *fe, long arg) if (err < 0) goto exit; + isl6423->reg_3 = reg_3; + isl6423->reg_4 = reg_4; + return 0; exit: dprintk(FE_ERROR, 1, "I/O error <%d>", err); @@ -144,12 +148,10 @@ static int isl6423_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage) { struct isl6423_dev *isl6423 = (struct isl6423_dev *) fe->sec_priv; + u8 reg_3 = isl6423->reg_3; u8 reg_4 = isl6423->reg_4; int err = 0; - /* SR4H = 0, SR4M = 1, SR4L = 1 */ - reg_4 = 0x03 << 5; - switch (voltage) { case SEC_VOLTAGE_OFF: /* EN = 0 */ @@ -160,6 +162,7 @@ static int isl6423_set_voltage(struct dvb_frontend *fe, /* EN = 1, VSPEN = 1, VTOP = 0, VBOT = 0 */ reg_4 |= (1 << 4); reg_4 &= ~0x3; + reg_3 |= (1 << 3); break; case SEC_VOLTAGE_18: @@ -167,15 +170,23 @@ static int isl6423_set_voltage(struct dvb_frontend *fe, reg_4 |= (1 << 4); reg_4 |= 0x2; reg_4 &= ~0x1; + reg_3 |= (1 << 3); break; default: break; } + err = isl6423_write(isl6423, reg_3); + if (err < 0) + goto exit; + err = isl6423_write(isl6423, reg_4); if (err < 0) goto exit; + isl6423->reg_3 = reg_3; + isl6423->reg_4 = reg_4; + return 0; exit: dprintk(FE_ERROR, 1, "I/O error <%d>", err); @@ -189,9 +200,6 @@ static int isl6423_set_current(struct dvb_frontend *fe) const struct isl6423_config *config = isl6423->config; int err = 0; - /* SR3H = 0, SR3M = 1, SR3L = 0 */ - reg_3 = 0x02 << 5; - switch (config->current_max) { case SEC_CURRENT_275m: /* 275mA */ @@ -226,13 +234,13 @@ static int isl6423_set_current(struct dvb_frontend *fe) switch (config->curlim) { case SEC_CURRENT_LIM_ON: - /* DCL = 1 */ - reg_3 |= 0x10; + /* DCL = 0 */ + reg_3 &= ~0x10; break; case SEC_CURRENT_LIM_OFF: - /* DCL = 0 */ - reg_3 &= ~0x10; + /* DCL = 1 */ + reg_3 |= 0x10; break; } @@ -240,6 +248,8 @@ static int isl6423_set_current(struct dvb_frontend *fe) if (err < 0) goto exit; + isl6423->reg_3 = reg_3; + return 0; exit: dprintk(FE_ERROR, 1, "I/O error <%d>", err); @@ -268,6 +278,11 @@ struct dvb_frontend *isl6423_attach(struct dvb_frontend *fe, isl6423->i2c = i2c; fe->sec_priv = isl6423; + /* SR3H = 0, SR3M = 1, SR3L = 0 */ + isl6423->reg_3 = 0x02 << 5; + /* SR4H = 0, SR4M = 1, SR4L = 1 */ + isl6423->reg_4 = 0x03 << 5; + if (isl6423_set_current(fe)) goto exit; diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index dbdc7953c6a1..e1c83c513f3c 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -1383,6 +1383,7 @@ static struct stv6110x_config tt1600_stv6110x_config = { static struct isl6423_config tt1600_isl6423_config = { .current_max = SEC_CURRENT_515m, .curlim = SEC_CURRENT_LIM_ON, + .mod_extern = 1, .addr = 0x08, }; -- GitLab