^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) Montage Technology TS2020 - Silicon Tuner driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Copyright (C) 2009-2012 Konstantin Dimitrov <kosio.dimitrov@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Copyright (C) 2009-2012 TurboSight.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef TS2020_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define TS2020_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct ts2020_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) u8 tuner_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) u32 frequency_div;
^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) * RF loop-through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) bool loop_through:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * clock output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define TS2020_CLK_OUT_DISABLED 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define TS2020_CLK_OUT_ENABLED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define TS2020_CLK_OUT_ENABLED_XTALOUT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u8 clk_out:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * clock output divider
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * 1 - 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 clk_out_div:5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* Set to true to suppress stat polling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) bool dont_poll:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * pointer to DVB frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct dvb_frontend *fe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * driver private, do not set value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) u8 attach_in_use:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* Operation to be called by the ts2020 driver to get the value of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * AGC PWM tuner input as theoretically output by the demodulator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* Do not add new ts2020_attach() users! Use I2C bindings instead. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #if IS_REACHABLE(CONFIG_DVB_TS2020)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) extern struct dvb_frontend *ts2020_attach(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct dvb_frontend *fe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) const struct ts2020_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static inline struct dvb_frontend *ts2020_attach(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct dvb_frontend *fe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) const struct ts2020_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #endif /* TS2020_H */