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. 15 */ 16 17 #ifndef M88DS3103_PRIV_H 18 #define M88DS3103_PRIV_H 19 20 #include "dvb_frontend.h" 21 #include "m88ds3103.h" 22 #include "dvb_math.h" 23 #include <linux/firmware.h> 24 #include <linux/i2c-mux.h> 25 26 #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw" 27 #define M88DS3103_MCLK_KHZ 96000 28 29 struct m88ds3103_priv { 30 struct i2c_adapter *i2c; 31 /* mutex needed due to own tuner I2C adapter */ 32 struct mutex i2c_mutex; 33 const struct m88ds3103_config *cfg; 34 struct dvb_frontend fe; 35 fe_delivery_system_t delivery_system; 36 fe_status_t fe_status; 37 bool warm; /* FW running */ 38 struct i2c_adapter *i2c_adapter; 39 }; 40 41 struct m88ds3103_reg_val { 42 u8 reg; 43 u8 val; 44 }; 45 46 static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = { 47 {0x23, 0x07}, 48 {0x08, 0x03}, 49 {0x0c, 0x02}, 50 {0x21, 0x54}, 51 {0x25, 0x8a}, 52 {0x27, 0x31}, 53 {0x30, 0x08}, 54 {0x31, 0x40}, 55 {0x32, 0x32}, 56 {0x35, 0xff}, 57 {0x3a, 0x00}, 58 {0x37, 0x10}, 59 {0x38, 0x10}, 60 {0x39, 0x02}, 61 {0x42, 0x60}, 62 {0x4a, 0x80}, 63 {0x4b, 0x04}, 64 {0x4d, 0x91}, 65 {0x5d, 0xc8}, 66 {0x50, 0x36}, 67 {0x51, 0x36}, 68 {0x52, 0x36}, 69 {0x53, 0x36}, 70 {0x56, 0x01}, 71 {0x63, 0x0f}, 72 {0x64, 0x30}, 73 {0x65, 0x40}, 74 {0x68, 0x26}, 75 {0x69, 0x4c}, 76 {0x70, 0x20}, 77 {0x71, 0x70}, 78 {0x72, 0x04}, 79 {0x73, 0x00}, 80 {0x70, 0x40}, 81 {0x71, 0x70}, 82 {0x72, 0x04}, 83 {0x73, 0x00}, 84 {0x70, 0x60}, 85 {0x71, 0x70}, 86 {0x72, 0x04}, 87 {0x73, 0x00}, 88 {0x70, 0x80}, 89 {0x71, 0x70}, 90 {0x72, 0x04}, 91 {0x73, 0x00}, 92 {0x70, 0xa0}, 93 {0x71, 0x70}, 94 {0x72, 0x04}, 95 {0x73, 0x00}, 96 {0x70, 0x1f}, 97 {0x76, 0x38}, 98 {0x77, 0xa6}, 99 {0x78, 0x0c}, 100 {0x79, 0x80}, 101 {0x7f, 0x14}, 102 {0x7c, 0x00}, 103 {0xae, 0x82}, 104 {0x80, 0x64}, 105 {0x81, 0x66}, 106 {0x82, 0x44}, 107 {0x85, 0x04}, 108 {0xcd, 0xf4}, 109 {0x90, 0x33}, 110 {0xa0, 0x44}, 111 {0xc0, 0x08}, 112 {0xc3, 0x10}, 113 {0xc4, 0x08}, 114 {0xc5, 0xf0}, 115 {0xc6, 0xff}, 116 {0xc7, 0x00}, 117 {0xc8, 0x1a}, 118 {0xc9, 0x80}, 119 {0xe0, 0xf8}, 120 {0xe6, 0x8b}, 121 {0xd0, 0x40}, 122 {0xf8, 0x20}, 123 {0xfa, 0x0f}, 124 {0x00, 0x00}, 125 {0xbd, 0x01}, 126 {0xb8, 0x00}, 127 }; 128 129 static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = { 130 {0x23, 0x07}, 131 {0x08, 0x07}, 132 {0x0c, 0x02}, 133 {0x21, 0x54}, 134 {0x25, 0x8a}, 135 {0x27, 0x31}, 136 {0x30, 0x08}, 137 {0x32, 0x32}, 138 {0x35, 0xff}, 139 {0x3a, 0x00}, 140 {0x37, 0x10}, 141 {0x38, 0x10}, 142 {0x39, 0x02}, 143 {0x42, 0x60}, 144 {0x4a, 0x80}, 145 {0x4b, 0x04}, 146 {0x4d, 0x91}, 147 {0x5d, 0xc8}, 148 {0x50, 0x36}, 149 {0x51, 0x36}, 150 {0x52, 0x36}, 151 {0x53, 0x36}, 152 {0x56, 0x01}, 153 {0x63, 0x0f}, 154 {0x64, 0x10}, 155 {0x65, 0x20}, 156 {0x68, 0x46}, 157 {0x69, 0xcd}, 158 {0x70, 0x20}, 159 {0x71, 0x70}, 160 {0x72, 0x04}, 161 {0x73, 0x00}, 162 {0x70, 0x40}, 163 {0x71, 0x70}, 164 {0x72, 0x04}, 165 {0x73, 0x00}, 166 {0x70, 0x60}, 167 {0x71, 0x70}, 168 {0x72, 0x04}, 169 {0x73, 0x00}, 170 {0x70, 0x80}, 171 {0x71, 0x70}, 172 {0x72, 0x04}, 173 {0x73, 0x00}, 174 {0x70, 0xa0}, 175 {0x71, 0x70}, 176 {0x72, 0x04}, 177 {0x73, 0x00}, 178 {0x70, 0x1f}, 179 {0x76, 0x38}, 180 {0x77, 0xa6}, 181 {0x78, 0x0c}, 182 {0x79, 0x80}, 183 {0x7f, 0x14}, 184 {0x85, 0x08}, 185 {0xcd, 0xf4}, 186 {0x90, 0x33}, 187 {0x86, 0x00}, 188 {0x87, 0x0f}, 189 {0x89, 0x00}, 190 {0x8b, 0x44}, 191 {0x8c, 0x66}, 192 {0x9d, 0xc1}, 193 {0x8a, 0x10}, 194 {0xad, 0x40}, 195 {0xa0, 0x44}, 196 {0xc0, 0x08}, 197 {0xc1, 0x10}, 198 {0xc2, 0x08}, 199 {0xc3, 0x10}, 200 {0xc4, 0x08}, 201 {0xc5, 0xf0}, 202 {0xc6, 0xff}, 203 {0xc7, 0x00}, 204 {0xc8, 0x1a}, 205 {0xc9, 0x80}, 206 {0xca, 0x23}, 207 {0xcb, 0x24}, 208 {0xcc, 0xf4}, 209 {0xce, 0x74}, 210 {0x00, 0x00}, 211 {0xbd, 0x01}, 212 {0xb8, 0x00}, 213 }; 214 215 #endif 216