xref: /linux/drivers/media/dvb-frontends/ts2020.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
26fef4fc7SKonstantin Dimitrov /*
36fef4fc7SKonstantin Dimitrov     Montage Technology TS2020 - Silicon Tuner driver
46fef4fc7SKonstantin Dimitrov     Copyright (C) 2009-2012 Konstantin Dimitrov <kosio.dimitrov@gmail.com>
56fef4fc7SKonstantin Dimitrov 
66fef4fc7SKonstantin Dimitrov     Copyright (C) 2009-2012 TurboSight.com
76fef4fc7SKonstantin Dimitrov 
86fef4fc7SKonstantin Dimitrov  */
96fef4fc7SKonstantin Dimitrov 
106fef4fc7SKonstantin Dimitrov #ifndef TS2020_H
116fef4fc7SKonstantin Dimitrov #define TS2020_H
126fef4fc7SKonstantin Dimitrov 
136fef4fc7SKonstantin Dimitrov #include <linux/dvb/frontend.h>
146fef4fc7SKonstantin Dimitrov 
156fef4fc7SKonstantin Dimitrov struct ts2020_config {
166fef4fc7SKonstantin Dimitrov 	u8 tuner_address;
1703a67279SJohn Horan 	u32 frequency_div;
18abd9025bSAntti Palosaari 
19abd9025bSAntti Palosaari 	/*
20abd9025bSAntti Palosaari 	 * RF loop-through
21abd9025bSAntti Palosaari 	 */
220f20baadSDavid Howells 	bool loop_through:1;
23abd9025bSAntti Palosaari 
24abd9025bSAntti Palosaari 	/*
25abd9025bSAntti Palosaari 	 * clock output
26abd9025bSAntti Palosaari 	 */
27abd9025bSAntti Palosaari #define TS2020_CLK_OUT_DISABLED        0
28abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED         1
29abd9025bSAntti Palosaari #define TS2020_CLK_OUT_ENABLED_XTALOUT 2
30abd9025bSAntti Palosaari 	u8 clk_out:2;
31abd9025bSAntti Palosaari 
32abd9025bSAntti Palosaari 	/*
33abd9025bSAntti Palosaari 	 * clock output divider
34abd9025bSAntti Palosaari 	 * 1 - 31
35abd9025bSAntti Palosaari 	 */
36abd9025bSAntti Palosaari 	u8 clk_out_div:5;
37abd9025bSAntti Palosaari 
38c7275ae1SDavid Howells 	/* Set to true to suppress stat polling */
39c7275ae1SDavid Howells 	bool dont_poll:1;
40c7275ae1SDavid Howells 
41abd9025bSAntti Palosaari 	/*
42abd9025bSAntti Palosaari 	 * pointer to DVB frontend
43abd9025bSAntti Palosaari 	 */
44abd9025bSAntti Palosaari 	struct dvb_frontend *fe;
45e6ad9ce3SAntti Palosaari 
46e6ad9ce3SAntti Palosaari 	/*
47e6ad9ce3SAntti Palosaari 	 * driver private, do not set value
48e6ad9ce3SAntti Palosaari 	 */
49e6ad9ce3SAntti Palosaari 	u8 attach_in_use:1;
500f91c9d6SDavid Howells 
510f91c9d6SDavid Howells 	/* Operation to be called by the ts2020 driver to get the value of the
520f91c9d6SDavid Howells 	 * AGC PWM tuner input as theoretically output by the demodulator.
530f91c9d6SDavid Howells 	 */
540f91c9d6SDavid Howells 	int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
556fef4fc7SKonstantin Dimitrov };
566fef4fc7SKonstantin Dimitrov 
57e6ad9ce3SAntti Palosaari /* Do not add new ts2020_attach() users! Use I2C bindings instead. */
589b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_TS2020)
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
ts2020_attach(struct dvb_frontend * fe,const struct ts2020_config * config,struct i2c_adapter * i2c)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