summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/mt2063_cfg.h
blob: 5f80f02ed090b9c9c6e5de318db1ffec1d582238 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

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;
}