xref: /linux/drivers/media/dvb-frontends/tda10071.h (revision d69abb79e123c111966fb41fe3c21533e2162f1a)
19a0bf528SMauro Carvalho Chehab /*
29a0bf528SMauro Carvalho Chehab  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
39a0bf528SMauro Carvalho Chehab  *
49a0bf528SMauro Carvalho Chehab  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
59a0bf528SMauro Carvalho Chehab  *
69a0bf528SMauro Carvalho Chehab  *    This program is free software; you can redistribute it and/or modify
79a0bf528SMauro Carvalho Chehab  *    it under the terms of the GNU General Public License as published by
89a0bf528SMauro Carvalho Chehab  *    the Free Software Foundation; either version 2 of the License, or
99a0bf528SMauro Carvalho Chehab  *    (at your option) any later version.
109a0bf528SMauro Carvalho Chehab  *
119a0bf528SMauro Carvalho Chehab  *    This program is distributed in the hope that it will be useful,
129a0bf528SMauro Carvalho Chehab  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
139a0bf528SMauro Carvalho Chehab  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
149a0bf528SMauro Carvalho Chehab  *    GNU General Public License for more details.
159a0bf528SMauro Carvalho Chehab  *
169a0bf528SMauro Carvalho Chehab  *    You should have received a copy of the GNU General Public License along
179a0bf528SMauro Carvalho Chehab  *    with this program; if not, write to the Free Software Foundation, Inc.,
189a0bf528SMauro Carvalho Chehab  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
199a0bf528SMauro Carvalho Chehab  */
209a0bf528SMauro Carvalho Chehab 
219a0bf528SMauro Carvalho Chehab #ifndef TDA10071_H
229a0bf528SMauro Carvalho Chehab #define TDA10071_H
239a0bf528SMauro Carvalho Chehab 
24782d8b74SMauro Carvalho Chehab #include <linux/kconfig.h>
259a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
269a0bf528SMauro Carvalho Chehab 
27*d69abb79SAntti Palosaari /*
28*d69abb79SAntti Palosaari  * I2C address
29*d69abb79SAntti Palosaari  * 0x55,
30*d69abb79SAntti Palosaari  */
31*d69abb79SAntti Palosaari 
32*d69abb79SAntti Palosaari /**
33*d69abb79SAntti Palosaari  * struct tda10071_platform_data - Platform data for the tda10071 driver
34*d69abb79SAntti Palosaari  * @clk: Clock frequency.
35*d69abb79SAntti Palosaari  * @i2c_wr_max: Max bytes I2C adapter can write at once.
36*d69abb79SAntti Palosaari  * @ts_mode: TS mode.
37*d69abb79SAntti Palosaari  * @spec_inv: Input spectrum inversion.
38*d69abb79SAntti Palosaari  * @pll_multiplier: PLL multiplier.
39*d69abb79SAntti Palosaari  * @tuner_i2c_addr: CX24118A tuner I2C address (0x14, 0x54, ...).
40*d69abb79SAntti Palosaari  * @get_dvb_frontend: Get DVB frontend.
41*d69abb79SAntti Palosaari  */
42*d69abb79SAntti Palosaari 
43*d69abb79SAntti Palosaari struct tda10071_platform_data {
44*d69abb79SAntti Palosaari 	u32 clk;
45*d69abb79SAntti Palosaari 	u16 i2c_wr_max;
46*d69abb79SAntti Palosaari #define TDA10071_TS_SERIAL        0
47*d69abb79SAntti Palosaari #define TDA10071_TS_PARALLEL      1
48*d69abb79SAntti Palosaari 	u8 ts_mode;
49*d69abb79SAntti Palosaari 	bool spec_inv;
50*d69abb79SAntti Palosaari 	u8 pll_multiplier;
51*d69abb79SAntti Palosaari 	u8 tuner_i2c_addr;
52*d69abb79SAntti Palosaari 
53*d69abb79SAntti Palosaari 	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
54*d69abb79SAntti Palosaari };
55*d69abb79SAntti Palosaari 
569a0bf528SMauro Carvalho Chehab struct tda10071_config {
579a0bf528SMauro Carvalho Chehab 	/* Demodulator I2C address.
589a0bf528SMauro Carvalho Chehab 	 * Default: none, must set
599a0bf528SMauro Carvalho Chehab 	 * Values: 0x55,
609a0bf528SMauro Carvalho Chehab 	 */
6141f55d57SMichael Krufky 	u8 demod_i2c_addr;
629a0bf528SMauro Carvalho Chehab 
630176fd4dSMichael Krufky 	/* Tuner I2C address.
6441f55d57SMichael Krufky 	 * Default: none, must set
650176fd4dSMichael Krufky 	 * Values: 0x14, 0x54, ...
660176fd4dSMichael Krufky 	 */
670176fd4dSMichael Krufky 	u8 tuner_i2c_addr;
680176fd4dSMichael Krufky 
699a0bf528SMauro Carvalho Chehab 	/* Max bytes I2C provider can write at once.
709a0bf528SMauro Carvalho Chehab 	 * Note: Buffer is taken from the stack currently!
719a0bf528SMauro Carvalho Chehab 	 * Default: none, must set
729a0bf528SMauro Carvalho Chehab 	 * Values:
739a0bf528SMauro Carvalho Chehab 	 */
749a0bf528SMauro Carvalho Chehab 	u16 i2c_wr_max;
759a0bf528SMauro Carvalho Chehab 
769a0bf528SMauro Carvalho Chehab 	/* TS output mode.
779a0bf528SMauro Carvalho Chehab 	 * Default: TDA10071_TS_SERIAL
789a0bf528SMauro Carvalho Chehab 	 * Values:
799a0bf528SMauro Carvalho Chehab 	 */
809a0bf528SMauro Carvalho Chehab #define TDA10071_TS_SERIAL        0
819a0bf528SMauro Carvalho Chehab #define TDA10071_TS_PARALLEL      1
829a0bf528SMauro Carvalho Chehab 	u8 ts_mode;
839a0bf528SMauro Carvalho Chehab 
849a0bf528SMauro Carvalho Chehab 	/* Input spectrum inversion.
859a0bf528SMauro Carvalho Chehab 	 * Default: 0
869a0bf528SMauro Carvalho Chehab 	 * Values: 0, 1
879a0bf528SMauro Carvalho Chehab 	 */
889a0bf528SMauro Carvalho Chehab 	bool spec_inv;
899a0bf528SMauro Carvalho Chehab 
909a0bf528SMauro Carvalho Chehab 	/* Xtal frequency Hz
919a0bf528SMauro Carvalho Chehab 	 * Default: none, must set
929a0bf528SMauro Carvalho Chehab 	 * Values:
939a0bf528SMauro Carvalho Chehab 	 */
949a0bf528SMauro Carvalho Chehab 	u32 xtal;
959a0bf528SMauro Carvalho Chehab 
969a0bf528SMauro Carvalho Chehab 	/* PLL multiplier.
979a0bf528SMauro Carvalho Chehab 	 * Default: none, must set
989a0bf528SMauro Carvalho Chehab 	 * Values:
999a0bf528SMauro Carvalho Chehab 	 */
1009a0bf528SMauro Carvalho Chehab 	u8 pll_multiplier;
1019a0bf528SMauro Carvalho Chehab };
1029a0bf528SMauro Carvalho Chehab 
1039a0bf528SMauro Carvalho Chehab 
1049b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_TDA10071)
1059a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *tda10071_attach(
1069a0bf528SMauro Carvalho Chehab 	const struct tda10071_config *config, struct i2c_adapter *i2c);
1079a0bf528SMauro Carvalho Chehab #else
1089a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *tda10071_attach(
1099a0bf528SMauro Carvalho Chehab 	const struct tda10071_config *config, struct i2c_adapter *i2c)
1109a0bf528SMauro Carvalho Chehab {
111116802f1SAntti Palosaari 	dev_warn(&i2c->dev, "%s: driver disabled by Kconfig\n", __func__);
1129a0bf528SMauro Carvalho Chehab 	return NULL;
1139a0bf528SMauro Carvalho Chehab }
1149a0bf528SMauro Carvalho Chehab #endif
1159a0bf528SMauro Carvalho Chehab 
1169a0bf528SMauro Carvalho Chehab #endif /* TDA10071_H */
117