Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     Driver for ST STV0299 demodulator
0004 
0005     Copyright (C) 2001-2002 Convergence Integrated Media GmbH
0006     <ralph@convergence.de>,
0007     <holger@convergence.de>,
0008     <js@convergence.de>
0009 
0010 
0011     Philips SU1278/SH
0012 
0013     Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de>
0014 
0015 
0016     LG TDQF-S001F
0017 
0018     Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net>
0019              & Andreas Oberritter <obi@linuxtv.org>
0020 
0021 
0022     Support for Samsung TBMU24112IMB used on Technisat SkyStar2 rev. 2.6B
0023 
0024     Copyright (C) 2003 Vadim Catana <skystar@moldova.cc>:
0025 
0026     Support for Philips SU1278 on Technotrend hardware
0027 
0028     Copyright (C) 2004 Andrew de Quincey <adq_dvb@lidskialf.net>
0029 
0030 
0031 */
0032 
0033 #ifndef STV0299_H
0034 #define STV0299_H
0035 
0036 #include <linux/dvb/frontend.h>
0037 #include <media/dvb_frontend.h>
0038 
0039 #define STV0299_LOCKOUTPUT_0  0
0040 #define STV0299_LOCKOUTPUT_1  1
0041 #define STV0299_LOCKOUTPUT_CF 2
0042 #define STV0299_LOCKOUTPUT_LK 3
0043 
0044 #define STV0299_VOLT13_OP0 0
0045 #define STV0299_VOLT13_OP1 1
0046 
0047 struct stv0299_config
0048 {
0049     /* the demodulator's i2c address */
0050     u8 demod_address;
0051 
0052     /* inittab - array of pairs of values.
0053      * First of each pair is the register, second is the value.
0054      * List should be terminated with an 0xff, 0xff pair.
0055      */
0056     const u8* inittab;
0057 
0058     /* master clock to use */
0059     u32 mclk;
0060 
0061     /* does the inversion require inversion? */
0062     u8 invert:1;
0063 
0064     /* Skip reinitialisation? */
0065     u8 skip_reinit:1;
0066 
0067     /* LOCK OUTPUT setting */
0068     u8 lock_output:2;
0069 
0070     /* Is 13v controlled by OP0 or OP1? */
0071     u8 volt13_op0_op1:1;
0072 
0073     /* Turn-off OP0? */
0074     u8 op0_off:1;
0075 
0076     /* minimum delay before retuning */
0077     int min_delay_ms;
0078 
0079     /* Set the symbol rate */
0080     int (*set_symbol_rate)(struct dvb_frontend *fe, u32 srate, u32 ratio);
0081 
0082     /* Set device param to start dma */
0083     int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
0084 };
0085 
0086 #if IS_REACHABLE(CONFIG_DVB_STV0299)
0087 extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
0088                        struct i2c_adapter *i2c);
0089 #else
0090 static inline struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
0091                        struct i2c_adapter *i2c)
0092 {
0093     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0094     return NULL;
0095 }
0096 #endif // CONFIG_DVB_STV0299
0097 
0098 static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
0099     int r = 0;
0100     u8 buf[] = {reg, val};
0101     if (fe->ops.write)
0102         r = fe->ops.write(fe, buf, 2);
0103     return r;
0104 }
0105 
0106 #endif // STV0299_H