summaryrefslogtreecommitdiff
path: root/drivers/media/dvb/frontends/isl6423.c
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@gmx.de>2009-04-07 19:09:52 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 21:20:38 (GMT)
commit54d859ec563d2f0cbbc03e45e204325c5f2118bf (patch)
treee104962e867e5af697d52e2d87e78430e3d89381 /drivers/media/dvb/frontends/isl6423.c
parent5657150759ab67292db0333808a069970328663b (diff)
downloadlinux-54d859ec563d2f0cbbc03e45e204325c5f2118bf.tar.xz
V4L/DVB (11583): isl6423: Various fixes to use external modulation
Use external modulation Signed-off-by: Andreas Regel <andreas.regel@gmx.de> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/isl6423.c')
-rw-r--r--drivers/media/dvb/frontends/isl6423.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/isl6423.c b/drivers/media/dvb/frontends/isl6423.c
index c1943dc..dca5beb 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 = &reg, .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;