Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Realtek RTL2832 DVB-T demodulator driver |
| 3 | * |
| 4 | * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #ifndef RTL2832_H |
| 22 | #define RTL2832_H |
| 23 | |
Mauro Carvalho Chehab | 782d8b7 | 2013-03-21 16:11:54 -0300 | [diff] [blame] | 24 | #include <linux/kconfig.h> |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 25 | #include <linux/dvb/frontend.h> |
| 26 | |
| 27 | struct rtl2832_config { |
| 28 | /* |
| 29 | * Demodulator I2C address. |
| 30 | */ |
| 31 | u8 i2c_addr; |
| 32 | |
| 33 | /* |
| 34 | * Xtal frequency. |
| 35 | * Hz |
| 36 | * 4000000, 16000000, 25000000, 28800000 |
| 37 | */ |
| 38 | u32 xtal; |
| 39 | |
| 40 | /* |
Antti Palosaari | 832cc7c | 2012-09-11 22:27:04 -0300 | [diff] [blame] | 41 | * tuner |
| 42 | * XXX: This must be keep sync with dvb_usb_rtl28xxu demod driver. |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 43 | */ |
Antti Palosaari | 5db4187 | 2012-09-11 22:27:08 -0300 | [diff] [blame] | 44 | #define RTL2832_TUNER_TUA9001 0x24 |
Antti Palosaari | 832cc7c | 2012-09-11 22:27:04 -0300 | [diff] [blame] | 45 | #define RTL2832_TUNER_FC0012 0x26 |
Antti Palosaari | 7e688de | 2012-09-17 17:53:04 -0300 | [diff] [blame] | 46 | #define RTL2832_TUNER_E4000 0x27 |
Antti Palosaari | 832cc7c | 2012-09-11 22:27:04 -0300 | [diff] [blame] | 47 | #define RTL2832_TUNER_FC0013 0x29 |
Mauro Carvalho Chehab | fa4bfd2 | 2013-04-09 18:19:50 -0300 | [diff] [blame] | 48 | #define RTL2832_TUNER_R820T 0x2a |
Antti Palosaari | a26758e | 2013-10-30 00:36:38 -0300 | [diff] [blame] | 49 | #define RTL2832_TUNER_R828D 0x2b |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 50 | u8 tuner; |
| 51 | }; |
| 52 | |
Mauro Carvalho Chehab | 782d8b7 | 2013-03-21 16:11:54 -0300 | [diff] [blame] | 53 | #if IS_ENABLED(CONFIG_DVB_RTL2832) |
Antti Palosaari | 3ca2418 | 2013-10-13 00:06:44 -0300 | [diff] [blame] | 54 | struct dvb_frontend *rtl2832_attach( |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 55 | const struct rtl2832_config *cfg, |
| 56 | struct i2c_adapter *i2c |
| 57 | ); |
Antti Palosaari | 8823f02 | 2013-11-26 12:53:46 -0300 | [diff] [blame] | 58 | |
| 59 | extern struct i2c_adapter *rtl2832_get_i2c_adapter( |
| 60 | struct dvb_frontend *fe |
| 61 | ); |
| 62 | |
Antti Palosaari | 92d20d9 | 2014-02-08 03:50:04 -0300 | [diff] [blame] | 63 | extern struct i2c_adapter *rtl2832_get_private_i2c_adapter( |
| 64 | struct dvb_frontend *fe |
| 65 | ); |
| 66 | |
Antti Palosaari | fe37b38 | 2013-11-28 19:15:19 -0300 | [diff] [blame] | 67 | extern int rtl2832_enable_external_ts_if( |
| 68 | struct dvb_frontend *fe |
| 69 | ); |
| 70 | |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 71 | #else |
Antti Palosaari | 8823f02 | 2013-11-26 12:53:46 -0300 | [diff] [blame] | 72 | |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 73 | static inline struct dvb_frontend *rtl2832_attach( |
| 74 | const struct rtl2832_config *config, |
| 75 | struct i2c_adapter *i2c |
| 76 | ) |
| 77 | { |
Antti Palosaari | 298efdd | 2012-09-11 22:27:11 -0300 | [diff] [blame] | 78 | pr_warn("%s: driver disabled by Kconfig\n", __func__); |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 79 | return NULL; |
| 80 | } |
Antti Palosaari | 8823f02 | 2013-11-26 12:53:46 -0300 | [diff] [blame] | 81 | |
| 82 | static inline struct i2c_adapter *rtl2832_get_i2c_adapter( |
| 83 | struct dvb_frontend *fe |
| 84 | ) |
| 85 | { |
| 86 | return NULL; |
| 87 | } |
Antti Palosaari | 92d20d9 | 2014-02-08 03:50:04 -0300 | [diff] [blame] | 88 | |
| 89 | static inline struct i2c_adapter *rtl2832_get_private_i2c_adapter( |
| 90 | struct dvb_frontend *fe |
| 91 | ) |
| 92 | { |
| 93 | return NULL; |
| 94 | } |
| 95 | |
Antti Palosaari | fe37b38 | 2013-11-28 19:15:19 -0300 | [diff] [blame] | 96 | static inline int rtl2832_enable_external_ts_if( |
| 97 | struct dvb_frontend *fe |
| 98 | ) |
| 99 | { |
| 100 | return -ENODEV; |
| 101 | } |
| 102 | |
Thomas Mair | 82041c0 | 2012-05-18 14:47:40 -0300 | [diff] [blame] | 103 | #endif |
| 104 | |
| 105 | |
| 106 | #endif /* RTL2832_H */ |