]> err.no Git - linux-2.6/commitdiff
V4L/DVB (8529): mxl5007t: enable _init and _sleep power management functionality
authorMichael Krufky <mkrufky@linuxtv.org>
Sat, 12 Jul 2008 21:22:38 +0000 (18:22 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 27 Jul 2008 14:07:30 +0000 (11:07 -0300)
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/common/tuners/mxl5007t.c

index 80cfa9ba1dcf75f20309cb83a17e3ae149d8de4a..f3b193ac6614b422a99f18c5ea315cd9a9a945c3 100644 (file)
@@ -830,27 +830,53 @@ fail:
 static int mxl5007t_init(struct dvb_frontend *fe)
 {
        struct mxl5007t_state *state = fe->tuner_priv;
-       //int ret;
+       int ret;
+       u8 d;
 
        mutex_lock(&state->lock);
-       /* do init */
-//fail:
+
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       ret = mxl5007t_read_reg(state, 0x05, &d);
+       if (mxl_fail(ret))
+               goto fail;
+
+       ret = mxl5007t_write_reg(state, 0x05, d | 0x01);
+       mxl_fail(ret);
+fail:
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 0);
+
        mutex_unlock(&state->lock);
 
-       return 0;//ret;
+       return ret;
 }
 
 static int mxl5007t_sleep(struct dvb_frontend *fe)
 {
        struct mxl5007t_state *state = fe->tuner_priv;
-       //int ret;
+       int ret;
+       u8 d;
 
        mutex_lock(&state->lock);
-       /* do standby */
-//fail:
+
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       ret = mxl5007t_read_reg(state, 0x05, &d);
+       if (mxl_fail(ret))
+               goto fail;
+
+       ret = mxl5007t_write_reg(state, 0x05, d & ~0x01);
+       mxl_fail(ret);
+fail:
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 0);
+
        mutex_unlock(&state->lock);
 
-       return 0;//ret;
+       return ret;
 }
 
 /* ------------------------------------------------------------------------- */