diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-10-24 08:55:54 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:01:14 -0500 |
commit | 7d11c53c5d909d866dee0ce5db2d6ca1c422edca (patch) | |
tree | 9e83b6f4f347298b01ceb589808a8a78f0509125 /drivers/media | |
parent | a72dd305f99f6c6e4eff01478ae53fc80ce98fb1 (diff) |
V4L/DVB (6449): tda18271: clean up i2c_gate handling
Call analog_demod_ops->i2c_gate_ctrl when in analog tuning mode, and
frontend_ops.i2c_gate_ctrl when in digital tuning mode.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271.c | 33 |
2 files changed, 26 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 457effcda5da..57e5fa80589b 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ | 5 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ |
6 | EXTRA_CFLAGS += -Idrivers/media/video/ | ||
6 | 7 | ||
7 | obj-$(CONFIG_DVB_PLL) += dvb-pll.o | 8 | obj-$(CONFIG_DVB_PLL) += dvb-pll.o |
8 | obj-$(CONFIG_DVB_STV0299) += stv0299.o | 9 | obj-$(CONFIG_DVB_STV0299) += stv0299.o |
diff --git a/drivers/media/dvb/frontends/tda18271.c b/drivers/media/dvb/frontends/tda18271.c index 1b9c143888ea..aaaa2f885186 100644 --- a/drivers/media/dvb/frontends/tda18271.c +++ b/drivers/media/dvb/frontends/tda18271.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/videodev2.h> | 23 | #include <linux/videodev2.h> |
24 | #include "tuner-driver.h" | ||
24 | 25 | ||
25 | #include "tda18271.h" | 26 | #include "tda18271.h" |
26 | 27 | ||
@@ -324,6 +325,26 @@ struct tda18271_priv { | |||
324 | u32 bandwidth; | 325 | u32 bandwidth; |
325 | }; | 326 | }; |
326 | 327 | ||
328 | static int tda18271_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | ||
329 | { | ||
330 | struct tda18271_priv *priv = fe->tuner_priv; | ||
331 | struct analog_tuner_ops *ops = fe->ops.analog_demod_ops; | ||
332 | int ret = 0; | ||
333 | |||
334 | switch (priv->mode) { | ||
335 | case TDA18271_ANALOG: | ||
336 | if (ops && ops->i2c_gate_ctrl) | ||
337 | ret = ops->i2c_gate_ctrl(fe, enable); | ||
338 | break; | ||
339 | case TDA18271_DIGITAL: | ||
340 | if (fe->ops.i2c_gate_ctrl) | ||
341 | ret = fe->ops.i2c_gate_ctrl(fe, enable); | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | return ret; | ||
346 | }; | ||
347 | |||
327 | /*---------------------------------------------------------------------*/ | 348 | /*---------------------------------------------------------------------*/ |
328 | 349 | ||
329 | static void tda18271_dump_regs(struct dvb_frontend *fe) | 350 | static void tda18271_dump_regs(struct dvb_frontend *fe) |
@@ -363,14 +384,12 @@ static void tda18271_read_regs(struct dvb_frontend *fe) | |||
363 | .buf = regs, .len = 16 } | 384 | .buf = regs, .len = 16 } |
364 | }; | 385 | }; |
365 | 386 | ||
366 | if (fe->ops.i2c_gate_ctrl) | 387 | tda18271_i2c_gate_ctrl(fe, 1); |
367 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
368 | 388 | ||
369 | /* read all registers */ | 389 | /* read all registers */ |
370 | ret = i2c_transfer(priv->i2c_adap, msg, 2); | 390 | ret = i2c_transfer(priv->i2c_adap, msg, 2); |
371 | 391 | ||
372 | if (fe->ops.i2c_gate_ctrl) | 392 | tda18271_i2c_gate_ctrl(fe, 0); |
373 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
374 | 393 | ||
375 | if (ret != 2) | 394 | if (ret != 2) |
376 | printk("ERROR: %s: i2c_transfer returned: %d\n", | 395 | printk("ERROR: %s: i2c_transfer returned: %d\n", |
@@ -396,14 +415,12 @@ static void tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) | |||
396 | buf[i] = regs[idx-1+i]; | 415 | buf[i] = regs[idx-1+i]; |
397 | } | 416 | } |
398 | 417 | ||
399 | if (fe->ops.i2c_gate_ctrl) | 418 | tda18271_i2c_gate_ctrl(fe, 1); |
400 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
401 | 419 | ||
402 | /* write registers */ | 420 | /* write registers */ |
403 | ret = i2c_transfer(priv->i2c_adap, &msg, 1); | 421 | ret = i2c_transfer(priv->i2c_adap, &msg, 1); |
404 | 422 | ||
405 | if (fe->ops.i2c_gate_ctrl) | 423 | tda18271_i2c_gate_ctrl(fe, 0); |
406 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
407 | 424 | ||
408 | if (ret != 1) | 425 | if (ret != 1) |
409 | printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n", | 426 | printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n", |