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 #include <linux/dvb/frontend.h>
21 #include <media/dvb_frontend.h>
23 static int stb6100_get_freq(struct dvb_frontend
*fe
, u32
*frequency
)
25 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
26 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
29 if (tuner_ops
->get_frequency
) {
30 if (frontend_ops
->i2c_gate_ctrl
)
31 frontend_ops
->i2c_gate_ctrl(fe
, 1);
33 err
= tuner_ops
->get_frequency(fe
, frequency
);
35 printk("%s: Invalid parameter\n", __func__
);
39 if (frontend_ops
->i2c_gate_ctrl
)
40 frontend_ops
->i2c_gate_ctrl(fe
, 0);
46 static int stb6100_set_freq(struct dvb_frontend
*fe
, u32 frequency
)
48 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
49 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
50 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
51 u32 bw
= c
->bandwidth_hz
;
54 c
->frequency
= frequency
;
55 c
->bandwidth_hz
= 0; /* Don't adjust the bandwidth */
57 if (tuner_ops
->set_params
) {
58 if (frontend_ops
->i2c_gate_ctrl
)
59 frontend_ops
->i2c_gate_ctrl(fe
, 1);
61 err
= tuner_ops
->set_params(fe
);
64 printk("%s: Invalid parameter\n", __func__
);
68 if (frontend_ops
->i2c_gate_ctrl
)
69 frontend_ops
->i2c_gate_ctrl(fe
, 0);
76 static int stb6100_get_bandw(struct dvb_frontend
*fe
, u32
*bandwidth
)
78 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
79 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
82 if (tuner_ops
->get_bandwidth
) {
83 if (frontend_ops
->i2c_gate_ctrl
)
84 frontend_ops
->i2c_gate_ctrl(fe
, 1);
86 err
= tuner_ops
->get_bandwidth(fe
, bandwidth
);
88 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
92 if (frontend_ops
->i2c_gate_ctrl
)
93 frontend_ops
->i2c_gate_ctrl(fe
, 0);
99 static int stb6100_set_bandw(struct dvb_frontend
*fe
, u32 bandwidth
)
101 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
102 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
103 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
104 u32 freq
= c
->frequency
;
107 c
->bandwidth_hz
= bandwidth
;
108 c
->frequency
= 0; /* Don't adjust the frequency */
110 if (tuner_ops
->set_params
) {
111 if (frontend_ops
->i2c_gate_ctrl
)
112 frontend_ops
->i2c_gate_ctrl(fe
, 1);
114 err
= tuner_ops
->set_params(fe
);
117 printk(KERN_ERR
"%s: Invalid parameter\n", __func__
);
121 if (frontend_ops
->i2c_gate_ctrl
)
122 frontend_ops
->i2c_gate_ctrl(fe
, 0);