xref: /linux/drivers/media/dvb-frontends/ts2020.h (revision c7275ae16114bd6be4cb83ee02bf801c303a2225)
16fef4fc7SKonstantin Dimitrov /*
26fef4fc7SKonstantin Dimitrov     Montage Technology TS2020 - Silicon Tuner driver
36fef4fc7SKonstantin Dimitrov     Copyright (C) 2009-2012 Konstantin Dimitrov <kosio.dimitrov@gmail.com>
46fef4fc7SKonstantin Dimitrov 
56fef4fc7SKonstantin Dimitrov     Copyright (C) 2009-2012 TurboSight.com
66fef4fc7SKonstantin Dimitrov 
76fef4fc7SKonstantin Dimitrov     This program is free software; you can redistribute it and/or modify
86fef4fc7SKonstantin Dimitrov     it under the terms of the GNU General Public License as published by
96fef4fc7SKonstantin Dimitrov     the Free Software Foundation; either version 2 of the License, or
106fef4fc7SKonstantin Dimitrov     (at your option) any later version.
116fef4fc7SKonstantin Dimitrov 
126fef4fc7SKonstantin Dimitrov     This program is distributed in the hope that it will be useful,
136fef4fc7SKonstantin Dimitrov     but WITHOUT ANY WARRANTY; without even the implied warranty of
146fef4fc7SKonstantin Dimitrov     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
156fef4fc7SKonstantin Dimitrov     GNU General Public License for more details.
166fef4fc7SKonstantin Dimitrov 
176fef4fc7SKonstantin Dimitrov     You should have received a copy of the GNU General Public License
186fef4fc7SKonstantin Dimitrov     along with this program; if not, write to the Free Software
196fef4fc7SKonstantin Dimitrov     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
206fef4fc7SKonstantin Dimitrov  */
216fef4fc7SKonstantin Dimitrov 
226fef4fc7SKonstantin Dimitrov #ifndef TS2020_H
236fef4fc7SKonstantin Dimitrov #define TS2020_H
246fef4fc7SKonstantin Dimitrov 
25782d8b74SMauro Carvalho Chehab #include <linux/kconfig.h>
266fef4fc7SKonstantin Dimitrov #include <linux/dvb/frontend.h>
276fef4fc7SKonstantin Dimitrov 
286fef4fc7SKonstantin Dimitrov struct ts2020_config {
296fef4fc7SKonstantin Dimitrov 	u8 tuner_address;
3003a67279SJohn Horan 	u32 frequency_div;
31abd9025bSAntti Palosaari 
32abd9025bSAntti Palosaari 	/*
33abd9025bSAntti Palosaari 	 * RF loop-through
34abd9025bSAntti Palosaari 	 */
350f20baadSDavid Howells 	bool loop_through:1;
36abd9025bSAntti Palosaari 
37abd9025bSAntti Palosaari 	/*
38abd9025bSAntti Palosaari 	 * clock output
39abd9025bSAntti Palosaari 	 */
40abd9025bSAntti Palosaari #define TS2020_CLK_OUT_DISABLED        0
41abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED         1
42abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED_XTALOUT 2
43abd9025bSAntti Palosaari 	u8 clk_out:2;
44abd9025bSAntti Palosaari 
45abd9025bSAntti Palosaari 	/*
46abd9025bSAntti Palosaari 	 * clock output divider
47abd9025bSAntti Palosaari 	 * 1 - 31
48abd9025bSAntti Palosaari 	 */
49abd9025bSAntti Palosaari 	u8 clk_out_div:5;
50abd9025bSAntti Palosaari 
51*c7275ae1SDavid Howells 	/* Set to true to suppress stat polling */
52*c7275ae1SDavid Howells 	bool dont_poll:1;
53*c7275ae1SDavid Howells 
54abd9025bSAntti Palosaari 	/*
55abd9025bSAntti Palosaari 	 * pointer to DVB frontend
56abd9025bSAntti Palosaari 	 */
57abd9025bSAntti Palosaari 	struct dvb_frontend *fe;
58e6ad9ce3SAntti Palosaari 
59e6ad9ce3SAntti Palosaari 	/*
60e6ad9ce3SAntti Palosaari 	 * driver private, do not set value
61e6ad9ce3SAntti Palosaari 	 */
62e6ad9ce3SAntti Palosaari 	u8 attach_in_use:1;
630f91c9d6SDavid Howells 
640f91c9d6SDavid Howells 	/* Operation to be called by the ts2020 driver to get the value of the
650f91c9d6SDavid Howells 	 * AGC PWM tuner input as theoretically output by the demodulator.
660f91c9d6SDavid Howells 	 */
670f91c9d6SDavid Howells 	int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
686fef4fc7SKonstantin Dimitrov };
696fef4fc7SKonstantin Dimitrov 
70e6ad9ce3SAntti Palosaari /* Do not add new ts2020_attach() users! Use I2C bindings instead. */
719b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_TS2020)
726fef4fc7SKonstantin Dimitrov extern struct dvb_frontend *ts2020_attach(
736fef4fc7SKonstantin Dimitrov 	struct dvb_frontend *fe,
746fef4fc7SKonstantin Dimitrov 	const struct ts2020_config *config,
756fef4fc7SKonstantin Dimitrov 	struct i2c_adapter *i2c);
766fef4fc7SKonstantin Dimitrov #else
776fef4fc7SKonstantin Dimitrov static inline struct dvb_frontend *ts2020_attach(
786fef4fc7SKonstantin Dimitrov 	struct dvb_frontend *fe,
796fef4fc7SKonstantin Dimitrov 	const struct ts2020_config *config,
806fef4fc7SKonstantin Dimitrov 	struct i2c_adapter *i2c)
816fef4fc7SKonstantin Dimitrov {
826fef4fc7SKonstantin Dimitrov 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
836fef4fc7SKonstantin Dimitrov 	return NULL;
846fef4fc7SKonstantin Dimitrov }
856fef4fc7SKonstantin Dimitrov #endif
866fef4fc7SKonstantin Dimitrov 
876fef4fc7SKonstantin Dimitrov #endif /* TS2020_H */
88