Antti Palosaari | 711615d | 2014-04-14 21:55:12 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Silicon Labs Si2168 DVB-T/T2/C demodulator driver |
| 3 | * |
| 4 | * Copyright (C) 2014 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 | |
Ron Economos | 380a6c8 | 2017-12-11 19:51:53 -0500 | [diff] [blame^] | 17 | #include <linux/delay.h> |
| 18 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 19 | #include "si2168_priv.h" |
| 20 | |
| 21 | static const struct dvb_frontend_ops si2168_ops; |
| 22 | |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 23 | /* execute firmware command */ |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 24 | static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd) |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 25 | { |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 26 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 27 | int ret; |
| 28 | unsigned long timeout; |
| 29 | |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 30 | mutex_lock(&dev->i2c_mutex); |
| 31 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 32 | if (cmd->wlen) { |
| 33 | /* write cmd and args for firmware */ |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 34 | ret = i2c_master_send(client, cmd->args, cmd->wlen); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 35 | if (ret < 0) { |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 36 | goto err_mutex_unlock; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 37 | } else if (ret != cmd->wlen) { |
| 38 | ret = -EREMOTEIO; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 39 | goto err_mutex_unlock; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | |
| 43 | if (cmd->rlen) { |
| 44 | /* wait cmd execution terminate */ |
Jurgen Kramer | 551c33e | 2014-12-08 05:30:44 -0300 | [diff] [blame] | 45 | #define TIMEOUT 70 |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 46 | timeout = jiffies + msecs_to_jiffies(TIMEOUT); |
| 47 | while (!time_after(jiffies, timeout)) { |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 48 | ret = i2c_master_recv(client, cmd->args, cmd->rlen); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 49 | if (ret < 0) { |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 50 | goto err_mutex_unlock; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 51 | } else if (ret != cmd->rlen) { |
| 52 | ret = -EREMOTEIO; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 53 | goto err_mutex_unlock; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | /* firmware ready? */ |
| 57 | if ((cmd->args[0] >> 7) & 0x01) |
| 58 | break; |
| 59 | } |
| 60 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 61 | dev_dbg(&client->dev, "cmd execution took %d ms\n", |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 62 | jiffies_to_msecs(jiffies) - |
| 63 | (jiffies_to_msecs(timeout) - TIMEOUT)); |
| 64 | |
Olli Salonen | 7adf99d | 2015-05-05 13:54:16 -0300 | [diff] [blame] | 65 | /* error bit set? */ |
| 66 | if ((cmd->args[0] >> 6) & 0x01) { |
| 67 | ret = -EREMOTEIO; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 68 | goto err_mutex_unlock; |
Olli Salonen | 7adf99d | 2015-05-05 13:54:16 -0300 | [diff] [blame] | 69 | } |
| 70 | |
Antti Palosaari | eefae30 | 2014-06-13 11:08:25 -0300 | [diff] [blame] | 71 | if (!((cmd->args[0] >> 7) & 0x01)) { |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 72 | ret = -ETIMEDOUT; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 73 | goto err_mutex_unlock; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 74 | } |
| 75 | } |
| 76 | |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 77 | mutex_unlock(&dev->i2c_mutex); |
Antti Palosaari | 4affbe1 | 2014-12-05 14:30:44 -0300 | [diff] [blame] | 78 | return 0; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 79 | err_mutex_unlock: |
| 80 | mutex_unlock(&dev->i2c_mutex); |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 81 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 82 | return ret; |
| 83 | } |
| 84 | |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 85 | static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 86 | { |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 87 | struct i2c_client *client = fe->demodulator_priv; |
| 88 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 89 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | 8393c00 | 2016-12-08 22:19:19 -0200 | [diff] [blame] | 90 | int ret, i; |
| 91 | unsigned int utmp, utmp1, utmp2; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 92 | struct si2168_cmd cmd; |
| 93 | |
| 94 | *status = 0; |
| 95 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 96 | if (!dev->active) { |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 97 | ret = -EAGAIN; |
| 98 | goto err; |
| 99 | } |
| 100 | |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 101 | switch (c->delivery_system) { |
| 102 | case SYS_DVBT: |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 103 | memcpy(cmd.args, "\xa0\x01", 2); |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 104 | cmd.wlen = 2; |
| 105 | cmd.rlen = 13; |
| 106 | break; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 107 | case SYS_DVBC_ANNEX_A: |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 108 | memcpy(cmd.args, "\x90\x01", 2); |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 109 | cmd.wlen = 2; |
| 110 | cmd.rlen = 9; |
| 111 | break; |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 112 | case SYS_DVBT2: |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 113 | memcpy(cmd.args, "\x50\x01", 2); |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 114 | cmd.wlen = 2; |
| 115 | cmd.rlen = 14; |
| 116 | break; |
| 117 | default: |
| 118 | ret = -EINVAL; |
| 119 | goto err; |
| 120 | } |
| 121 | |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 122 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 123 | if (ret) |
| 124 | goto err; |
| 125 | |
Antti Palosaari | 722a042 | 2014-04-22 21:36:32 -0300 | [diff] [blame] | 126 | switch ((cmd.args[2] >> 1) & 0x03) { |
| 127 | case 0x01: |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 128 | *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; |
| 129 | break; |
Antti Palosaari | 722a042 | 2014-04-22 21:36:32 -0300 | [diff] [blame] | 130 | case 0x03: |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 131 | *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | |
| 132 | FE_HAS_SYNC | FE_HAS_LOCK; |
| 133 | break; |
| 134 | } |
| 135 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 136 | dev->fe_status = *status; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 137 | |
Antti Palosaari | 88ac8f8 | 2014-07-09 20:22:27 -0300 | [diff] [blame] | 138 | if (*status & FE_HAS_LOCK) { |
| 139 | c->cnr.len = 1; |
| 140 | c->cnr.stat[0].scale = FE_SCALE_DECIBEL; |
| 141 | c->cnr.stat[0].svalue = cmd.args[3] * 1000 / 4; |
| 142 | } else { |
| 143 | c->cnr.len = 1; |
| 144 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 145 | } |
| 146 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 147 | dev_dbg(&client->dev, "status=%02x args=%*ph\n", |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 148 | *status, cmd.rlen, cmd.args); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 149 | |
Antti Palosaari | 8393c00 | 2016-12-08 22:19:19 -0200 | [diff] [blame] | 150 | /* BER */ |
| 151 | if (*status & FE_HAS_VITERBI) { |
| 152 | memcpy(cmd.args, "\x82\x00", 2); |
| 153 | cmd.wlen = 2; |
| 154 | cmd.rlen = 3; |
| 155 | ret = si2168_cmd_execute(client, &cmd); |
| 156 | if (ret) |
| 157 | goto err; |
| 158 | |
| 159 | /* |
| 160 | * Firmware returns [0, 255] mantissa and [0, 8] exponent. |
| 161 | * Convert to DVB API: mantissa * 10^(8 - exponent) / 10^8 |
| 162 | */ |
| 163 | utmp = clamp(8 - cmd.args[1], 0, 8); |
| 164 | for (i = 0, utmp1 = 1; i < utmp; i++) |
| 165 | utmp1 = utmp1 * 10; |
| 166 | |
| 167 | utmp1 = cmd.args[2] * utmp1; |
| 168 | utmp2 = 100000000; /* 10^8 */ |
| 169 | |
| 170 | dev_dbg(&client->dev, |
| 171 | "post_bit_error=%u post_bit_count=%u ber=%u*10^-%u\n", |
| 172 | utmp1, utmp2, cmd.args[2], cmd.args[1]); |
| 173 | |
| 174 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; |
| 175 | c->post_bit_error.stat[0].uvalue += utmp1; |
| 176 | c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; |
| 177 | c->post_bit_count.stat[0].uvalue += utmp2; |
| 178 | } else { |
| 179 | c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 180 | c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 181 | } |
| 182 | |
Antti Palosaari | c62d29c | 2016-12-09 11:11:32 -0200 | [diff] [blame] | 183 | /* UCB */ |
| 184 | if (*status & FE_HAS_SYNC) { |
| 185 | memcpy(cmd.args, "\x84\x01", 2); |
| 186 | cmd.wlen = 2; |
| 187 | cmd.rlen = 3; |
| 188 | ret = si2168_cmd_execute(client, &cmd); |
| 189 | if (ret) |
| 190 | goto err; |
| 191 | |
| 192 | utmp1 = cmd.args[2] << 8 | cmd.args[1] << 0; |
| 193 | dev_dbg(&client->dev, "block_error=%u\n", utmp1); |
| 194 | |
| 195 | /* Sometimes firmware returns bogus value */ |
| 196 | if (utmp1 == 0xffff) |
| 197 | utmp1 = 0; |
| 198 | |
| 199 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; |
| 200 | c->block_error.stat[0].uvalue += utmp1; |
| 201 | } else { |
| 202 | c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 203 | } |
| 204 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 205 | return 0; |
| 206 | err: |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 207 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 208 | return ret; |
| 209 | } |
| 210 | |
| 211 | static int si2168_set_frontend(struct dvb_frontend *fe) |
| 212 | { |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 213 | struct i2c_client *client = fe->demodulator_priv; |
| 214 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 215 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
| 216 | int ret; |
| 217 | struct si2168_cmd cmd; |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 218 | u8 bandwidth, delivery_system; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 219 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 220 | dev_dbg(&client->dev, |
Antti Palosaari | e5dd110 | 2014-12-05 15:57:03 -0300 | [diff] [blame] | 221 | "delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%u stream_id=%u\n", |
| 222 | c->delivery_system, c->modulation, c->frequency, |
| 223 | c->bandwidth_hz, c->symbol_rate, c->inversion, |
| 224 | c->stream_id); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 225 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 226 | if (!dev->active) { |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 227 | ret = -EAGAIN; |
| 228 | goto err; |
| 229 | } |
| 230 | |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 231 | switch (c->delivery_system) { |
| 232 | case SYS_DVBT: |
| 233 | delivery_system = 0x20; |
| 234 | break; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 235 | case SYS_DVBC_ANNEX_A: |
| 236 | delivery_system = 0x30; |
| 237 | break; |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 238 | case SYS_DVBT2: |
| 239 | delivery_system = 0x70; |
| 240 | break; |
| 241 | default: |
| 242 | ret = -EINVAL; |
| 243 | goto err; |
| 244 | } |
| 245 | |
Olli Salonen | 683e98b | 2015-01-16 09:35:19 -0300 | [diff] [blame] | 246 | if (c->bandwidth_hz == 0) { |
| 247 | ret = -EINVAL; |
| 248 | goto err; |
Olli Salonen | 17d4d6a | 2015-01-16 09:35:20 -0300 | [diff] [blame] | 249 | } else if (c->bandwidth_hz <= 2000000) |
| 250 | bandwidth = 0x02; |
| 251 | else if (c->bandwidth_hz <= 5000000) |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 252 | bandwidth = 0x05; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 253 | else if (c->bandwidth_hz <= 6000000) |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 254 | bandwidth = 0x06; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 255 | else if (c->bandwidth_hz <= 7000000) |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 256 | bandwidth = 0x07; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 257 | else if (c->bandwidth_hz <= 8000000) |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 258 | bandwidth = 0x08; |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 259 | else if (c->bandwidth_hz <= 9000000) |
| 260 | bandwidth = 0x09; |
| 261 | else if (c->bandwidth_hz <= 10000000) |
| 262 | bandwidth = 0x0a; |
| 263 | else |
| 264 | bandwidth = 0x0f; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 265 | |
| 266 | /* program tuner */ |
| 267 | if (fe->ops.tuner_ops.set_params) { |
| 268 | ret = fe->ops.tuner_ops.set_params(fe); |
| 269 | if (ret) |
| 270 | goto err; |
| 271 | } |
| 272 | |
| 273 | memcpy(cmd.args, "\x88\x02\x02\x02\x02", 5); |
| 274 | cmd.wlen = 5; |
| 275 | cmd.rlen = 5; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 276 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 277 | if (ret) |
| 278 | goto err; |
| 279 | |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 280 | /* that has no big effect */ |
| 281 | if (c->delivery_system == SYS_DVBT) |
| 282 | memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 283 | else if (c->delivery_system == SYS_DVBC_ANNEX_A) |
| 284 | memcpy(cmd.args, "\x89\x21\x06\x11\x89\xf0", 6); |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 285 | else if (c->delivery_system == SYS_DVBT2) |
| 286 | memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 287 | cmd.wlen = 6; |
| 288 | cmd.rlen = 3; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 289 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 290 | if (ret) |
| 291 | goto err; |
| 292 | |
CrazyCat | e395e57 | 2014-08-16 18:33:14 -0300 | [diff] [blame] | 293 | if (c->delivery_system == SYS_DVBT2) { |
| 294 | /* select PLP */ |
| 295 | cmd.args[0] = 0x52; |
| 296 | cmd.args[1] = c->stream_id & 0xff; |
| 297 | cmd.args[2] = c->stream_id == NO_STREAM_ID_FILTER ? 0 : 1; |
| 298 | cmd.wlen = 3; |
| 299 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 300 | ret = si2168_cmd_execute(client, &cmd); |
CrazyCat | e395e57 | 2014-08-16 18:33:14 -0300 | [diff] [blame] | 301 | if (ret) |
| 302 | goto err; |
| 303 | } |
| 304 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 305 | memcpy(cmd.args, "\x51\x03", 2); |
| 306 | cmd.wlen = 2; |
| 307 | cmd.rlen = 12; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 308 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 309 | if (ret) |
| 310 | goto err; |
| 311 | |
| 312 | memcpy(cmd.args, "\x12\x08\x04", 3); |
| 313 | cmd.wlen = 3; |
| 314 | cmd.rlen = 3; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 315 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 316 | if (ret) |
| 317 | goto err; |
| 318 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 319 | memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6); |
| 320 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 321 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 322 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 323 | if (ret) |
| 324 | goto err; |
| 325 | |
| 326 | memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6); |
| 327 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 328 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 329 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 330 | if (ret) |
| 331 | goto err; |
| 332 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 333 | memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6); |
| 334 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 335 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 336 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 337 | if (ret) |
| 338 | goto err; |
| 339 | |
| 340 | memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); |
Antti Palosaari | bffab93 | 2014-04-11 20:35:27 -0300 | [diff] [blame] | 341 | cmd.args[4] = delivery_system | bandwidth; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 342 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 343 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 344 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 345 | if (ret) |
| 346 | goto err; |
| 347 | |
Luis Alves | 32bf881 | 2014-07-17 14:31:28 -0300 | [diff] [blame] | 348 | /* set DVB-C symbol rate */ |
| 349 | if (c->delivery_system == SYS_DVBC_ANNEX_A) { |
| 350 | memcpy(cmd.args, "\x14\x00\x02\x11", 4); |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 351 | cmd.args[4] = ((c->symbol_rate / 1000) >> 0) & 0xff; |
Luis Alves | 32bf881 | 2014-07-17 14:31:28 -0300 | [diff] [blame] | 352 | cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff; |
| 353 | cmd.wlen = 6; |
| 354 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 355 | ret = si2168_cmd_execute(client, &cmd); |
Luis Alves | 32bf881 | 2014-07-17 14:31:28 -0300 | [diff] [blame] | 356 | if (ret) |
| 357 | goto err; |
| 358 | } |
| 359 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 360 | memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); |
| 361 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 362 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 363 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 364 | if (ret) |
| 365 | goto err; |
| 366 | |
CrazyCat | 5279197 | 2014-11-14 18:22:10 -0300 | [diff] [blame] | 367 | memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x08", 6); |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 368 | cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 369 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 370 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 371 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 372 | if (ret) |
| 373 | goto err; |
| 374 | |
CrazyCat | 5279197 | 2014-11-14 18:22:10 -0300 | [diff] [blame] | 375 | memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 376 | cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 377 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 378 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 379 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 380 | if (ret) |
| 381 | goto err; |
| 382 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 383 | memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6); |
| 384 | cmd.wlen = 6; |
Antti Palosaari | 1d518c2 | 2014-07-11 10:40:29 -0300 | [diff] [blame] | 385 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 386 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 387 | if (ret) |
| 388 | goto err; |
| 389 | |
Olli Salonen | 4391177 | 2014-07-17 15:43:27 -0300 | [diff] [blame] | 390 | memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6); |
| 391 | cmd.wlen = 6; |
| 392 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 393 | ret = si2168_cmd_execute(client, &cmd); |
Olli Salonen | 4391177 | 2014-07-17 15:43:27 -0300 | [diff] [blame] | 394 | if (ret) |
| 395 | goto err; |
| 396 | |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 397 | memcpy(cmd.args, "\x85", 1); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 398 | cmd.wlen = 1; |
| 399 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 400 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 401 | if (ret) |
| 402 | goto err; |
| 403 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 404 | dev->delivery_system = c->delivery_system; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 405 | |
| 406 | return 0; |
| 407 | err: |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 408 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 409 | return ret; |
| 410 | } |
| 411 | |
| 412 | static int si2168_init(struct dvb_frontend *fe) |
| 413 | { |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 414 | struct i2c_client *client = fe->demodulator_priv; |
| 415 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | 8393c00 | 2016-12-08 22:19:19 -0200 | [diff] [blame] | 416 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 417 | int ret, len, remaining; |
Antti Palosaari | 58f6693 | 2014-12-05 17:22:42 -0300 | [diff] [blame] | 418 | const struct firmware *fw; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 419 | struct si2168_cmd cmd; |
| 420 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 421 | dev_dbg(&client->dev, "\n"); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 422 | |
Olli Salonen | 8e41722 | 2014-08-25 15:07:04 -0300 | [diff] [blame] | 423 | /* initialize */ |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 424 | memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 425 | cmd.wlen = 13; |
| 426 | cmd.rlen = 0; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 427 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 428 | if (ret) |
| 429 | goto err; |
| 430 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 431 | if (dev->warm) { |
Olli Salonen | 8e41722 | 2014-08-25 15:07:04 -0300 | [diff] [blame] | 432 | /* resume */ |
| 433 | memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8); |
| 434 | cmd.wlen = 8; |
| 435 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 436 | ret = si2168_cmd_execute(client, &cmd); |
Olli Salonen | 8e41722 | 2014-08-25 15:07:04 -0300 | [diff] [blame] | 437 | if (ret) |
| 438 | goto err; |
| 439 | |
Ron Economos | 380a6c8 | 2017-12-11 19:51:53 -0500 | [diff] [blame^] | 440 | udelay(100); |
Olli Salonen | 8e41722 | 2014-08-25 15:07:04 -0300 | [diff] [blame] | 441 | memcpy(cmd.args, "\x85", 1); |
| 442 | cmd.wlen = 1; |
| 443 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 444 | ret = si2168_cmd_execute(client, &cmd); |
Olli Salonen | 8e41722 | 2014-08-25 15:07:04 -0300 | [diff] [blame] | 445 | if (ret) |
| 446 | goto err; |
| 447 | |
| 448 | goto warm; |
| 449 | } |
| 450 | |
| 451 | /* power up */ |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 452 | memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 453 | cmd.wlen = 8; |
| 454 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 455 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 456 | if (ret) |
| 457 | goto err; |
| 458 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 459 | /* request the firmware, this will block and timeout */ |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 460 | ret = request_firmware(&fw, dev->firmware_name, &client->dev); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 461 | if (ret) { |
Antti Palosaari | b6b6fd6 | 2014-07-13 19:22:19 -0300 | [diff] [blame] | 462 | /* fallback mechanism to handle old name for Si2168 B40 fw */ |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 463 | if (dev->chip_id == SI2168_CHIP_ID_B40) { |
| 464 | dev->firmware_name = SI2168_B40_FIRMWARE_FALLBACK; |
| 465 | ret = request_firmware(&fw, dev->firmware_name, |
| 466 | &client->dev); |
Olli Salonen | c9cb082 | 2014-07-13 10:52:18 -0300 | [diff] [blame] | 467 | } |
Antti Palosaari | b6b6fd6 | 2014-07-13 19:22:19 -0300 | [diff] [blame] | 468 | |
| 469 | if (ret == 0) { |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 470 | dev_notice(&client->dev, |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 471 | "please install firmware file '%s'\n", |
| 472 | SI2168_B40_FIRMWARE); |
Antti Palosaari | b6b6fd6 | 2014-07-13 19:22:19 -0300 | [diff] [blame] | 473 | } else { |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 474 | dev_err(&client->dev, |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 475 | "firmware file '%s' not found\n", |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 476 | dev->firmware_name); |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 477 | goto err_release_firmware; |
Olli Salonen | c9cb082 | 2014-07-13 10:52:18 -0300 | [diff] [blame] | 478 | } |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 479 | } |
| 480 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 481 | dev_info(&client->dev, "downloading firmware from file '%s'\n", |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 482 | dev->firmware_name); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 483 | |
Olli Salonen | 1b97dc9 | 2014-11-27 16:42:23 -0300 | [diff] [blame] | 484 | if ((fw->size % 17 == 0) && (fw->data[0] > 5)) { |
| 485 | /* firmware is in the new format */ |
| 486 | for (remaining = fw->size; remaining > 0; remaining -= 17) { |
| 487 | len = fw->data[fw->size - remaining]; |
Laura Abbott | 47810b4 | 2015-09-29 21:10:09 -0300 | [diff] [blame] | 488 | if (len > SI2168_ARGLEN) { |
| 489 | ret = -EINVAL; |
| 490 | break; |
| 491 | } |
Olli Salonen | 1b97dc9 | 2014-11-27 16:42:23 -0300 | [diff] [blame] | 492 | memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); |
| 493 | cmd.wlen = len; |
| 494 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 495 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 68c16a7 | 2014-12-05 17:08:22 -0300 | [diff] [blame] | 496 | if (ret) |
| 497 | break; |
Olli Salonen | 1b97dc9 | 2014-11-27 16:42:23 -0300 | [diff] [blame] | 498 | } |
Antti Palosaari | 68c16a7 | 2014-12-05 17:08:22 -0300 | [diff] [blame] | 499 | } else if (fw->size % 8 == 0) { |
Olli Salonen | 1b97dc9 | 2014-11-27 16:42:23 -0300 | [diff] [blame] | 500 | /* firmware is in the old format */ |
Antti Palosaari | 68c16a7 | 2014-12-05 17:08:22 -0300 | [diff] [blame] | 501 | for (remaining = fw->size; remaining > 0; remaining -= 8) { |
| 502 | len = 8; |
Olli Salonen | 1b97dc9 | 2014-11-27 16:42:23 -0300 | [diff] [blame] | 503 | memcpy(cmd.args, &fw->data[fw->size - remaining], len); |
| 504 | cmd.wlen = len; |
| 505 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 506 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 68c16a7 | 2014-12-05 17:08:22 -0300 | [diff] [blame] | 507 | if (ret) |
| 508 | break; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 509 | } |
Antti Palosaari | 68c16a7 | 2014-12-05 17:08:22 -0300 | [diff] [blame] | 510 | } else { |
| 511 | /* bad or unknown firmware format */ |
| 512 | ret = -EINVAL; |
| 513 | } |
| 514 | |
| 515 | if (ret) { |
| 516 | dev_err(&client->dev, "firmware download failed %d\n", ret); |
| 517 | goto err_release_firmware; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | release_firmware(fw); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 521 | |
Antti Palosaari | 888680f | 2014-07-09 19:36:58 -0300 | [diff] [blame] | 522 | memcpy(cmd.args, "\x01\x01", 2); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 523 | cmd.wlen = 2; |
| 524 | cmd.rlen = 1; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 525 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 526 | if (ret) |
| 527 | goto err; |
| 528 | |
Olli Salonen | a594cf2 | 2014-11-27 16:42:22 -0300 | [diff] [blame] | 529 | /* query firmware version */ |
| 530 | memcpy(cmd.args, "\x11", 1); |
| 531 | cmd.wlen = 1; |
| 532 | cmd.rlen = 10; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 533 | ret = si2168_cmd_execute(client, &cmd); |
Olli Salonen | a594cf2 | 2014-11-27 16:42:22 -0300 | [diff] [blame] | 534 | if (ret) |
| 535 | goto err; |
| 536 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 537 | dev->version = (cmd.args[9] + '@') << 24 | (cmd.args[6] - '0') << 16 | |
| 538 | (cmd.args[7] - '0') << 8 | (cmd.args[8]) << 0; |
| 539 | dev_info(&client->dev, "firmware version: %c %d.%d.%d\n", |
| 540 | dev->version >> 24 & 0xff, dev->version >> 16 & 0xff, |
| 541 | dev->version >> 8 & 0xff, dev->version >> 0 & 0xff); |
Olli Salonen | a594cf2 | 2014-11-27 16:42:22 -0300 | [diff] [blame] | 542 | |
Olli Salonen | 389ce39 | 2014-08-11 16:58:10 -0300 | [diff] [blame] | 543 | /* set ts mode */ |
| 544 | memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 545 | cmd.args[4] |= dev->ts_mode; |
Olli Salonen | 8117a31 | 2015-05-05 13:54:14 -0300 | [diff] [blame] | 546 | if (dev->ts_clock_gapped) |
| 547 | cmd.args[4] |= 0x40; |
Olli Salonen | 389ce39 | 2014-08-11 16:58:10 -0300 | [diff] [blame] | 548 | cmd.wlen = 6; |
| 549 | cmd.rlen = 4; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 550 | ret = si2168_cmd_execute(client, &cmd); |
Olli Salonen | 389ce39 | 2014-08-11 16:58:10 -0300 | [diff] [blame] | 551 | if (ret) |
| 552 | goto err; |
| 553 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 554 | dev->warm = true; |
Antti Palosaari | 45c3cbb | 2014-11-03 18:28:39 -0300 | [diff] [blame] | 555 | warm: |
Antti Palosaari | 8393c00 | 2016-12-08 22:19:19 -0200 | [diff] [blame] | 556 | /* Init stats here to indicate which stats are supported */ |
| 557 | c->cnr.len = 1; |
| 558 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 559 | c->post_bit_error.len = 1; |
| 560 | c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 561 | c->post_bit_count.len = 1; |
| 562 | c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
Antti Palosaari | c62d29c | 2016-12-09 11:11:32 -0200 | [diff] [blame] | 563 | c->block_error.len = 1; |
| 564 | c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
Antti Palosaari | 8393c00 | 2016-12-08 22:19:19 -0200 | [diff] [blame] | 565 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 566 | dev->active = true; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 567 | |
| 568 | return 0; |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 569 | err_release_firmware: |
Markus Elfring | 034e1ec | 2014-11-19 19:23:15 -0300 | [diff] [blame] | 570 | release_firmware(fw); |
| 571 | err: |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 572 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 573 | return ret; |
| 574 | } |
| 575 | |
| 576 | static int si2168_sleep(struct dvb_frontend *fe) |
| 577 | { |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 578 | struct i2c_client *client = fe->demodulator_priv; |
| 579 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | 4de0ed7 | 2014-07-09 18:45:31 -0300 | [diff] [blame] | 580 | int ret; |
| 581 | struct si2168_cmd cmd; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 582 | |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 583 | dev_dbg(&client->dev, "\n"); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 584 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 585 | dev->active = false; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 586 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 587 | /* Firmware B 4.0-11 or later loses warm state during sleep */ |
| 588 | if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0)) |
| 589 | dev->warm = false; |
| 590 | |
Antti Palosaari | 4de0ed7 | 2014-07-09 18:45:31 -0300 | [diff] [blame] | 591 | memcpy(cmd.args, "\x13", 1); |
| 592 | cmd.wlen = 1; |
| 593 | cmd.rlen = 0; |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 594 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | 4de0ed7 | 2014-07-09 18:45:31 -0300 | [diff] [blame] | 595 | if (ret) |
| 596 | goto err; |
| 597 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 598 | return 0; |
Antti Palosaari | 4de0ed7 | 2014-07-09 18:45:31 -0300 | [diff] [blame] | 599 | err: |
Antti Palosaari | 3de3583 | 2014-11-25 17:53:21 -0300 | [diff] [blame] | 600 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 4de0ed7 | 2014-07-09 18:45:31 -0300 | [diff] [blame] | 601 | return ret; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 602 | } |
| 603 | |
| 604 | static int si2168_get_tune_settings(struct dvb_frontend *fe, |
| 605 | struct dvb_frontend_tune_settings *s) |
| 606 | { |
| 607 | s->min_delay_ms = 900; |
| 608 | |
| 609 | return 0; |
| 610 | } |
| 611 | |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 612 | static int si2168_select(struct i2c_mux_core *muxc, u32 chan) |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 613 | { |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 614 | struct i2c_client *client = i2c_mux_priv(muxc); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 615 | int ret; |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 616 | struct si2168_cmd cmd; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 617 | |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 618 | /* open I2C gate */ |
| 619 | memcpy(cmd.args, "\xc0\x0d\x01", 3); |
| 620 | cmd.wlen = 3; |
| 621 | cmd.rlen = 0; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 622 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 623 | if (ret) |
| 624 | goto err; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 625 | |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 626 | return 0; |
| 627 | err: |
| 628 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 629 | return ret; |
| 630 | } |
| 631 | |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 632 | static int si2168_deselect(struct i2c_mux_core *muxc, u32 chan) |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 633 | { |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 634 | struct i2c_client *client = i2c_mux_priv(muxc); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 635 | int ret; |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 636 | struct si2168_cmd cmd; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 637 | |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 638 | /* close I2C gate */ |
| 639 | memcpy(cmd.args, "\xc0\x0d\x00", 3); |
| 640 | cmd.wlen = 3; |
| 641 | cmd.rlen = 0; |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 642 | ret = si2168_cmd_execute(client, &cmd); |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 643 | if (ret) |
| 644 | goto err; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 645 | |
Antti Palosaari | d2b72f6 | 2015-05-29 16:42:33 -0300 | [diff] [blame] | 646 | return 0; |
| 647 | err: |
| 648 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 649 | return ret; |
| 650 | } |
| 651 | |
| 652 | static const struct dvb_frontend_ops si2168_ops = { |
Antti Palosaari | c790885 | 2014-04-12 01:58:32 -0300 | [diff] [blame] | 653 | .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A}, |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 654 | .info = { |
| 655 | .name = "Silicon Labs Si2168", |
Antti Palosaari | f1ecc5d | 2014-11-25 16:26:49 -0300 | [diff] [blame] | 656 | .symbol_rate_min = 1000000, |
| 657 | .symbol_rate_max = 7200000, |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 658 | .caps = FE_CAN_FEC_1_2 | |
| 659 | FE_CAN_FEC_2_3 | |
| 660 | FE_CAN_FEC_3_4 | |
| 661 | FE_CAN_FEC_5_6 | |
| 662 | FE_CAN_FEC_7_8 | |
| 663 | FE_CAN_FEC_AUTO | |
| 664 | FE_CAN_QPSK | |
| 665 | FE_CAN_QAM_16 | |
| 666 | FE_CAN_QAM_32 | |
| 667 | FE_CAN_QAM_64 | |
| 668 | FE_CAN_QAM_128 | |
| 669 | FE_CAN_QAM_256 | |
| 670 | FE_CAN_QAM_AUTO | |
| 671 | FE_CAN_TRANSMISSION_MODE_AUTO | |
| 672 | FE_CAN_GUARD_INTERVAL_AUTO | |
| 673 | FE_CAN_HIERARCHY_AUTO | |
| 674 | FE_CAN_MUTE_TS | |
Olli Salonen | 327eeb3 | 2014-09-23 13:53:09 -0300 | [diff] [blame] | 675 | FE_CAN_2G_MODULATION | |
| 676 | FE_CAN_MULTISTREAM |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 677 | }, |
| 678 | |
| 679 | .get_tune_settings = si2168_get_tune_settings, |
| 680 | |
| 681 | .init = si2168_init, |
| 682 | .sleep = si2168_sleep, |
| 683 | |
| 684 | .set_frontend = si2168_set_frontend, |
| 685 | |
| 686 | .read_status = si2168_read_status, |
| 687 | }; |
| 688 | |
| 689 | static int si2168_probe(struct i2c_client *client, |
| 690 | const struct i2c_device_id *id) |
| 691 | { |
| 692 | struct si2168_config *config = client->dev.platform_data; |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 693 | struct si2168_dev *dev; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 694 | int ret; |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 695 | struct si2168_cmd cmd; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 696 | |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 697 | dev_dbg(&client->dev, "\n"); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 698 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 699 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 700 | if (!dev) { |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 701 | ret = -ENOMEM; |
Antti Palosaari | 1ee5e7d | 2014-12-05 16:02:42 -0300 | [diff] [blame] | 702 | goto err; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 703 | } |
| 704 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 705 | i2c_set_clientdata(client, dev); |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 706 | mutex_init(&dev->i2c_mutex); |
| 707 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 708 | /* Initialize */ |
| 709 | memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); |
| 710 | cmd.wlen = 13; |
| 711 | cmd.rlen = 0; |
| 712 | ret = si2168_cmd_execute(client, &cmd); |
| 713 | if (ret) |
| 714 | goto err_kfree; |
| 715 | |
| 716 | /* Power up */ |
| 717 | memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); |
| 718 | cmd.wlen = 8; |
| 719 | cmd.rlen = 1; |
| 720 | ret = si2168_cmd_execute(client, &cmd); |
| 721 | if (ret) |
| 722 | goto err_kfree; |
| 723 | |
| 724 | /* Query chip revision */ |
| 725 | memcpy(cmd.args, "\x02", 1); |
| 726 | cmd.wlen = 1; |
| 727 | cmd.rlen = 13; |
| 728 | ret = si2168_cmd_execute(client, &cmd); |
| 729 | if (ret) |
| 730 | goto err_kfree; |
| 731 | |
| 732 | dev->chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | |
| 733 | cmd.args[3] << 8 | cmd.args[4] << 0; |
| 734 | |
| 735 | switch (dev->chip_id) { |
| 736 | case SI2168_CHIP_ID_A20: |
| 737 | dev->firmware_name = SI2168_A20_FIRMWARE; |
| 738 | break; |
| 739 | case SI2168_CHIP_ID_A30: |
| 740 | dev->firmware_name = SI2168_A30_FIRMWARE; |
| 741 | break; |
| 742 | case SI2168_CHIP_ID_B40: |
| 743 | dev->firmware_name = SI2168_B40_FIRMWARE; |
| 744 | break; |
Evgeny Plehov | 50d6446 | 2017-02-07 19:33:47 -0200 | [diff] [blame] | 745 | case SI2168_CHIP_ID_D60: |
| 746 | dev->firmware_name = SI2168_D60_FIRMWARE; |
| 747 | break; |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 748 | default: |
| 749 | dev_dbg(&client->dev, "unknown chip version Si21%d-%c%c%c\n", |
| 750 | cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); |
| 751 | ret = -ENODEV; |
| 752 | goto err_kfree; |
| 753 | } |
| 754 | |
| 755 | dev->version = (cmd.args[1]) << 24 | (cmd.args[3] - '0') << 16 | |
| 756 | (cmd.args[4] - '0') << 8 | (cmd.args[5]) << 0; |
| 757 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 758 | /* create mux i2c adapter for tuner */ |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 759 | dev->muxc = i2c_mux_alloc(client->adapter, &client->dev, |
Antti Palosaari | e6d7ffc | 2016-05-04 22:15:32 +0200 | [diff] [blame] | 760 | 1, 0, I2C_MUX_LOCKED, |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 761 | si2168_select, si2168_deselect); |
| 762 | if (!dev->muxc) { |
| 763 | ret = -ENOMEM; |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 764 | goto err_kfree; |
Luis Alves | 4d6efc7 | 2014-07-17 16:38:08 -0300 | [diff] [blame] | 765 | } |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 766 | dev->muxc->priv = client; |
| 767 | ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0); |
| 768 | if (ret) |
| 769 | goto err_kfree; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 770 | |
| 771 | /* create dvb_frontend */ |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 772 | memcpy(&dev->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops)); |
Antti Palosaari | 6307b56 | 2014-11-25 17:31:43 -0300 | [diff] [blame] | 773 | dev->fe.demodulator_priv = client; |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 774 | *config->i2c_adapter = dev->muxc->adapter[0]; |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 775 | *config->fe = &dev->fe; |
| 776 | dev->ts_mode = config->ts_mode; |
| 777 | dev->ts_clock_inv = config->ts_clock_inv; |
Olli Salonen | 8117a31 | 2015-05-05 13:54:14 -0300 | [diff] [blame] | 778 | dev->ts_clock_gapped = config->ts_clock_gapped; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 779 | |
Antti Palosaari | 6ab1e94 | 2016-06-29 20:38:17 -0300 | [diff] [blame] | 780 | dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n", |
| 781 | dev->version >> 24 & 0xff, dev->version >> 16 & 0xff, |
| 782 | dev->version >> 8 & 0xff); |
| 783 | dev_info(&client->dev, "firmware version: %c %d.%d.%d\n", |
| 784 | dev->version >> 24 & 0xff, dev->version >> 16 & 0xff, |
| 785 | dev->version >> 8 & 0xff, dev->version >> 0 & 0xff); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 786 | |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 787 | return 0; |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 788 | err_kfree: |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 789 | kfree(dev); |
Antti Palosaari | 1ee5e7d | 2014-12-05 16:02:42 -0300 | [diff] [blame] | 790 | err: |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 791 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 792 | return ret; |
| 793 | } |
| 794 | |
| 795 | static int si2168_remove(struct i2c_client *client) |
| 796 | { |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 797 | struct si2168_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 798 | |
Olli Salonen | 37b4e43 | 2014-08-05 08:54:08 -0300 | [diff] [blame] | 799 | dev_dbg(&client->dev, "\n"); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 800 | |
Peter Rosin | 58d7b54 | 2016-04-20 08:41:36 +0200 | [diff] [blame] | 801 | i2c_mux_del_adapters(dev->muxc); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 802 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 803 | dev->fe.ops.release = NULL; |
| 804 | dev->fe.demodulator_priv = NULL; |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 805 | |
Antti Palosaari | bd01c76 | 2014-11-25 16:46:16 -0300 | [diff] [blame] | 806 | kfree(dev); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 807 | |
| 808 | return 0; |
| 809 | } |
| 810 | |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 811 | static const struct i2c_device_id si2168_id_table[] = { |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 812 | {"si2168", 0}, |
| 813 | {} |
| 814 | }; |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 815 | MODULE_DEVICE_TABLE(i2c, si2168_id_table); |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 816 | |
| 817 | static struct i2c_driver si2168_driver = { |
| 818 | .driver = { |
Antti Palosaari | e06be1d | 2016-06-29 20:38:18 -0300 | [diff] [blame] | 819 | .name = "si2168", |
| 820 | .suppress_bind_attrs = true, |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 821 | }, |
| 822 | .probe = si2168_probe, |
| 823 | .remove = si2168_remove, |
Antti Palosaari | 346d490 | 2014-12-05 14:54:14 -0300 | [diff] [blame] | 824 | .id_table = si2168_id_table, |
Antti Palosaari | 845f350 | 2014-04-10 22:00:50 -0300 | [diff] [blame] | 825 | }; |
| 826 | |
| 827 | module_i2c_driver(si2168_driver); |
| 828 | |
| 829 | MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); |
| 830 | MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver"); |
| 831 | MODULE_LICENSE("GPL"); |
Luis Alves | 635a90c | 2014-07-17 19:43:37 -0300 | [diff] [blame] | 832 | MODULE_FIRMWARE(SI2168_A20_FIRMWARE); |
Antti Palosaari | 668aa63 | 2014-07-13 16:09:03 -0300 | [diff] [blame] | 833 | MODULE_FIRMWARE(SI2168_A30_FIRMWARE); |
Olli Salonen | c9cb082 | 2014-07-13 10:52:18 -0300 | [diff] [blame] | 834 | MODULE_FIRMWARE(SI2168_B40_FIRMWARE); |
Evgeny Plehov | 50d6446 | 2017-02-07 19:33:47 -0200 | [diff] [blame] | 835 | MODULE_FIRMWARE(SI2168_D60_FIRMWARE); |