^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) Driver for ST STV0299 demodulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Copyright (C) 2001-2002 Convergence Integrated Media GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) <ralph@convergence.de>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) <holger@convergence.de>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) <js@convergence.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Philips SU1278/SH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) LG TDQF-S001F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) & Andreas Oberritter <obi@linuxtv.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Support for Samsung TBMU24112IMB used on Technisat SkyStar2 rev. 2.6B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Copyright (C) 2003 Vadim Catana <skystar@moldova.cc>:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Support for Philips SU1278 on Technotrend hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Copyright (C) 2004 Andrew de Quincey <adq_dvb@lidskialf.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^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) #ifndef STV0299_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define STV0299_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define STV0299_LOCKOUTPUT_0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define STV0299_LOCKOUTPUT_1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define STV0299_LOCKOUTPUT_CF 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define STV0299_LOCKOUTPUT_LK 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define STV0299_VOLT13_OP0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define STV0299_VOLT13_OP1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct stv0299_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* the demodulator's i2c address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u8 demod_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* inittab - array of pairs of values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * First of each pair is the register, second is the value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * List should be terminated with an 0xff, 0xff pair.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) const u8* inittab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* master clock to use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) u32 mclk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* does the inversion require inversion? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) u8 invert:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /* Skip reinitialisation? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) u8 skip_reinit:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* LOCK OUTPUT setting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) u8 lock_output:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /* Is 13v controlled by OP0 or OP1? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) u8 volt13_op0_op1:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /* Turn-off OP0? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) u8 op0_off:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* minimum delay before retuning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int min_delay_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* Set the symbol rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) int (*set_symbol_rate)(struct dvb_frontend *fe, u32 srate, u32 ratio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Set device param to start dma */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #if IS_REACHABLE(CONFIG_DVB_STV0299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static inline struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #endif // CONFIG_DVB_STV0299
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) int r = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) u8 buf[] = {reg, val};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) if (fe->ops.write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) r = fe->ops.write(fe, buf, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) return r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #endif // STV0299_H