xref: /openbmc/linux/drivers/media/dvb-frontends/tda8261_cfg.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
29a0bf528SMauro Carvalho Chehab /*
39a0bf528SMauro Carvalho Chehab 	TDA8261 8PSK/QPSK tuner driver
49a0bf528SMauro Carvalho Chehab 	Copyright (C) Manu Abraham (abraham.manu@gmail.com)
59a0bf528SMauro Carvalho Chehab 
69a0bf528SMauro Carvalho Chehab */
79a0bf528SMauro Carvalho Chehab 
tda8261_get_frequency(struct dvb_frontend * fe,u32 * frequency)89a0bf528SMauro Carvalho Chehab static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
99a0bf528SMauro Carvalho Chehab {
1020721185SEmil Goode 	struct dvb_frontend_ops	*frontend_ops = &fe->ops;
1120721185SEmil Goode 	struct dvb_tuner_ops	*tuner_ops = &frontend_ops->tuner_ops;
129a0bf528SMauro Carvalho Chehab 	int err = 0;
139a0bf528SMauro Carvalho Chehab 
14e417668dSMauro Carvalho Chehab 	if (tuner_ops->get_frequency) {
15e417668dSMauro Carvalho Chehab 		err = tuner_ops->get_frequency(fe, frequency);
168f73b481SEmil Goode 		if (err < 0) {
17e417668dSMauro Carvalho Chehab 			pr_err("%s: Invalid parameter\n", __func__);
189a0bf528SMauro Carvalho Chehab 			return err;
199a0bf528SMauro Carvalho Chehab 		}
20e417668dSMauro Carvalho Chehab 		pr_debug("%s: Frequency=%d\n", __func__, *frequency);
219a0bf528SMauro Carvalho Chehab 	}
229a0bf528SMauro Carvalho Chehab 	return 0;
239a0bf528SMauro Carvalho Chehab }
249a0bf528SMauro Carvalho Chehab 
tda8261_set_frequency(struct dvb_frontend * fe,u32 frequency)259a0bf528SMauro Carvalho Chehab static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency)
269a0bf528SMauro Carvalho Chehab {
2720721185SEmil Goode 	struct dvb_frontend_ops	*frontend_ops = &fe->ops;
2820721185SEmil Goode 	struct dvb_tuner_ops	*tuner_ops = &frontend_ops->tuner_ops;
29e417668dSMauro Carvalho Chehab 	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
309a0bf528SMauro Carvalho Chehab 	int err = 0;
319a0bf528SMauro Carvalho Chehab 
32e417668dSMauro Carvalho Chehab 	if (tuner_ops->set_params) {
33e417668dSMauro Carvalho Chehab 		err = tuner_ops->set_params(fe);
348f73b481SEmil Goode 		if (err < 0) {
35e417668dSMauro Carvalho Chehab 			pr_err("%s: Invalid parameter\n", __func__);
369a0bf528SMauro Carvalho Chehab 			return err;
379a0bf528SMauro Carvalho Chehab 		}
389a0bf528SMauro Carvalho Chehab 	}
39e417668dSMauro Carvalho Chehab 	pr_debug("%s: Frequency=%d\n", __func__, c->frequency);
409a0bf528SMauro Carvalho Chehab 	return 0;
419a0bf528SMauro Carvalho Chehab }
429a0bf528SMauro Carvalho Chehab 
tda8261_get_bandwidth(struct dvb_frontend * fe,u32 * bandwidth)439a0bf528SMauro Carvalho Chehab static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
449a0bf528SMauro Carvalho Chehab {
45e417668dSMauro Carvalho Chehab 	/* FIXME! need to calculate Bandwidth */
46e417668dSMauro Carvalho Chehab 	*bandwidth = 40000000;
479a0bf528SMauro Carvalho Chehab 
489a0bf528SMauro Carvalho Chehab 	return 0;
499a0bf528SMauro Carvalho Chehab }
50