diff options
Diffstat (limited to 'drivers/media/dvb/frontends/stb6100_cfg.h')
-rw-r--r-- | drivers/media/dvb/frontends/stb6100_cfg.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stb6100_cfg.h b/drivers/media/dvb/frontends/stb6100_cfg.h new file mode 100644 index 000000000000..d3133405dc03 --- /dev/null +++ b/drivers/media/dvb/frontends/stb6100_cfg.h | |||
@@ -0,0 +1,108 @@ | |||
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 | |||
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 | printk("%s: Frequency=%d\n", __func__, t_state.frequency); | ||
40 | } | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency) | ||
45 | { | ||
46 | struct dvb_frontend_ops *frontend_ops = NULL; | ||
47 | struct dvb_tuner_ops *tuner_ops = NULL; | ||
48 | struct tuner_state t_state; | ||
49 | int err = 0; | ||
50 | |||
51 | t_state.frequency = frequency; | ||
52 | if (&fe->ops) | ||
53 | frontend_ops = &fe->ops; | ||
54 | if (&frontend_ops->tuner_ops) | ||
55 | tuner_ops = &frontend_ops->tuner_ops; | ||
56 | if (tuner_ops->set_state) { | ||
57 | if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { | ||
58 | printk("%s: Invalid parameter\n", __func__); | ||
59 | return err; | ||
60 | } | ||
61 | } | ||
62 | printk("%s: Frequency=%d\n", __func__, t_state.frequency); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | ||
67 | { | ||
68 | struct dvb_frontend_ops *frontend_ops = &fe->ops; | ||
69 | struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops; | ||
70 | struct tuner_state t_state; | ||
71 | int err = 0; | ||
72 | |||
73 | if (&fe->ops) | ||
74 | frontend_ops = &fe->ops; | ||
75 | if (&frontend_ops->tuner_ops) | ||
76 | tuner_ops = &frontend_ops->tuner_ops; | ||
77 | if (tuner_ops->get_state) { | ||
78 | if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { | ||
79 | printk("%s: Invalid parameter\n", __func__); | ||
80 | return err; | ||
81 | } | ||
82 | *bandwidth = t_state.bandwidth; | ||
83 | } | ||
84 | printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth) | ||
89 | { | ||
90 | struct dvb_frontend_ops *frontend_ops = NULL; | ||
91 | struct dvb_tuner_ops *tuner_ops = NULL; | ||
92 | struct tuner_state t_state; | ||
93 | int err = 0; | ||
94 | |||
95 | t_state.bandwidth = bandwidth; | ||
96 | if (&fe->ops) | ||
97 | frontend_ops = &fe->ops; | ||
98 | if (&frontend_ops->tuner_ops) | ||
99 | tuner_ops = &frontend_ops->tuner_ops; | ||
100 | if (tuner_ops->set_state) { | ||
101 | if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { | ||
102 | printk("%s: Invalid parameter\n", __func__); | ||
103 | return err; | ||
104 | } | ||
105 | } | ||
106 | printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth); | ||
107 | return 0; | ||
108 | } | ||