summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/mt2063.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-21 01:21:42 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-05 01:16:15 +0100
commit0ff4843218d15ccb76f0e17ea5203673d00cd50b (patch)
treeae3b916f83ece0ceb26286c58101f099ff61e133 /drivers/media/common/tuners/mt2063.c
parent[media] mt2063: Fix some Coding styles at mt2063.h (diff)
downloadlinux-0ff4843218d15ccb76f0e17ea5203673d00cd50b.tar.xz
linux-0ff4843218d15ccb76f0e17ea5203673d00cd50b.zip
[media] mt2063: Move code from mt2063_cfg.h
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/mt2063.c')
-rw-r--r--drivers/media/common/tuners/mt2063.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/drivers/media/common/tuners/mt2063.c b/drivers/media/common/tuners/mt2063.c
index 0d64eb839350..1d36e51c4048 100644
--- a/drivers/media/common/tuners/mt2063.c
+++ b/drivers/media/common/tuners/mt2063.c
@@ -13,6 +13,135 @@
static unsigned int verbose;
module_param(verbose, int, 0644);
+
+/*****************/
+/* From drivers/media/common/tuners/mt2063_cfg.h */
+
+static unsigned int mt2063_setTune(struct dvb_frontend *fe, UData_t f_in,
+ UData_t bw_in,
+ enum MTTune_atv_standard tv_type)
+{
+ //return (int)MT_Tune_atv(h, f_in, bw_in, tv_type);
+
+ struct dvb_frontend_ops *frontend_ops = NULL;
+ struct dvb_tuner_ops *tuner_ops = NULL;
+ struct tuner_state t_state;
+ struct mt2063_state *mt2063State = fe->tuner_priv;
+ int err = 0;
+
+ t_state.frequency = f_in;
+ t_state.bandwidth = bw_in;
+ mt2063State->tv_type = tv_type;
+ if (&fe->ops)
+ frontend_ops = &fe->ops;
+ if (&frontend_ops->tuner_ops)
+ tuner_ops = &frontend_ops->tuner_ops;
+ if (tuner_ops->set_state) {
+ if ((err =
+ tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY,
+ &t_state)) < 0) {
+ printk("%s: Invalid parameter\n", __func__);
+ return err;
+ }
+ }
+
+ return err;
+}
+
+static unsigned int mt2063_lockStatus(struct dvb_frontend *fe)
+{
+ struct dvb_frontend_ops *frontend_ops = &fe->ops;
+ struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
+ struct tuner_state t_state;
+ int err = 0;
+
+ if (&fe->ops)
+ frontend_ops = &fe->ops;
+ if (&frontend_ops->tuner_ops)
+ tuner_ops = &frontend_ops->tuner_ops;
+ if (tuner_ops->get_state) {
+ if ((err =
+ tuner_ops->get_state(fe, DVBFE_TUNER_REFCLOCK,
+ &t_state)) < 0) {
+ printk("%s: Invalid parameter\n", __func__);
+ return err;
+ }
+ }
+ return err;
+}
+
+static unsigned int tuner_MT2063_Open(struct dvb_frontend *fe)
+{
+ struct dvb_frontend_ops *frontend_ops = &fe->ops;
+ struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
+ struct tuner_state t_state;
+ int err = 0;
+
+ if (&fe->ops)
+ frontend_ops = &fe->ops;
+ if (&frontend_ops->tuner_ops)
+ tuner_ops = &frontend_ops->tuner_ops;
+ if (tuner_ops->set_state) {
+ if ((err =
+ tuner_ops->set_state(fe, DVBFE_TUNER_OPEN,
+ &t_state)) < 0) {
+ printk("%s: Invalid parameter\n", __func__);
+ return err;
+ }
+ }
+
+ return err;
+}
+
+static unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe)
+{
+ struct dvb_frontend_ops *frontend_ops = &fe->ops;
+ struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
+ struct tuner_state t_state;
+ int err = 0;
+
+ if (&fe->ops)
+ frontend_ops = &fe->ops;
+ if (&frontend_ops->tuner_ops)
+ tuner_ops = &frontend_ops->tuner_ops;
+ if (tuner_ops->set_state) {
+ if ((err =
+ tuner_ops->set_state(fe, DVBFE_TUNER_SOFTWARE_SHUTDOWN,
+ &t_state)) < 0) {
+ printk("%s: Invalid parameter\n", __func__);
+ return err;
+ }
+ }
+
+ return err;
+}
+
+static unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
+{
+ struct dvb_frontend_ops *frontend_ops = &fe->ops;
+ struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
+ struct tuner_state t_state;
+ int err = 0;
+
+ if (&fe->ops)
+ frontend_ops = &fe->ops;
+ if (&frontend_ops->tuner_ops)
+ tuner_ops = &frontend_ops->tuner_ops;
+ if (tuner_ops->set_state) {
+ if ((err =
+ tuner_ops->set_state(fe, DVBFE_TUNER_CLEAR_POWER_MASKBITS,
+ &t_state)) < 0) {
+ printk("%s: Invalid parameter\n", __func__);
+ return err;
+ }
+ }
+
+ return err;
+}
+
+/*****************/
+
+
//i2c operation
static int mt2063_writeregs(struct mt2063_state *state, u8 reg1,
u8 * data, int len)