Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 1 | /* |
| 2 | STV0900/0903 Multistandard Broadcast Frontend driver |
| 3 | Copyright (C) Manu Abraham <abraham.manu@gmail.com> |
| 4 | |
| 5 | Copyright (C) ST Microelectronics |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __STV090x_H |
| 23 | #define __STV090x_H |
| 24 | |
| 25 | enum stv090x_demodulator { |
| 26 | STV090x_DEMODULATOR_0 = 1, |
| 27 | STV090x_DEMODULATOR_1 |
| 28 | }; |
| 29 | |
| 30 | enum stv090x_device { |
| 31 | STV0903 = 0, |
| 32 | STV0900, |
| 33 | }; |
| 34 | |
| 35 | enum stv090x_mode { |
| 36 | STV090x_DUAL = 0, |
| 37 | STV090x_SINGLE |
| 38 | }; |
| 39 | |
| 40 | enum stv090x_tsmode { |
| 41 | STV090x_TSMODE_SERIAL_PUNCTURED = 1, |
| 42 | STV090x_TSMODE_SERIAL_CONTINUOUS, |
| 43 | STV090x_TSMODE_PARALLEL_PUNCTURED, |
| 44 | STV090x_TSMODE_DVBCI |
| 45 | }; |
| 46 | |
| 47 | enum stv090x_clkmode { |
| 48 | STV090x_CLK_INT = 0, /* Clk i/p = CLKI */ |
| 49 | STV090x_CLK_EXT = 2 /* Clk i/p = XTALI */ |
| 50 | }; |
| 51 | |
Manu Abraham | 017eb038 | 2009-04-07 05:19:54 -0300 | [diff] [blame] | 52 | enum stv090x_i2crpt { |
| 53 | STV090x_RPTLEVEL_256 = 0, |
| 54 | STV090x_RPTLEVEL_128 = 1, |
| 55 | STV090x_RPTLEVEL_64 = 2, |
| 56 | STV090x_RPTLEVEL_32 = 3, |
| 57 | STV090x_RPTLEVEL_16 = 4, |
| 58 | STV090x_RPTLEVEL_8 = 5, |
| 59 | STV090x_RPTLEVEL_4 = 6, |
| 60 | STV090x_RPTLEVEL_2 = 7, |
| 61 | }; |
| 62 | |
Oliver Endriss | d8b5a8e | 2010-01-10 15:40:28 -0300 | [diff] [blame] | 63 | enum stv090x_adc_range { |
| 64 | STV090x_ADC_2Vpp = 0, |
| 65 | STV090x_ADC_1Vpp = 1 |
| 66 | }; |
| 67 | |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 68 | struct stv090x_config { |
| 69 | enum stv090x_device device; |
| 70 | enum stv090x_mode demod_mode; |
| 71 | enum stv090x_clkmode clk_mode; |
| 72 | |
| 73 | u32 xtal; /* default: 8000000 */ |
| 74 | u8 address; /* default: 0x68 */ |
| 75 | |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 76 | u8 ts1_mode; |
| 77 | u8 ts2_mode; |
Andreas Regel | f91e59c | 2010-01-05 19:22:07 -0300 | [diff] [blame] | 78 | u32 ts1_clk; |
| 79 | u32 ts2_clk; |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 80 | |
Patrick Boettcher | 4f7200a | 2010-10-09 10:12:34 -0300 | [diff] [blame] | 81 | u8 ts1_tei : 1; |
| 82 | u8 ts2_tei : 1; |
| 83 | |
Manu Abraham | 017eb038 | 2009-04-07 05:19:54 -0300 | [diff] [blame] | 84 | enum stv090x_i2crpt repeater_level; |
| 85 | |
Oliver Endriss | d8b5a8e | 2010-01-10 15:40:28 -0300 | [diff] [blame] | 86 | u8 tuner_bbgain; /* default: 10db */ |
| 87 | enum stv090x_adc_range adc1_range; /* default: 2Vpp */ |
| 88 | enum stv090x_adc_range adc2_range; /* default: 2Vpp */ |
| 89 | |
Oliver Endriss | 30e8ca2 | 2009-12-13 09:02:39 -0300 | [diff] [blame] | 90 | bool diseqc_envelope_mode; |
| 91 | |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 92 | int (*tuner_init) (struct dvb_frontend *fe); |
Manu Abraham | c5b74b0 | 2010-01-23 05:49:08 -0300 | [diff] [blame] | 93 | int (*tuner_sleep) (struct dvb_frontend *fe); |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 94 | int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); |
| 95 | int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); |
| 96 | int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); |
| 97 | int (*tuner_set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth); |
| 98 | int (*tuner_get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth); |
| 99 | int (*tuner_set_bbgain) (struct dvb_frontend *fe, u32 gain); |
| 100 | int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain); |
| 101 | int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); |
| 102 | int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); |
Oliver Endriss | f790bdd | 2011-01-10 06:36:10 -0300 | [diff] [blame] | 103 | void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock); |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 104 | }; |
| 105 | |
Peter Senna Tschudin | 7b34be7 | 2013-01-20 01:32:56 -0300 | [diff] [blame] | 106 | #if IS_ENABLED(CONFIG_DVB_STV090x) |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 107 | |
| 108 | extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, |
| 109 | struct i2c_adapter *i2c, |
| 110 | enum stv090x_demodulator demod); |
Patrick Boettcher | b479704 | 2010-10-10 13:45:54 -0300 | [diff] [blame] | 111 | |
| 112 | /* dir = 0 -> output, dir = 1 -> input/open-drain */ |
| 113 | extern int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, |
| 114 | u8 dir, u8 value, u8 xor_value); |
| 115 | |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 116 | #else |
| 117 | |
| 118 | static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, |
| 119 | struct i2c_adapter *i2c, |
| 120 | enum stv090x_demodulator demod) |
| 121 | { |
| 122 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
| 123 | return NULL; |
| 124 | } |
Patrick Boettcher | b479704 | 2010-10-10 13:45:54 -0300 | [diff] [blame] | 125 | |
| 126 | static inline int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, |
| 127 | u8 opd, u8 value, u8 xor_value) |
| 128 | { |
| 129 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
| 130 | return -ENODEV; |
| 131 | } |
Manu Abraham | e415c68 | 2009-04-06 15:45:20 -0300 | [diff] [blame] | 132 | #endif /* CONFIG_DVB_STV090x */ |
| 133 | |
| 134 | #endif /* __STV090x_H */ |