xref: /linux/drivers/media/dvb-frontends/lgdt330x.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
29a0bf528SMauro Carvalho Chehab /*
39a0bf528SMauro Carvalho Chehab  *    Support for LGDT3302 and LGDT3303 - VSB/QAM
49a0bf528SMauro Carvalho Chehab  *
59a0bf528SMauro Carvalho Chehab  *    Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
69a0bf528SMauro Carvalho Chehab  */
79a0bf528SMauro Carvalho Chehab 
89a0bf528SMauro Carvalho Chehab #ifndef LGDT330X_H
99a0bf528SMauro Carvalho Chehab #define LGDT330X_H
109a0bf528SMauro Carvalho Chehab 
119a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
129a0bf528SMauro Carvalho Chehab 
139a0bf528SMauro Carvalho Chehab typedef enum lg_chip_t {
149a0bf528SMauro Carvalho Chehab 		UNDEFINED,
159a0bf528SMauro Carvalho Chehab 		LGDT3302,
169a0bf528SMauro Carvalho Chehab 		LGDT3303
179a0bf528SMauro Carvalho Chehab }lg_chip_type;
189a0bf528SMauro Carvalho Chehab 
197129d314SMauro Carvalho Chehab /**
207129d314SMauro Carvalho Chehab  * struct lgdt330x_config - contains lgdt330x configuration
217129d314SMauro Carvalho Chehab  *
227129d314SMauro Carvalho Chehab  * @demod_chip:		LG demodulator chip LGDT3302 or LGDT3303
237129d314SMauro Carvalho Chehab  * @serial_mpeg:	MPEG hardware interface - 0:parallel 1:serial
247129d314SMauro Carvalho Chehab  * @pll_rf_set:		Callback function to set PLL interface
257129d314SMauro Carvalho Chehab  * @set_ts_params:	Callback function to set device param for start_dma
267129d314SMauro Carvalho Chehab  * @clock_polarity_flip:
277129d314SMauro Carvalho Chehab  *	Flip the polarity of the mpeg data transfer clock using alternate
287129d314SMauro Carvalho Chehab  *	init data.
297129d314SMauro Carvalho Chehab  *	This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled
3023ba635dSMauro Carvalho Chehab  * @get_dvb_frontend:
3123ba635dSMauro Carvalho Chehab  *	returns the frontend associated with this I2C client.
3223ba635dSMauro Carvalho Chehab  *	Filled by the driver.
337129d314SMauro Carvalho Chehab  */
349a0bf528SMauro Carvalho Chehab struct lgdt330x_config
359a0bf528SMauro Carvalho Chehab {
369a0bf528SMauro Carvalho Chehab 	lg_chip_type demod_chip;
379a0bf528SMauro Carvalho Chehab 	int serial_mpeg;
389a0bf528SMauro Carvalho Chehab 	int (*pll_rf_set) (struct dvb_frontend* fe, int index);
399a0bf528SMauro Carvalho Chehab 	int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
409a0bf528SMauro Carvalho Chehab 	int clock_polarity_flip;
4123ba635dSMauro Carvalho Chehab 
4223ba635dSMauro Carvalho Chehab 	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
439a0bf528SMauro Carvalho Chehab };
449a0bf528SMauro Carvalho Chehab 
459b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_LGDT330X)
4623ba635dSMauro Carvalho Chehab struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
4723ba635dSMauro Carvalho Chehab 				     u8 demod_address,
489a0bf528SMauro Carvalho Chehab 				     struct i2c_adapter *i2c);
499a0bf528SMauro Carvalho Chehab #else
502a5f2705SHans Verkuil static inline
lgdt330x_attach(const struct lgdt330x_config * config,u8 demod_address,struct i2c_adapter * i2c)5123ba635dSMauro Carvalho Chehab struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
5223ba635dSMauro Carvalho Chehab 				     u8 demod_address,
539a0bf528SMauro Carvalho Chehab 				     struct i2c_adapter *i2c)
549a0bf528SMauro Carvalho Chehab {
559a0bf528SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
569a0bf528SMauro Carvalho Chehab 	return NULL;
579a0bf528SMauro Carvalho Chehab }
589a0bf528SMauro Carvalho Chehab #endif // CONFIG_DVB_LGDT330X
599a0bf528SMauro Carvalho Chehab 
609a0bf528SMauro Carvalho Chehab #endif /* LGDT330X_H */
61