1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
6 Copyright (C) ST Microelectronics
10 #include <linux/dvb/frontend.h>
11 #include <media/dvb_frontend.h>
13 static int stb6100_get_frequency(struct dvb_frontend
*fe
, u32
*frequency
)
15 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
16 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
19 if (tuner_ops
->get_frequency
) {
20 err
= tuner_ops
->get_frequency(fe
, frequency
);
22 printk("%s: Invalid parameter\n", __func__
);
29 static int stb6100_set_frequency(struct dvb_frontend
*fe
, u32 frequency
)
31 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
32 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
33 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
34 u32 bw
= c
->bandwidth_hz
;
37 c
->frequency
= frequency
;
38 c
->bandwidth_hz
= 0; /* Don't adjust the bandwidth */
40 if (tuner_ops
->set_params
) {
41 err
= tuner_ops
->set_params(fe
);
44 printk("%s: Invalid parameter\n", __func__
);
51 static int stb6100_get_bandwidth(struct dvb_frontend
*fe
, u32
*bandwidth
)
53 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
54 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
57 if (tuner_ops
->get_bandwidth
) {
58 err
= tuner_ops
->get_bandwidth(fe
, bandwidth
);
60 printk("%s: Invalid parameter\n", __func__
);
67 static int stb6100_set_bandwidth(struct dvb_frontend
*fe
, u32 bandwidth
)
69 struct dvb_frontend_ops
*frontend_ops
= &fe
->ops
;
70 struct dvb_tuner_ops
*tuner_ops
= &frontend_ops
->tuner_ops
;
71 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
72 u32 freq
= c
->frequency
;
75 c
->bandwidth_hz
= bandwidth
;
76 c
->frequency
= 0; /* Don't adjust the frequency */
78 if (tuner_ops
->set_params
) {
79 err
= tuner_ops
->set_params(fe
);
82 printk("%s: Invalid parameter\n", __func__
);