blob: 04a19e14ee5a41e82dd22e9c2ae07978d142cecc [file] [log] [blame]
Manu Abraham8be969b2008-01-25 18:20:48 -03001/*
2 TDA8261 8PSK/QPSK tuner driver
3 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
4
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.
9
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.
14
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.
18*/
19
20static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
21{
Emil Goode20721182014-06-24 18:42:27 -030022 struct dvb_frontend_ops *frontend_ops = &fe->ops;
23 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
Manu Abraham8be969b2008-01-25 18:20:48 -030024 struct tuner_state t_state;
25 int err = 0;
26
Manu Abraham8be969b2008-01-25 18:20:48 -030027 if (tuner_ops->get_state) {
Emil Goode8f73b482014-06-24 18:42:28 -030028 err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state);
29 if (err < 0) {
Manu Abraham8be969b2008-01-25 18:20:48 -030030 printk("%s: Invalid parameter\n", __func__);
31 return err;
32 }
33 *frequency = t_state.frequency;
34 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
35 }
36 return 0;
37}
38
39static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency)
40{
Emil Goode20721182014-06-24 18:42:27 -030041 struct dvb_frontend_ops *frontend_ops = &fe->ops;
42 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
Manu Abraham8be969b2008-01-25 18:20:48 -030043 struct tuner_state t_state;
44 int err = 0;
45
46 t_state.frequency = frequency;
Emil Goode20721182014-06-24 18:42:27 -030047
Manu Abraham8be969b2008-01-25 18:20:48 -030048 if (tuner_ops->set_state) {
Emil Goode8f73b482014-06-24 18:42:28 -030049 err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state);
50 if (err < 0) {
Manu Abraham8be969b2008-01-25 18:20:48 -030051 printk("%s: Invalid parameter\n", __func__);
52 return err;
53 }
54 }
55 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
56 return 0;
57}
58
59static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
60{
61 struct dvb_frontend_ops *frontend_ops = &fe->ops;
62 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
63 struct tuner_state t_state;
64 int err = 0;
65
Manu Abraham8be969b2008-01-25 18:20:48 -030066 if (tuner_ops->get_state) {
Emil Goode8f73b482014-06-24 18:42:28 -030067 err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state);
68 if (err < 0) {
Manu Abraham8be969b2008-01-25 18:20:48 -030069 printk("%s: Invalid parameter\n", __func__);
70 return err;
71 }
72 *bandwidth = t_state.bandwidth;
Paul Bollecb31c742012-11-01 16:24:30 -030073 printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
Manu Abraham8be969b2008-01-25 18:20:48 -030074 }
Manu Abraham8be969b2008-01-25 18:20:48 -030075 return 0;
76}