2 STB6100 Silicon Tuner wrapper
3 Copyright (C)2009 Igor M. Liplianin (liplianin@me.by)
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 static int stb6100_get_freq(struct dvb_frontend
*fe
, u32
*frequency
)
22 struct dvb_frontend_ops
*frontend_ops
= NULL
;
23 struct dvb_tuner_ops
*tuner_ops
= NULL
;
24 struct tuner_state state
;
28 frontend_ops
= &fe
->ops
;
29 if (&frontend_ops
->tuner_ops
)
30 tuner_ops
= &frontend_ops
->tuner_ops
;
31 if (tuner_ops
->get_state
) {
32 if (frontend_ops
->i2c_gate_ctrl
)
33 frontend_ops
->i2c_gate_ctrl(fe
, 1);
35 err
= tuner_ops
->get_state(fe
, DVBFE_TUNER_FREQUENCY
, &state
);
37 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
41 if (frontend_ops
->i2c_gate_ctrl
)
42 frontend_ops
->i2c_gate_ctrl(fe
, 0);
44 *frequency
= state
.frequency
;
50 static int stb6100_set_freq(struct dvb_frontend
*fe
, u32 frequency
)
52 struct dvb_frontend_ops
*frontend_ops
= NULL
;
53 struct dvb_tuner_ops
*tuner_ops
= NULL
;
54 struct tuner_state state
;
57 state
.frequency
= frequency
;
59 frontend_ops
= &fe
->ops
;
60 if (&frontend_ops
->tuner_ops
)
61 tuner_ops
= &frontend_ops
->tuner_ops
;
62 if (tuner_ops
->set_state
) {
63 if (frontend_ops
->i2c_gate_ctrl
)
64 frontend_ops
->i2c_gate_ctrl(fe
, 1);
66 err
= tuner_ops
->set_state(fe
, DVBFE_TUNER_FREQUENCY
, &state
);
68 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
72 if (frontend_ops
->i2c_gate_ctrl
)
73 frontend_ops
->i2c_gate_ctrl(fe
, 0);
80 static int stb6100_get_bandw(struct dvb_frontend
*fe
, u32
*bandwidth
)
82 struct dvb_frontend_ops
*frontend_ops
= NULL
;
83 struct dvb_tuner_ops
*tuner_ops
= NULL
;
84 struct tuner_state state
;
88 frontend_ops
= &fe
->ops
;
89 if (&frontend_ops
->tuner_ops
)
90 tuner_ops
= &frontend_ops
->tuner_ops
;
91 if (tuner_ops
->get_state
) {
92 if (frontend_ops
->i2c_gate_ctrl
)
93 frontend_ops
->i2c_gate_ctrl(fe
, 1);
95 err
= tuner_ops
->get_state(fe
, DVBFE_TUNER_BANDWIDTH
, &state
);
97 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
101 if (frontend_ops
->i2c_gate_ctrl
)
102 frontend_ops
->i2c_gate_ctrl(fe
, 0);
104 *bandwidth
= state
.bandwidth
;
110 static int stb6100_set_bandw(struct dvb_frontend
*fe
, u32 bandwidth
)
112 struct dvb_frontend_ops
*frontend_ops
= NULL
;
113 struct dvb_tuner_ops
*tuner_ops
= NULL
;
114 struct tuner_state state
;
117 state
.bandwidth
= bandwidth
;
119 frontend_ops
= &fe
->ops
;
120 if (&frontend_ops
->tuner_ops
)
121 tuner_ops
= &frontend_ops
->tuner_ops
;
122 if (tuner_ops
->set_state
) {
123 if (frontend_ops
->i2c_gate_ctrl
)
124 frontend_ops
->i2c_gate_ctrl(fe
, 1);
126 err
= tuner_ops
->set_state(fe
, DVBFE_TUNER_BANDWIDTH
, &state
);
128 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
132 if (frontend_ops
->i2c_gate_ctrl
)
133 frontend_ops
->i2c_gate_ctrl(fe
, 0);