Commit | Line | Data |
---|---|---|
8be969b3 MA |
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 | { | |
20721185 EG |
24 | struct dvb_frontend_ops *frontend_ops = &fe->ops; |
25 | struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops; | |
8be969b3 MA |
26 | struct tuner_state t_state; |
27 | int err = 0; | |
28 | ||
8be969b3 MA |
29 | if (tuner_ops->get_state) { |
30 | if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { | |
31 | printk("%s: Invalid parameter\n", __func__); | |
32 | return err; | |
33 | } | |
34 | *frequency = t_state.frequency; | |
8be969b3 MA |
35 | } |
36 | return 0; | |
37 | } | |
38 | ||
39 | static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency) | |
40 | { | |
20721185 EG |
41 | struct dvb_frontend_ops *frontend_ops = &fe->ops; |
42 | struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops; | |
8be969b3 MA |
43 | struct tuner_state t_state; |
44 | int err = 0; | |
45 | ||
46 | t_state.frequency = frequency; | |
20721185 | 47 | |
8be969b3 MA |
48 | if (tuner_ops->set_state) { |
49 | if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { | |
50 | printk("%s: Invalid parameter\n", __func__); | |
51 | return err; | |
52 | } | |
53 | } | |
8be969b3 MA |
54 | return 0; |
55 | } | |
56 | ||
57 | static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |
58 | { | |
59 | struct dvb_frontend_ops *frontend_ops = &fe->ops; | |
60 | struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops; | |
61 | struct tuner_state t_state; | |
62 | int err = 0; | |
63 | ||
8be969b3 MA |
64 | if (tuner_ops->get_state) { |
65 | if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { | |
66 | printk("%s: Invalid parameter\n", __func__); | |
67 | return err; | |
68 | } | |
69 | *bandwidth = t_state.bandwidth; | |
70 | } | |
8be969b3 MA |
71 | return 0; |
72 | } | |
73 | ||
74 | static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth) | |
75 | { | |
20721185 EG |
76 | struct dvb_frontend_ops *frontend_ops = &fe->ops; |
77 | struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops; | |
8be969b3 MA |
78 | struct tuner_state t_state; |
79 | int err = 0; | |
80 | ||
81 | t_state.bandwidth = bandwidth; | |
20721185 | 82 | |
8be969b3 MA |
83 | if (tuner_ops->set_state) { |
84 | if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { | |
85 | printk("%s: Invalid parameter\n", __func__); | |
86 | return err; | |
87 | } | |
88 | } | |
8be969b3 MA |
89 | return 0; |
90 | } |