• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 	STB6100 Silicon Tuner
3 	Copyright (C) Manu Abraham (abraham.manu@gmail.com)
4 
5 	Copyright (C) ST Microelectronics
6 
7 	This program is free software; you can redistribute it and/or modify
8 	it under the terms of the GNU General Public License as published by
9 	the Free Software Foundation; either version 2 of the License, or
10 	(at your option) any later version.
11 
12 	This program is distributed in the hope that it will be useful,
13 	but WITHOUT ANY WARRANTY; without even the implied warranty of
14 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 	GNU General Public License for more details.
16 
17 	You should have received a copy of the GNU General Public License
18 	along with this program; if not, write to the Free Software
19 	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 
stb6100_get_frequency(struct dvb_frontend * fe,u32 * frequency)22 static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
23 {
24 	struct dvb_frontend_ops	*frontend_ops = NULL;
25 	struct dvb_tuner_ops	*tuner_ops = NULL;
26 	struct tuner_state	t_state;
27 	int err = 0;
28 
29 	if (&fe->ops)
30 		frontend_ops = &fe->ops;
31 	if (&frontend_ops->tuner_ops)
32 		tuner_ops = &frontend_ops->tuner_ops;
33 	if (tuner_ops->get_state) {
34 		if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
35 			printk("%s: Invalid parameter\n", __func__);
36 			return err;
37 		}
38 		*frequency = t_state.frequency;
39 	}
40 	return 0;
41 }
42 
stb6100_set_frequency(struct dvb_frontend * fe,u32 frequency)43 static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
44 {
45 	struct dvb_frontend_ops	*frontend_ops = NULL;
46 	struct dvb_tuner_ops	*tuner_ops = NULL;
47 	struct tuner_state	t_state;
48 	int err = 0;
49 
50 	t_state.frequency = frequency;
51 	if (&fe->ops)
52 		frontend_ops = &fe->ops;
53 	if (&frontend_ops->tuner_ops)
54 		tuner_ops = &frontend_ops->tuner_ops;
55 	if (tuner_ops->set_state) {
56 		if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
57 			printk("%s: Invalid parameter\n", __func__);
58 			return err;
59 		}
60 	}
61 	return 0;
62 }
63 
stb6100_get_bandwidth(struct dvb_frontend * fe,u32 * bandwidth)64 static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
65 {
66 	struct dvb_frontend_ops	*frontend_ops = &fe->ops;
67 	struct dvb_tuner_ops	*tuner_ops = &frontend_ops->tuner_ops;
68 	struct tuner_state	t_state;
69 	int err = 0;
70 
71 	if (&fe->ops)
72 		frontend_ops = &fe->ops;
73 	if (&frontend_ops->tuner_ops)
74 		tuner_ops = &frontend_ops->tuner_ops;
75 	if (tuner_ops->get_state) {
76 		if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
77 			printk("%s: Invalid parameter\n", __func__);
78 			return err;
79 		}
80 		*bandwidth = t_state.bandwidth;
81 	}
82 	return 0;
83 }
84 
stb6100_set_bandwidth(struct dvb_frontend * fe,u32 bandwidth)85 static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
86 {
87 	struct dvb_frontend_ops	*frontend_ops = NULL;
88 	struct dvb_tuner_ops	*tuner_ops = NULL;
89 	struct tuner_state	t_state;
90 	int err = 0;
91 
92 	t_state.bandwidth = bandwidth;
93 	if (&fe->ops)
94 		frontend_ops = &fe->ops;
95 	if (&frontend_ops->tuner_ops)
96 		tuner_ops = &frontend_ops->tuner_ops;
97 	if (tuner_ops->set_state) {
98 		if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
99 			printk("%s: Invalid parameter\n", __func__);
100 			return err;
101 		}
102 	}
103 	return 0;
104 }
105