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