1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <linux/dvb/frontend.h>
23#include <media/dvb_frontend.h>
24
25static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
26{
27 struct dvb_frontend_ops *frontend_ops = &fe->ops;
28 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
29 int err = 0;
30
31 if (tuner_ops->get_frequency) {
32 err = tuner_ops->get_frequency(fe, frequency);
33 if (err < 0) {
34 printk("%s: Invalid parameter\n", __func__);
35 return err;
36 }
37 }
38 return 0;
39}
40
41static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
42{
43 struct dvb_frontend_ops *frontend_ops = &fe->ops;
44 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
45 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
46 u32 bw = c->bandwidth_hz;
47 int err = 0;
48
49 c->frequency = frequency;
50 c->bandwidth_hz = 0;
51
52 if (tuner_ops->set_params) {
53 err = tuner_ops->set_params(fe);
54 c->bandwidth_hz = bw;
55 if (err < 0) {
56 printk("%s: Invalid parameter\n", __func__);
57 return err;
58 }
59 }
60 return 0;
61}
62
63static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
64{
65 struct dvb_frontend_ops *frontend_ops = &fe->ops;
66 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
67 int err = 0;
68
69 if (tuner_ops->get_bandwidth) {
70 err = tuner_ops->get_bandwidth(fe, bandwidth);
71 if (err < 0) {
72 printk("%s: Invalid parameter\n", __func__);
73 return err;
74 }
75 }
76 return 0;
77}
78
79static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
80{
81 struct dvb_frontend_ops *frontend_ops = &fe->ops;
82 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
83 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
84 u32 freq = c->frequency;
85 int err = 0;
86
87 c->bandwidth_hz = bandwidth;
88 c->frequency = 0;
89
90 if (tuner_ops->set_params) {
91 err = tuner_ops->set_params(fe);
92 c->frequency = freq;
93 if (err < 0) {
94 printk("%s: Invalid parameter\n", __func__);
95 return err;
96 }
97 }
98 return 0;
99}
100