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