Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Montage M88DS3103 demodulator driver |
| 3 | * |
| 4 | * Copyright (C) 2013 Antti Palosaari <crope@iki.fi> |
| 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. |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef M88DS3103_H |
| 18 | #define M88DS3103_H |
| 19 | |
| 20 | #include <linux/dvb/frontend.h> |
| 21 | |
| 22 | struct m88ds3103_config { |
| 23 | /* |
| 24 | * I2C address |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 25 | * Default: none, must set |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 26 | * 0x68, ... |
| 27 | */ |
| 28 | u8 i2c_addr; |
| 29 | |
| 30 | /* |
| 31 | * clock |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 32 | * Default: none, must set |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 33 | * 27000000 |
| 34 | */ |
| 35 | u32 clock; |
| 36 | |
| 37 | /* |
| 38 | * max bytes I2C provider is asked to write at once |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 39 | * Default: none, must set |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 40 | * 33, 65, ... |
| 41 | */ |
| 42 | u16 i2c_wr_max; |
| 43 | |
| 44 | /* |
| 45 | * TS output mode |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 46 | * Default: M88DS3103_TS_SERIAL |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 47 | */ |
| 48 | #define M88DS3103_TS_SERIAL 0 /* TS output pin D0, normal */ |
| 49 | #define M88DS3103_TS_SERIAL_D7 1 /* TS output pin D7 */ |
nibble.max | 79d0933 | 2014-08-11 01:22:45 -0300 | [diff] [blame] | 50 | #define M88DS3103_TS_PARALLEL 2 /* TS Parallel mode */ |
| 51 | #define M88DS3103_TS_CI 3 /* TS CI Mode */ |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 52 | u8 ts_mode; |
| 53 | |
| 54 | /* |
nibble.max | 79d0933 | 2014-08-11 01:22:45 -0300 | [diff] [blame] | 55 | * TS clk in KHz |
| 56 | * Default: 0. |
| 57 | */ |
| 58 | u32 ts_clk; |
| 59 | |
| 60 | /* |
| 61 | * TS clk polarity. |
| 62 | * Default: 0. 1-active at falling edge; 0-active at rising edge. |
| 63 | */ |
| 64 | u8 ts_clk_pol:1; |
| 65 | |
| 66 | /* |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 67 | * spectrum inversion |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 68 | * Default: 0 |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 69 | */ |
| 70 | u8 spec_inv:1; |
| 71 | |
| 72 | /* |
| 73 | * AGC polarity |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 74 | * Default: 0 |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 75 | */ |
| 76 | u8 agc_inv:1; |
| 77 | |
| 78 | /* |
| 79 | * clock output |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 80 | * Default: M88DS3103_CLOCK_OUT_DISABLED |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 81 | */ |
| 82 | #define M88DS3103_CLOCK_OUT_DISABLED 0 |
| 83 | #define M88DS3103_CLOCK_OUT_ENABLED 1 |
| 84 | #define M88DS3103_CLOCK_OUT_ENABLED_DIV2 2 |
| 85 | u8 clock_out; |
| 86 | |
| 87 | /* |
| 88 | * DiSEqC envelope mode |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 89 | * Default: 0 |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 90 | */ |
| 91 | u8 envelope_mode:1; |
| 92 | |
Antti Palosaari | 58b7450 | 2013-12-02 13:11:21 -0300 | [diff] [blame] | 93 | /* |
| 94 | * AGC configuration |
| 95 | * Default: none, must set |
| 96 | */ |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 97 | u8 agc; |
nibble.max | 79d0933 | 2014-08-11 01:22:45 -0300 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * LNB H/V pin polarity |
| 101 | * Default: 0. |
| 102 | * 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18. |
| 103 | * 0: pin high set to VOLTAGE_18, pin low to set VOLTAGE_13. |
| 104 | */ |
| 105 | u8 lnb_hv_pol:1; |
| 106 | |
| 107 | /* |
| 108 | * LNB enable pin polarity |
| 109 | * Default: 0. |
| 110 | * 1: pin high to enable, pin low to disable. |
| 111 | * 0: pin high to disable, pin low to enable. |
| 112 | */ |
| 113 | u8 lnb_en_pol:1; |
Antti Palosaari | 395d00d | 2013-02-25 08:39:16 -0300 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | /* |
| 117 | * Driver implements own I2C-adapter for tuner I2C access. That's since chip |
| 118 | * has I2C-gate control which closes gate automatically after I2C transfer. |
| 119 | * Using own I2C adapter we can workaround that. |
| 120 | */ |
| 121 | |
| 122 | #if defined(CONFIG_DVB_M88DS3103) || \ |
| 123 | (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE)) |
| 124 | extern struct dvb_frontend *m88ds3103_attach( |
| 125 | const struct m88ds3103_config *config, |
| 126 | struct i2c_adapter *i2c, |
| 127 | struct i2c_adapter **tuner_i2c); |
| 128 | #else |
| 129 | static inline struct dvb_frontend *m88ds3103_attach( |
| 130 | const struct m88ds3103_config *config, |
| 131 | struct i2c_adapter *i2c, |
| 132 | struct i2c_adapter **tuner_i2c) |
| 133 | { |
| 134 | pr_warn("%s: driver disabled by Kconfig\n", __func__); |
| 135 | return NULL; |
| 136 | } |
| 137 | #endif |
| 138 | |
| 139 | #endif |