xref: /linux/drivers/media/dvb-frontends/lgdt330x.h (revision 2a5f2705c97625aa1a4e1dd4d584eaa05392e060)
19a0bf528SMauro Carvalho Chehab /*
29a0bf528SMauro Carvalho Chehab  *    Support for LGDT3302 and LGDT3303 - VSB/QAM
39a0bf528SMauro Carvalho Chehab  *
49a0bf528SMauro Carvalho Chehab  *    Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
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  */
179a0bf528SMauro Carvalho Chehab 
189a0bf528SMauro Carvalho Chehab #ifndef LGDT330X_H
199a0bf528SMauro Carvalho Chehab #define LGDT330X_H
209a0bf528SMauro Carvalho Chehab 
219a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
229a0bf528SMauro Carvalho Chehab 
239a0bf528SMauro Carvalho Chehab typedef enum lg_chip_t {
249a0bf528SMauro Carvalho Chehab 		UNDEFINED,
259a0bf528SMauro Carvalho Chehab 		LGDT3302,
269a0bf528SMauro Carvalho Chehab 		LGDT3303
279a0bf528SMauro Carvalho Chehab }lg_chip_type;
289a0bf528SMauro Carvalho Chehab 
297129d314SMauro Carvalho Chehab /**
307129d314SMauro Carvalho Chehab  * struct lgdt330x_config - contains lgdt330x configuration
317129d314SMauro Carvalho Chehab  *
327129d314SMauro Carvalho Chehab  * @demod_chip:		LG demodulator chip LGDT3302 or LGDT3303
337129d314SMauro Carvalho Chehab  * @serial_mpeg:	MPEG hardware interface - 0:parallel 1:serial
347129d314SMauro Carvalho Chehab  * @pll_rf_set:		Callback function to set PLL interface
357129d314SMauro Carvalho Chehab  * @set_ts_params:	Callback function to set device param for start_dma
367129d314SMauro Carvalho Chehab  * @clock_polarity_flip:
377129d314SMauro Carvalho Chehab  *	Flip the polarity of the mpeg data transfer clock using alternate
387129d314SMauro Carvalho Chehab  *	init data.
397129d314SMauro Carvalho Chehab  *	This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled
4023ba635dSMauro Carvalho Chehab  * @get_dvb_frontend:
4123ba635dSMauro Carvalho Chehab  *	returns the frontend associated with this I2C client.
4223ba635dSMauro Carvalho Chehab  *	Filled by the driver.
437129d314SMauro Carvalho Chehab  */
449a0bf528SMauro Carvalho Chehab struct lgdt330x_config
459a0bf528SMauro Carvalho Chehab {
469a0bf528SMauro Carvalho Chehab 	lg_chip_type demod_chip;
479a0bf528SMauro Carvalho Chehab 	int serial_mpeg;
489a0bf528SMauro Carvalho Chehab 	int (*pll_rf_set) (struct dvb_frontend* fe, int index);
499a0bf528SMauro Carvalho Chehab 	int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
509a0bf528SMauro Carvalho Chehab 	int clock_polarity_flip;
5123ba635dSMauro Carvalho Chehab 
5223ba635dSMauro Carvalho Chehab 	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
539a0bf528SMauro Carvalho Chehab };
549a0bf528SMauro Carvalho Chehab 
559b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_LGDT330X)
5623ba635dSMauro Carvalho Chehab struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
5723ba635dSMauro Carvalho Chehab 				     u8 demod_address,
589a0bf528SMauro Carvalho Chehab 				     struct i2c_adapter *i2c);
599a0bf528SMauro Carvalho Chehab #else
60*2a5f2705SHans Verkuil static inline
6123ba635dSMauro Carvalho Chehab struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
6223ba635dSMauro Carvalho Chehab 				     u8 demod_address,
639a0bf528SMauro Carvalho Chehab 				     struct i2c_adapter *i2c)
649a0bf528SMauro Carvalho Chehab {
659a0bf528SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
669a0bf528SMauro Carvalho Chehab 	return NULL;
679a0bf528SMauro Carvalho Chehab }
689a0bf528SMauro Carvalho Chehab #endif // CONFIG_DVB_LGDT330X
699a0bf528SMauro Carvalho Chehab 
709a0bf528SMauro Carvalho Chehab #endif /* LGDT330X_H */
71