1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Support for LGDT3302 and LGDT3303 - VSB/QAM
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
6*4882a593Smuzhiyun */
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun #ifndef LGDT330X_H
9*4882a593Smuzhiyun #define LGDT330X_H
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun #include <linux/dvb/frontend.h>
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun typedef enum lg_chip_t {
14*4882a593Smuzhiyun UNDEFINED,
15*4882a593Smuzhiyun LGDT3302,
16*4882a593Smuzhiyun LGDT3303
17*4882a593Smuzhiyun }lg_chip_type;
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun /**
20*4882a593Smuzhiyun * struct lgdt330x_config - contains lgdt330x configuration
21*4882a593Smuzhiyun *
22*4882a593Smuzhiyun * @demod_chip: LG demodulator chip LGDT3302 or LGDT3303
23*4882a593Smuzhiyun * @serial_mpeg: MPEG hardware interface - 0:parallel 1:serial
24*4882a593Smuzhiyun * @pll_rf_set: Callback function to set PLL interface
25*4882a593Smuzhiyun * @set_ts_params: Callback function to set device param for start_dma
26*4882a593Smuzhiyun * @clock_polarity_flip:
27*4882a593Smuzhiyun * Flip the polarity of the mpeg data transfer clock using alternate
28*4882a593Smuzhiyun * init data.
29*4882a593Smuzhiyun * This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled
30*4882a593Smuzhiyun * @get_dvb_frontend:
31*4882a593Smuzhiyun * returns the frontend associated with this I2C client.
32*4882a593Smuzhiyun * Filled by the driver.
33*4882a593Smuzhiyun */
34*4882a593Smuzhiyun struct lgdt330x_config
35*4882a593Smuzhiyun {
36*4882a593Smuzhiyun lg_chip_type demod_chip;
37*4882a593Smuzhiyun int serial_mpeg;
38*4882a593Smuzhiyun int (*pll_rf_set) (struct dvb_frontend* fe, int index);
39*4882a593Smuzhiyun int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
40*4882a593Smuzhiyun int clock_polarity_flip;
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
43*4882a593Smuzhiyun };
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_DVB_LGDT330X)
46*4882a593Smuzhiyun struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
47*4882a593Smuzhiyun u8 demod_address,
48*4882a593Smuzhiyun struct i2c_adapter *i2c);
49*4882a593Smuzhiyun #else
50*4882a593Smuzhiyun static inline
lgdt330x_attach(const struct lgdt330x_config * config,u8 demod_address,struct i2c_adapter * i2c)51*4882a593Smuzhiyun struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
52*4882a593Smuzhiyun u8 demod_address,
53*4882a593Smuzhiyun struct i2c_adapter *i2c)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
56*4882a593Smuzhiyun return NULL;
57*4882a593Smuzhiyun }
58*4882a593Smuzhiyun #endif // CONFIG_DVB_LGDT330X
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun #endif /* LGDT330X_H */
61