xref: /linux/drivers/media/dvb-frontends/ts2020.h (revision abd9025b95619c02f83583c9659298bc65dcdf50)
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;
31*abd9025bSAntti Palosaari 
32*abd9025bSAntti Palosaari 	/*
33*abd9025bSAntti Palosaari 	 * RF loop-through
34*abd9025bSAntti Palosaari 	 */
35*abd9025bSAntti Palosaari 	u8 loop_through:1;
36*abd9025bSAntti Palosaari 
37*abd9025bSAntti Palosaari 	/*
38*abd9025bSAntti Palosaari 	 * clock output
39*abd9025bSAntti Palosaari 	 */
40*abd9025bSAntti Palosaari #define TS2020_CLK_OUT_DISABLED        0
41*abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED         1
42*abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED_XTALOUT 2
43*abd9025bSAntti Palosaari 	u8 clk_out:2;
44*abd9025bSAntti Palosaari 
45*abd9025bSAntti Palosaari 	/*
46*abd9025bSAntti Palosaari 	 * clock output divider
47*abd9025bSAntti Palosaari 	 * 1 - 31
48*abd9025bSAntti Palosaari 	 */
49*abd9025bSAntti Palosaari 	u8 clk_out_div:5;
50*abd9025bSAntti Palosaari 
51*abd9025bSAntti Palosaari 	/*
52*abd9025bSAntti Palosaari 	 * pointer to DVB frontend
53*abd9025bSAntti Palosaari 	 */
54*abd9025bSAntti Palosaari 	struct dvb_frontend *fe;
556fef4fc7SKonstantin Dimitrov };
566fef4fc7SKonstantin Dimitrov 
57782d8b74SMauro Carvalho Chehab #if IS_ENABLED(CONFIG_DVB_TS2020)
586fef4fc7SKonstantin Dimitrov 
596fef4fc7SKonstantin Dimitrov extern struct dvb_frontend *ts2020_attach(
606fef4fc7SKonstantin Dimitrov 	struct dvb_frontend *fe,
616fef4fc7SKonstantin Dimitrov 	const struct ts2020_config *config,
626fef4fc7SKonstantin Dimitrov 	struct i2c_adapter *i2c);
636fef4fc7SKonstantin Dimitrov #else
646fef4fc7SKonstantin Dimitrov static inline struct dvb_frontend *ts2020_attach(
656fef4fc7SKonstantin Dimitrov 	struct dvb_frontend *fe,
666fef4fc7SKonstantin Dimitrov 	const struct ts2020_config *config,
676fef4fc7SKonstantin Dimitrov 	struct i2c_adapter *i2c)
686fef4fc7SKonstantin Dimitrov {
696fef4fc7SKonstantin Dimitrov 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
706fef4fc7SKonstantin Dimitrov 	return NULL;
716fef4fc7SKonstantin Dimitrov }
726fef4fc7SKonstantin Dimitrov #endif
736fef4fc7SKonstantin Dimitrov 
746fef4fc7SKonstantin Dimitrov #endif /* TS2020_H */
75