Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1 | /* |
| 2 | * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver |
| 3 | * |
| 4 | * Copyright (C) 2011 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 | * 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 | #include "tda10071_priv.h" |
| 22 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 23 | static struct dvb_frontend_ops tda10071_ops; |
| 24 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 25 | /* |
| 26 | * XXX: regmap_update_bits() does not fit our needs as it does not support |
| 27 | * partially volatile registers. Also it performs register read even mask is as |
| 28 | * wide as register value. |
| 29 | */ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 30 | /* write single register with mask */ |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 31 | static int tda10071_wr_reg_mask(struct tda10071_dev *dev, |
Mauro Carvalho Chehab | babb618 | 2012-10-27 11:27:24 -0300 | [diff] [blame] | 32 | u8 reg, u8 val, u8 mask) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 33 | { |
| 34 | int ret; |
| 35 | u8 tmp; |
| 36 | |
| 37 | /* no need for read if whole reg is written */ |
| 38 | if (mask != 0xff) { |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 39 | ret = regmap_bulk_read(dev->regmap, reg, &tmp, 1); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 40 | if (ret) |
| 41 | return ret; |
| 42 | |
| 43 | val &= mask; |
| 44 | tmp &= ~mask; |
| 45 | val |= tmp; |
| 46 | } |
| 47 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 48 | return regmap_bulk_write(dev->regmap, reg, &val, 1); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | /* execute firmware command */ |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 52 | static int tda10071_cmd_execute(struct tda10071_dev *dev, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 53 | struct tda10071_cmd *cmd) |
| 54 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 55 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 56 | int ret, i; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 57 | unsigned int uitmp; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 58 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 59 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 60 | ret = -EFAULT; |
| 61 | goto error; |
| 62 | } |
| 63 | |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 64 | mutex_lock(&dev->cmd_execute_mutex); |
| 65 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 66 | /* write cmd and args for firmware */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 67 | ret = regmap_bulk_write(dev->regmap, 0x00, cmd->args, cmd->len); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 68 | if (ret) |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 69 | goto error_mutex_unlock; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 70 | |
| 71 | /* start cmd execution */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 72 | ret = regmap_write(dev->regmap, 0x1f, 1); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 73 | if (ret) |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 74 | goto error_mutex_unlock; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 75 | |
| 76 | /* wait cmd execution terminate */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 77 | for (i = 1000, uitmp = 1; i && uitmp; i--) { |
| 78 | ret = regmap_read(dev->regmap, 0x1f, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 79 | if (ret) |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 80 | goto error_mutex_unlock; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 81 | |
Antti Palosaari | d102b73 | 2011-09-13 11:51:23 -0300 | [diff] [blame] | 82 | usleep_range(200, 5000); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 83 | } |
| 84 | |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 85 | mutex_unlock(&dev->cmd_execute_mutex); |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 86 | dev_dbg(&client->dev, "loop=%d\n", i); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 87 | |
| 88 | if (i == 0) { |
| 89 | ret = -ETIMEDOUT; |
| 90 | goto error; |
| 91 | } |
| 92 | |
| 93 | return ret; |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 94 | error_mutex_unlock: |
| 95 | mutex_unlock(&dev->cmd_execute_mutex); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 96 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 97 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 98 | return ret; |
| 99 | } |
| 100 | |
| 101 | static int tda10071_set_tone(struct dvb_frontend *fe, |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 102 | enum fe_sec_tone_mode fe_sec_tone_mode) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 103 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 104 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 105 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 106 | struct tda10071_cmd cmd; |
| 107 | int ret; |
| 108 | u8 tone; |
| 109 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 110 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 111 | ret = -EFAULT; |
| 112 | goto error; |
| 113 | } |
| 114 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 115 | dev_dbg(&client->dev, "tone_mode=%d\n", fe_sec_tone_mode); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 116 | |
| 117 | switch (fe_sec_tone_mode) { |
| 118 | case SEC_TONE_ON: |
| 119 | tone = 1; |
| 120 | break; |
| 121 | case SEC_TONE_OFF: |
| 122 | tone = 0; |
| 123 | break; |
| 124 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 125 | dev_dbg(&client->dev, "invalid fe_sec_tone_mode\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 126 | ret = -EINVAL; |
| 127 | goto error; |
| 128 | } |
| 129 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 130 | cmd.args[0] = CMD_LNB_PCB_CONFIG; |
| 131 | cmd.args[1] = 0; |
| 132 | cmd.args[2] = 0x00; |
| 133 | cmd.args[3] = 0x00; |
| 134 | cmd.args[4] = tone; |
| 135 | cmd.len = 5; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 136 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 137 | if (ret) |
| 138 | goto error; |
| 139 | |
| 140 | return ret; |
| 141 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 142 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 143 | return ret; |
| 144 | } |
| 145 | |
| 146 | static int tda10071_set_voltage(struct dvb_frontend *fe, |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 147 | enum fe_sec_voltage fe_sec_voltage) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 148 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 149 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 150 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 151 | struct tda10071_cmd cmd; |
| 152 | int ret; |
| 153 | u8 voltage; |
| 154 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 155 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 156 | ret = -EFAULT; |
| 157 | goto error; |
| 158 | } |
| 159 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 160 | dev_dbg(&client->dev, "voltage=%d\n", fe_sec_voltage); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 161 | |
| 162 | switch (fe_sec_voltage) { |
| 163 | case SEC_VOLTAGE_13: |
| 164 | voltage = 0; |
| 165 | break; |
| 166 | case SEC_VOLTAGE_18: |
| 167 | voltage = 1; |
| 168 | break; |
| 169 | case SEC_VOLTAGE_OFF: |
| 170 | voltage = 0; |
| 171 | break; |
| 172 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 173 | dev_dbg(&client->dev, "invalid fe_sec_voltage\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 174 | ret = -EINVAL; |
| 175 | goto error; |
Peter Senna Tschudin | 8f5c997 | 2012-09-07 11:24:43 -0300 | [diff] [blame] | 176 | } |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 177 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 178 | cmd.args[0] = CMD_LNB_SET_DC_LEVEL; |
| 179 | cmd.args[1] = 0; |
| 180 | cmd.args[2] = voltage; |
| 181 | cmd.len = 3; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 182 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 183 | if (ret) |
| 184 | goto error; |
| 185 | |
| 186 | return ret; |
| 187 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 188 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 189 | return ret; |
| 190 | } |
| 191 | |
| 192 | static int tda10071_diseqc_send_master_cmd(struct dvb_frontend *fe, |
| 193 | struct dvb_diseqc_master_cmd *diseqc_cmd) |
| 194 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 195 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 196 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 197 | struct tda10071_cmd cmd; |
| 198 | int ret, i; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 199 | unsigned int uitmp; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 200 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 201 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 202 | ret = -EFAULT; |
| 203 | goto error; |
| 204 | } |
| 205 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 206 | dev_dbg(&client->dev, "msg_len=%d\n", diseqc_cmd->msg_len); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 207 | |
Antti Palosaari | 84431c2 | 2012-07-01 15:29:15 -0300 | [diff] [blame] | 208 | if (diseqc_cmd->msg_len < 3 || diseqc_cmd->msg_len > 6) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 209 | ret = -EINVAL; |
| 210 | goto error; |
| 211 | } |
| 212 | |
| 213 | /* wait LNB TX */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 214 | for (i = 500, uitmp = 0; i && !uitmp; i--) { |
| 215 | ret = regmap_read(dev->regmap, 0x47, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 216 | if (ret) |
| 217 | goto error; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 218 | uitmp = (uitmp >> 0) & 1; |
Antti Palosaari | d102b73 | 2011-09-13 11:51:23 -0300 | [diff] [blame] | 219 | usleep_range(10000, 20000); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 220 | } |
| 221 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 222 | dev_dbg(&client->dev, "loop=%d\n", i); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 223 | |
| 224 | if (i == 0) { |
| 225 | ret = -ETIMEDOUT; |
| 226 | goto error; |
| 227 | } |
| 228 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 229 | ret = regmap_update_bits(dev->regmap, 0x47, 0x01, 0x00); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 230 | if (ret) |
| 231 | goto error; |
| 232 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 233 | cmd.args[0] = CMD_LNB_SEND_DISEQC; |
| 234 | cmd.args[1] = 0; |
| 235 | cmd.args[2] = 0; |
| 236 | cmd.args[3] = 0; |
| 237 | cmd.args[4] = 2; |
| 238 | cmd.args[5] = 0; |
| 239 | cmd.args[6] = diseqc_cmd->msg_len; |
| 240 | memcpy(&cmd.args[7], diseqc_cmd->msg, diseqc_cmd->msg_len); |
| 241 | cmd.len = 7 + diseqc_cmd->msg_len; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 242 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 243 | if (ret) |
| 244 | goto error; |
| 245 | |
| 246 | return ret; |
| 247 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 248 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 249 | return ret; |
| 250 | } |
| 251 | |
| 252 | static int tda10071_diseqc_recv_slave_reply(struct dvb_frontend *fe, |
| 253 | struct dvb_diseqc_slave_reply *reply) |
| 254 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 255 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 256 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 257 | struct tda10071_cmd cmd; |
| 258 | int ret, i; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 259 | unsigned int uitmp; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 260 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 261 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 262 | ret = -EFAULT; |
| 263 | goto error; |
| 264 | } |
| 265 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 266 | dev_dbg(&client->dev, "\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 267 | |
| 268 | /* wait LNB RX */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 269 | for (i = 500, uitmp = 0; i && !uitmp; i--) { |
| 270 | ret = regmap_read(dev->regmap, 0x47, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 271 | if (ret) |
| 272 | goto error; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 273 | uitmp = (uitmp >> 1) & 1; |
Antti Palosaari | d102b73 | 2011-09-13 11:51:23 -0300 | [diff] [blame] | 274 | usleep_range(10000, 20000); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 275 | } |
| 276 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 277 | dev_dbg(&client->dev, "loop=%d\n", i); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 278 | |
| 279 | if (i == 0) { |
| 280 | ret = -ETIMEDOUT; |
| 281 | goto error; |
| 282 | } |
| 283 | |
| 284 | /* reply len */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 285 | ret = regmap_read(dev->regmap, 0x46, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 286 | if (ret) |
| 287 | goto error; |
| 288 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 289 | reply->msg_len = uitmp & 0x1f; /* [4:0] */ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 290 | if (reply->msg_len > sizeof(reply->msg)) |
| 291 | reply->msg_len = sizeof(reply->msg); /* truncate API max */ |
| 292 | |
| 293 | /* read reply */ |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 294 | cmd.args[0] = CMD_LNB_UPDATE_REPLY; |
| 295 | cmd.args[1] = 0; |
| 296 | cmd.len = 2; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 297 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 298 | if (ret) |
| 299 | goto error; |
| 300 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 301 | ret = regmap_bulk_read(dev->regmap, cmd.len, reply->msg, |
| 302 | reply->msg_len); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 303 | if (ret) |
| 304 | goto error; |
| 305 | |
| 306 | return ret; |
| 307 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 308 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 309 | return ret; |
| 310 | } |
| 311 | |
| 312 | static int tda10071_diseqc_send_burst(struct dvb_frontend *fe, |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 313 | enum fe_sec_mini_cmd fe_sec_mini_cmd) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 314 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 315 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 316 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 317 | struct tda10071_cmd cmd; |
| 318 | int ret, i; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 319 | unsigned int uitmp; |
| 320 | u8 burst; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 321 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 322 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 323 | ret = -EFAULT; |
| 324 | goto error; |
| 325 | } |
| 326 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 327 | dev_dbg(&client->dev, "fe_sec_mini_cmd=%d\n", fe_sec_mini_cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 328 | |
| 329 | switch (fe_sec_mini_cmd) { |
| 330 | case SEC_MINI_A: |
| 331 | burst = 0; |
| 332 | break; |
| 333 | case SEC_MINI_B: |
| 334 | burst = 1; |
| 335 | break; |
| 336 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 337 | dev_dbg(&client->dev, "invalid fe_sec_mini_cmd\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 338 | ret = -EINVAL; |
| 339 | goto error; |
| 340 | } |
| 341 | |
| 342 | /* wait LNB TX */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 343 | for (i = 500, uitmp = 0; i && !uitmp; i--) { |
| 344 | ret = regmap_read(dev->regmap, 0x47, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 345 | if (ret) |
| 346 | goto error; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 347 | uitmp = (uitmp >> 0) & 1; |
Antti Palosaari | d102b73 | 2011-09-13 11:51:23 -0300 | [diff] [blame] | 348 | usleep_range(10000, 20000); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 349 | } |
| 350 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 351 | dev_dbg(&client->dev, "loop=%d\n", i); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 352 | |
| 353 | if (i == 0) { |
| 354 | ret = -ETIMEDOUT; |
| 355 | goto error; |
| 356 | } |
| 357 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 358 | ret = regmap_update_bits(dev->regmap, 0x47, 0x01, 0x00); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 359 | if (ret) |
| 360 | goto error; |
| 361 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 362 | cmd.args[0] = CMD_LNB_SEND_TONEBURST; |
| 363 | cmd.args[1] = 0; |
| 364 | cmd.args[2] = burst; |
| 365 | cmd.len = 3; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 366 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 367 | if (ret) |
| 368 | goto error; |
| 369 | |
| 370 | return ret; |
| 371 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 372 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 373 | return ret; |
| 374 | } |
| 375 | |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 376 | static int tda10071_read_status(struct dvb_frontend *fe, enum fe_status *status) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 377 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 378 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 379 | struct i2c_client *client = dev->client; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 380 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
| 381 | struct tda10071_cmd cmd; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 382 | int ret; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 383 | unsigned int uitmp; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 384 | u8 buf[8]; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 385 | |
| 386 | *status = 0; |
| 387 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 388 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 389 | ret = 0; |
| 390 | goto error; |
| 391 | } |
| 392 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 393 | ret = regmap_read(dev->regmap, 0x39, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 394 | if (ret) |
| 395 | goto error; |
| 396 | |
Antti Palosaari | 0711560 | 2014-02-11 00:17:37 -0300 | [diff] [blame] | 397 | /* 0x39[0] tuner PLL */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 398 | if (uitmp & 0x02) /* demod PLL */ |
Antti Palosaari | 0711560 | 2014-02-11 00:17:37 -0300 | [diff] [blame] | 399 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 400 | if (uitmp & 0x04) /* viterbi or LDPC*/ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 401 | *status |= FE_HAS_VITERBI; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 402 | if (uitmp & 0x08) /* RS or BCH */ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 403 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; |
| 404 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 405 | dev->fe_status = *status; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 406 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 407 | /* signal strength */ |
| 408 | if (dev->fe_status & FE_HAS_SIGNAL) { |
| 409 | cmd.args[0] = CMD_GET_AGCACC; |
| 410 | cmd.args[1] = 0; |
| 411 | cmd.len = 2; |
| 412 | ret = tda10071_cmd_execute(dev, &cmd); |
| 413 | if (ret) |
| 414 | goto error; |
| 415 | |
| 416 | /* input power estimate dBm */ |
| 417 | ret = regmap_read(dev->regmap, 0x50, &uitmp); |
| 418 | if (ret) |
| 419 | goto error; |
| 420 | |
| 421 | c->strength.stat[0].scale = FE_SCALE_DECIBEL; |
| 422 | c->strength.stat[0].svalue = (int) (uitmp - 256) * 1000; |
| 423 | } else { |
| 424 | c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 425 | } |
| 426 | |
| 427 | /* CNR */ |
| 428 | if (dev->fe_status & FE_HAS_VITERBI) { |
| 429 | /* Es/No */ |
| 430 | ret = regmap_bulk_read(dev->regmap, 0x3a, buf, 2); |
| 431 | if (ret) |
| 432 | goto error; |
| 433 | |
| 434 | c->cnr.stat[0].scale = FE_SCALE_DECIBEL; |
| 435 | c->cnr.stat[0].svalue = (buf[0] << 8 | buf[1] << 0) * 100; |
| 436 | } else { |
| 437 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 438 | } |
| 439 | |
| 440 | /* UCB/PER/BER */ |
| 441 | if (dev->fe_status & FE_HAS_LOCK) { |
| 442 | /* TODO: report total bits/packets */ |
| 443 | u8 delivery_system, reg, len; |
| 444 | |
| 445 | switch (dev->delivery_system) { |
| 446 | case SYS_DVBS: |
| 447 | reg = 0x4c; |
| 448 | len = 8; |
| 449 | delivery_system = 1; |
| 450 | break; |
| 451 | case SYS_DVBS2: |
| 452 | reg = 0x4d; |
| 453 | len = 4; |
| 454 | delivery_system = 0; |
| 455 | break; |
| 456 | default: |
| 457 | ret = -EINVAL; |
| 458 | goto error; |
| 459 | } |
| 460 | |
| 461 | ret = regmap_read(dev->regmap, reg, &uitmp); |
| 462 | if (ret) |
| 463 | goto error; |
| 464 | |
| 465 | if (dev->meas_count == uitmp) { |
| 466 | dev_dbg(&client->dev, "meas not ready=%02x\n", uitmp); |
| 467 | ret = 0; |
| 468 | goto error; |
| 469 | } else { |
| 470 | dev->meas_count = uitmp; |
| 471 | } |
| 472 | |
| 473 | cmd.args[0] = CMD_BER_UPDATE_COUNTERS; |
| 474 | cmd.args[1] = 0; |
| 475 | cmd.args[2] = delivery_system; |
| 476 | cmd.len = 3; |
| 477 | ret = tda10071_cmd_execute(dev, &cmd); |
| 478 | if (ret) |
| 479 | goto error; |
| 480 | |
| 481 | ret = regmap_bulk_read(dev->regmap, cmd.len, buf, len); |
| 482 | if (ret) |
| 483 | goto error; |
| 484 | |
| 485 | if (dev->delivery_system == SYS_DVBS) { |
| 486 | dev->dvbv3_ber = buf[0] << 24 | buf[1] << 16 | |
| 487 | buf[2] << 8 | buf[3] << 0; |
| 488 | dev->post_bit_error += buf[0] << 24 | buf[1] << 16 | |
| 489 | buf[2] << 8 | buf[3] << 0; |
| 490 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; |
| 491 | c->post_bit_error.stat[0].uvalue = dev->post_bit_error; |
| 492 | dev->block_error += buf[4] << 8 | buf[5] << 0; |
| 493 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; |
| 494 | c->block_error.stat[0].uvalue = dev->block_error; |
| 495 | } else { |
| 496 | dev->dvbv3_ber = buf[0] << 8 | buf[1] << 0; |
| 497 | dev->post_bit_error += buf[0] << 8 | buf[1] << 0; |
| 498 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; |
| 499 | c->post_bit_error.stat[0].uvalue = dev->post_bit_error; |
| 500 | c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 501 | } |
| 502 | } else { |
| 503 | c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 504 | c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 505 | } |
| 506 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 507 | return ret; |
| 508 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 509 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 510 | return ret; |
| 511 | } |
| 512 | |
| 513 | static int tda10071_read_snr(struct dvb_frontend *fe, u16 *snr) |
| 514 | { |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 515 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 516 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 517 | if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) |
| 518 | *snr = div_s64(c->cnr.stat[0].svalue, 100); |
| 519 | else |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 520 | *snr = 0; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 521 | return 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | static int tda10071_read_signal_strength(struct dvb_frontend *fe, u16 *strength) |
| 525 | { |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 526 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 527 | unsigned int uitmp; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 528 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 529 | if (c->strength.stat[0].scale == FE_SCALE_DECIBEL) { |
Mauro Carvalho Chehab | 7d0ddc9 | 2015-08-11 19:08:59 -0300 | [diff] [blame] | 530 | uitmp = div_s64(c->strength.stat[0].svalue, 1000) + 256; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 531 | uitmp = clamp(uitmp, 181U, 236U); /* -75dBm - -20dBm */ |
| 532 | /* scale value to 0x0000-0xffff */ |
| 533 | *strength = (uitmp-181) * 0xffff / (236-181); |
| 534 | } else { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 535 | *strength = 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 536 | } |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 537 | return 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | static int tda10071_read_ber(struct dvb_frontend *fe, u32 *ber) |
| 541 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 542 | struct tda10071_dev *dev = fe->demodulator_priv; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 543 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 544 | *ber = dev->dvbv3_ber; |
| 545 | return 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | static int tda10071_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) |
| 549 | { |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 550 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 551 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 552 | if (c->block_error.stat[0].scale == FE_SCALE_COUNTER) |
| 553 | *ucblocks = c->block_error.stat[0].uvalue; |
| 554 | else |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 555 | *ucblocks = 0; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 556 | return 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 557 | } |
| 558 | |
Mauro Carvalho Chehab | b2a29b5 | 2011-12-26 14:46:22 -0300 | [diff] [blame] | 559 | static int tda10071_set_frontend(struct dvb_frontend *fe) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 560 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 561 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 562 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 563 | struct tda10071_cmd cmd; |
| 564 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
| 565 | int ret, i; |
| 566 | u8 mode, rolloff, pilot, inversion, div; |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 567 | enum fe_modulation modulation; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 568 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 569 | dev_dbg(&client->dev, |
| 570 | "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", |
| 571 | c->delivery_system, c->modulation, c->frequency, c->symbol_rate, |
| 572 | c->inversion, c->pilot, c->rolloff); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 573 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 574 | dev->delivery_system = SYS_UNDEFINED; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 575 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 576 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 577 | ret = -EFAULT; |
| 578 | goto error; |
| 579 | } |
| 580 | |
| 581 | switch (c->inversion) { |
| 582 | case INVERSION_OFF: |
| 583 | inversion = 1; |
| 584 | break; |
| 585 | case INVERSION_ON: |
| 586 | inversion = 0; |
| 587 | break; |
| 588 | case INVERSION_AUTO: |
| 589 | /* 2 = auto; try first on then off |
| 590 | * 3 = auto; try first off then on */ |
| 591 | inversion = 3; |
| 592 | break; |
| 593 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 594 | dev_dbg(&client->dev, "invalid inversion\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 595 | ret = -EINVAL; |
| 596 | goto error; |
| 597 | } |
| 598 | |
| 599 | switch (c->delivery_system) { |
| 600 | case SYS_DVBS: |
Antti Palosaari | db4175a | 2014-07-04 05:44:39 -0300 | [diff] [blame] | 601 | modulation = QPSK; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 602 | rolloff = 0; |
| 603 | pilot = 2; |
| 604 | break; |
| 605 | case SYS_DVBS2: |
Antti Palosaari | db4175a | 2014-07-04 05:44:39 -0300 | [diff] [blame] | 606 | modulation = c->modulation; |
| 607 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 608 | switch (c->rolloff) { |
| 609 | case ROLLOFF_20: |
| 610 | rolloff = 2; |
| 611 | break; |
| 612 | case ROLLOFF_25: |
| 613 | rolloff = 1; |
| 614 | break; |
| 615 | case ROLLOFF_35: |
| 616 | rolloff = 0; |
| 617 | break; |
| 618 | case ROLLOFF_AUTO: |
| 619 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 620 | dev_dbg(&client->dev, "invalid rolloff\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 621 | ret = -EINVAL; |
| 622 | goto error; |
| 623 | } |
| 624 | |
| 625 | switch (c->pilot) { |
| 626 | case PILOT_OFF: |
| 627 | pilot = 0; |
| 628 | break; |
| 629 | case PILOT_ON: |
| 630 | pilot = 1; |
| 631 | break; |
| 632 | case PILOT_AUTO: |
| 633 | pilot = 2; |
| 634 | break; |
| 635 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 636 | dev_dbg(&client->dev, "invalid pilot\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 637 | ret = -EINVAL; |
| 638 | goto error; |
| 639 | } |
| 640 | break; |
| 641 | default: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 642 | dev_dbg(&client->dev, "invalid delivery_system\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 643 | ret = -EINVAL; |
| 644 | goto error; |
| 645 | } |
| 646 | |
| 647 | for (i = 0, mode = 0xff; i < ARRAY_SIZE(TDA10071_MODCOD); i++) { |
| 648 | if (c->delivery_system == TDA10071_MODCOD[i].delivery_system && |
Antti Palosaari | db4175a | 2014-07-04 05:44:39 -0300 | [diff] [blame] | 649 | modulation == TDA10071_MODCOD[i].modulation && |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 650 | c->fec_inner == TDA10071_MODCOD[i].fec) { |
| 651 | mode = TDA10071_MODCOD[i].val; |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 652 | dev_dbg(&client->dev, "mode found=%02x\n", mode); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 653 | break; |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | if (mode == 0xff) { |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 658 | dev_dbg(&client->dev, "invalid parameter combination\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 659 | ret = -EINVAL; |
| 660 | goto error; |
| 661 | } |
| 662 | |
| 663 | if (c->symbol_rate <= 5000000) |
| 664 | div = 14; |
| 665 | else |
| 666 | div = 4; |
| 667 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 668 | ret = regmap_write(dev->regmap, 0x81, div); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 669 | if (ret) |
| 670 | goto error; |
| 671 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 672 | ret = regmap_write(dev->regmap, 0xe3, div); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 673 | if (ret) |
| 674 | goto error; |
| 675 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 676 | cmd.args[0] = CMD_CHANGE_CHANNEL; |
| 677 | cmd.args[1] = 0; |
| 678 | cmd.args[2] = mode; |
| 679 | cmd.args[3] = (c->frequency >> 16) & 0xff; |
| 680 | cmd.args[4] = (c->frequency >> 8) & 0xff; |
| 681 | cmd.args[5] = (c->frequency >> 0) & 0xff; |
| 682 | cmd.args[6] = ((c->symbol_rate / 1000) >> 8) & 0xff; |
| 683 | cmd.args[7] = ((c->symbol_rate / 1000) >> 0) & 0xff; |
| 684 | cmd.args[8] = (tda10071_ops.info.frequency_tolerance >> 8) & 0xff; |
| 685 | cmd.args[9] = (tda10071_ops.info.frequency_tolerance >> 0) & 0xff; |
| 686 | cmd.args[10] = rolloff; |
| 687 | cmd.args[11] = inversion; |
| 688 | cmd.args[12] = pilot; |
| 689 | cmd.args[13] = 0x00; |
| 690 | cmd.args[14] = 0x00; |
| 691 | cmd.len = 15; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 692 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 693 | if (ret) |
| 694 | goto error; |
| 695 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 696 | dev->delivery_system = c->delivery_system; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 697 | |
| 698 | return ret; |
| 699 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 700 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 701 | return ret; |
| 702 | } |
| 703 | |
Mauro Carvalho Chehab | 7e3e68b | 2016-02-04 12:58:30 -0200 | [diff] [blame] | 704 | static int tda10071_get_frontend(struct dvb_frontend *fe, |
| 705 | struct dtv_frontend_properties *c) |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 706 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 707 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 708 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 709 | int ret, i; |
| 710 | u8 buf[5], tmp; |
| 711 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 712 | if (!dev->warm || !(dev->fe_status & FE_HAS_LOCK)) { |
Antti Palosaari | 4c4acb7 | 2015-04-21 11:16:44 -0300 | [diff] [blame] | 713 | ret = 0; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 714 | goto error; |
| 715 | } |
| 716 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 717 | ret = regmap_bulk_read(dev->regmap, 0x30, buf, 5); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 718 | if (ret) |
| 719 | goto error; |
| 720 | |
| 721 | tmp = buf[0] & 0x3f; |
| 722 | for (i = 0; i < ARRAY_SIZE(TDA10071_MODCOD); i++) { |
| 723 | if (tmp == TDA10071_MODCOD[i].val) { |
| 724 | c->modulation = TDA10071_MODCOD[i].modulation; |
| 725 | c->fec_inner = TDA10071_MODCOD[i].fec; |
| 726 | c->delivery_system = TDA10071_MODCOD[i].delivery_system; |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | switch ((buf[1] >> 0) & 0x01) { |
| 731 | case 0: |
Antti Palosaari | b32725e | 2014-07-07 09:52:28 -0300 | [diff] [blame] | 732 | c->inversion = INVERSION_ON; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 733 | break; |
| 734 | case 1: |
Antti Palosaari | b32725e | 2014-07-07 09:52:28 -0300 | [diff] [blame] | 735 | c->inversion = INVERSION_OFF; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 736 | break; |
| 737 | } |
| 738 | |
| 739 | switch ((buf[1] >> 7) & 0x01) { |
| 740 | case 0: |
| 741 | c->pilot = PILOT_OFF; |
| 742 | break; |
| 743 | case 1: |
| 744 | c->pilot = PILOT_ON; |
| 745 | break; |
| 746 | } |
| 747 | |
| 748 | c->frequency = (buf[2] << 16) | (buf[3] << 8) | (buf[4] << 0); |
| 749 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 750 | ret = regmap_bulk_read(dev->regmap, 0x52, buf, 3); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 751 | if (ret) |
| 752 | goto error; |
| 753 | |
Antti Palosaari | c2c1a6e | 2014-07-08 02:48:28 -0300 | [diff] [blame] | 754 | c->symbol_rate = ((buf[0] << 16) | (buf[1] << 8) | (buf[2] << 0)) * 1000; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 755 | |
| 756 | return ret; |
| 757 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 758 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 759 | return ret; |
| 760 | } |
| 761 | |
| 762 | static int tda10071_init(struct dvb_frontend *fe) |
| 763 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 764 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 765 | struct i2c_client *client = dev->client; |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 766 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 767 | struct tda10071_cmd cmd; |
Antti Palosaari | 75d404e | 2011-09-13 07:30:11 -0300 | [diff] [blame] | 768 | int ret, i, len, remaining, fw_size; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 769 | unsigned int uitmp; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 770 | const struct firmware *fw; |
Antti Palosaari | 03f4efc | 2012-09-12 11:37:29 -0300 | [diff] [blame] | 771 | u8 *fw_file = TDA10071_FIRMWARE; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 772 | u8 tmp, buf[4]; |
| 773 | struct tda10071_reg_val_mask tab[] = { |
| 774 | { 0xcd, 0x00, 0x07 }, |
| 775 | { 0x80, 0x00, 0x02 }, |
| 776 | { 0xcd, 0x00, 0xc0 }, |
| 777 | { 0xce, 0x00, 0x1b }, |
| 778 | { 0x9d, 0x00, 0x01 }, |
| 779 | { 0x9d, 0x00, 0x02 }, |
| 780 | { 0x9e, 0x00, 0x01 }, |
| 781 | { 0x87, 0x00, 0x80 }, |
| 782 | { 0xce, 0x00, 0x08 }, |
| 783 | { 0xce, 0x00, 0x10 }, |
| 784 | }; |
| 785 | struct tda10071_reg_val_mask tab2[] = { |
| 786 | { 0xf1, 0x70, 0xff }, |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 787 | { 0x88, dev->pll_multiplier, 0x3f }, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 788 | { 0x89, 0x00, 0x10 }, |
| 789 | { 0x89, 0x10, 0x10 }, |
| 790 | { 0xc0, 0x01, 0x01 }, |
| 791 | { 0xc0, 0x00, 0x01 }, |
| 792 | { 0xe0, 0xff, 0xff }, |
| 793 | { 0xe0, 0x00, 0xff }, |
| 794 | { 0x96, 0x1e, 0x7e }, |
| 795 | { 0x8b, 0x08, 0x08 }, |
| 796 | { 0x8b, 0x00, 0x08 }, |
| 797 | { 0x8f, 0x1a, 0x7e }, |
| 798 | { 0x8c, 0x68, 0xff }, |
| 799 | { 0x8d, 0x08, 0xff }, |
| 800 | { 0x8e, 0x4c, 0xff }, |
| 801 | { 0x8f, 0x01, 0x01 }, |
| 802 | { 0x8b, 0x04, 0x04 }, |
| 803 | { 0x8b, 0x00, 0x04 }, |
| 804 | { 0x87, 0x05, 0x07 }, |
| 805 | { 0x80, 0x00, 0x20 }, |
| 806 | { 0xc8, 0x01, 0xff }, |
| 807 | { 0xb4, 0x47, 0xff }, |
| 808 | { 0xb5, 0x9c, 0xff }, |
| 809 | { 0xb6, 0x7d, 0xff }, |
| 810 | { 0xba, 0x00, 0x03 }, |
| 811 | { 0xb7, 0x47, 0xff }, |
| 812 | { 0xb8, 0x9c, 0xff }, |
| 813 | { 0xb9, 0x7d, 0xff }, |
| 814 | { 0xba, 0x00, 0x0c }, |
| 815 | { 0xc8, 0x00, 0xff }, |
| 816 | { 0xcd, 0x00, 0x04 }, |
| 817 | { 0xcd, 0x00, 0x20 }, |
| 818 | { 0xe8, 0x02, 0xff }, |
| 819 | { 0xcf, 0x20, 0xff }, |
| 820 | { 0x9b, 0xd7, 0xff }, |
| 821 | { 0x9a, 0x01, 0x03 }, |
| 822 | { 0xa8, 0x05, 0x0f }, |
| 823 | { 0xa8, 0x65, 0xf0 }, |
| 824 | { 0xa6, 0xa0, 0xf0 }, |
| 825 | { 0x9d, 0x50, 0xfc }, |
| 826 | { 0x9e, 0x20, 0xe0 }, |
| 827 | { 0xa3, 0x1c, 0x7c }, |
| 828 | { 0xd5, 0x03, 0x03 }, |
| 829 | }; |
| 830 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 831 | if (dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 832 | /* warm state - wake up device from sleep */ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 833 | |
| 834 | for (i = 0; i < ARRAY_SIZE(tab); i++) { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 835 | ret = tda10071_wr_reg_mask(dev, tab[i].reg, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 836 | tab[i].val, tab[i].mask); |
| 837 | if (ret) |
| 838 | goto error; |
| 839 | } |
| 840 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 841 | cmd.args[0] = CMD_SET_SLEEP_MODE; |
| 842 | cmd.args[1] = 0; |
| 843 | cmd.args[2] = 0; |
| 844 | cmd.len = 3; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 845 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 846 | if (ret) |
| 847 | goto error; |
| 848 | } else { |
| 849 | /* cold state - try to download firmware */ |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 850 | |
| 851 | /* request the firmware, this will block and timeout */ |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 852 | ret = request_firmware(&fw, fw_file, &client->dev); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 853 | if (ret) { |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 854 | dev_err(&client->dev, |
| 855 | "did not find the firmware file. (%s) Please see linux/Documentation/dvb/ for more details on firmware-problems. (%d)\n", |
| 856 | fw_file, ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 857 | goto error; |
| 858 | } |
| 859 | |
| 860 | /* init */ |
| 861 | for (i = 0; i < ARRAY_SIZE(tab2); i++) { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 862 | ret = tda10071_wr_reg_mask(dev, tab2[i].reg, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 863 | tab2[i].val, tab2[i].mask); |
| 864 | if (ret) |
| 865 | goto error_release_firmware; |
| 866 | } |
| 867 | |
| 868 | /* download firmware */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 869 | ret = regmap_write(dev->regmap, 0xe0, 0x7f); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 870 | if (ret) |
| 871 | goto error_release_firmware; |
| 872 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 873 | ret = regmap_write(dev->regmap, 0xf7, 0x81); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 874 | if (ret) |
| 875 | goto error_release_firmware; |
| 876 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 877 | ret = regmap_write(dev->regmap, 0xf8, 0x00); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 878 | if (ret) |
| 879 | goto error_release_firmware; |
| 880 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 881 | ret = regmap_write(dev->regmap, 0xf9, 0x00); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 882 | if (ret) |
| 883 | goto error_release_firmware; |
| 884 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 885 | dev_info(&client->dev, |
| 886 | "found a '%s' in cold state, will try to load a firmware\n", |
| 887 | tda10071_ops.info.name); |
| 888 | dev_info(&client->dev, "downloading firmware from file '%s'\n", |
| 889 | fw_file); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 890 | |
Antti Palosaari | 75d404e | 2011-09-13 07:30:11 -0300 | [diff] [blame] | 891 | /* do not download last byte */ |
| 892 | fw_size = fw->size - 1; |
| 893 | |
| 894 | for (remaining = fw_size; remaining > 0; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 895 | remaining -= (dev->i2c_wr_max - 1)) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 896 | len = remaining; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 897 | if (len > (dev->i2c_wr_max - 1)) |
| 898 | len = (dev->i2c_wr_max - 1); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 899 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 900 | ret = regmap_bulk_write(dev->regmap, 0xfa, |
Antti Palosaari | 75d404e | 2011-09-13 07:30:11 -0300 | [diff] [blame] | 901 | (u8 *) &fw->data[fw_size - remaining], len); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 902 | if (ret) { |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 903 | dev_err(&client->dev, |
| 904 | "firmware download failed=%d\n", ret); |
Dan Carpenter | a3a528b | 2014-01-30 09:00:34 -0300 | [diff] [blame] | 905 | goto error_release_firmware; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 906 | } |
| 907 | } |
| 908 | release_firmware(fw); |
| 909 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 910 | ret = regmap_write(dev->regmap, 0xf7, 0x0c); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 911 | if (ret) |
| 912 | goto error; |
| 913 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 914 | ret = regmap_write(dev->regmap, 0xe0, 0x00); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 915 | if (ret) |
| 916 | goto error; |
| 917 | |
| 918 | /* wait firmware start */ |
| 919 | msleep(250); |
| 920 | |
| 921 | /* firmware status */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 922 | ret = regmap_read(dev->regmap, 0x51, &uitmp); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 923 | if (ret) |
| 924 | goto error; |
| 925 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 926 | if (uitmp) { |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 927 | dev_info(&client->dev, "firmware did not run\n"); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 928 | ret = -EFAULT; |
| 929 | goto error; |
| 930 | } else { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 931 | dev->warm = true; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 932 | } |
| 933 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 934 | cmd.args[0] = CMD_GET_FW_VERSION; |
| 935 | cmd.len = 1; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 936 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 937 | if (ret) |
| 938 | goto error; |
| 939 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 940 | ret = regmap_bulk_read(dev->regmap, cmd.len, buf, 4); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 941 | if (ret) |
| 942 | goto error; |
| 943 | |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 944 | dev_info(&client->dev, "firmware version %d.%d.%d.%d\n", |
| 945 | buf[0], buf[1], buf[2], buf[3]); |
| 946 | dev_info(&client->dev, "found a '%s' in warm state\n", |
| 947 | tda10071_ops.info.name); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 948 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 949 | ret = regmap_bulk_read(dev->regmap, 0x81, buf, 2); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 950 | if (ret) |
| 951 | goto error; |
| 952 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 953 | cmd.args[0] = CMD_DEMOD_INIT; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 954 | cmd.args[1] = ((dev->clk / 1000) >> 8) & 0xff; |
| 955 | cmd.args[2] = ((dev->clk / 1000) >> 0) & 0xff; |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 956 | cmd.args[3] = buf[0]; |
| 957 | cmd.args[4] = buf[1]; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 958 | cmd.args[5] = dev->pll_multiplier; |
| 959 | cmd.args[6] = dev->spec_inv; |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 960 | cmd.args[7] = 0x00; |
| 961 | cmd.len = 8; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 962 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 963 | if (ret) |
| 964 | goto error; |
| 965 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 966 | if (dev->tuner_i2c_addr) |
| 967 | tmp = dev->tuner_i2c_addr; |
Antti Palosaari | 116802f | 2014-02-11 15:13:46 -0300 | [diff] [blame] | 968 | else |
| 969 | tmp = 0x14; |
| 970 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 971 | cmd.args[0] = CMD_TUNER_INIT; |
| 972 | cmd.args[1] = 0x00; |
| 973 | cmd.args[2] = 0x00; |
| 974 | cmd.args[3] = 0x00; |
| 975 | cmd.args[4] = 0x00; |
Antti Palosaari | 116802f | 2014-02-11 15:13:46 -0300 | [diff] [blame] | 976 | cmd.args[5] = tmp; |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 977 | cmd.args[6] = 0x00; |
| 978 | cmd.args[7] = 0x03; |
| 979 | cmd.args[8] = 0x02; |
| 980 | cmd.args[9] = 0x02; |
| 981 | cmd.args[10] = 0x00; |
| 982 | cmd.args[11] = 0x00; |
| 983 | cmd.args[12] = 0x00; |
| 984 | cmd.args[13] = 0x00; |
| 985 | cmd.args[14] = 0x00; |
| 986 | cmd.len = 15; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 987 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 988 | if (ret) |
| 989 | goto error; |
| 990 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 991 | cmd.args[0] = CMD_MPEG_CONFIG; |
| 992 | cmd.args[1] = 0; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 993 | cmd.args[2] = dev->ts_mode; |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 994 | cmd.args[3] = 0x00; |
| 995 | cmd.args[4] = 0x04; |
| 996 | cmd.args[5] = 0x00; |
| 997 | cmd.len = 6; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 998 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 999 | if (ret) |
| 1000 | goto error; |
| 1001 | |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1002 | ret = regmap_update_bits(dev->regmap, 0xf0, 0x01, 0x01); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1003 | if (ret) |
| 1004 | goto error; |
| 1005 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 1006 | cmd.args[0] = CMD_LNB_CONFIG; |
| 1007 | cmd.args[1] = 0; |
| 1008 | cmd.args[2] = 150; |
| 1009 | cmd.args[3] = 3; |
| 1010 | cmd.args[4] = 22; |
| 1011 | cmd.args[5] = 1; |
| 1012 | cmd.args[6] = 1; |
| 1013 | cmd.args[7] = 30; |
| 1014 | cmd.args[8] = 30; |
| 1015 | cmd.args[9] = 30; |
| 1016 | cmd.args[10] = 30; |
| 1017 | cmd.len = 11; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1018 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1019 | if (ret) |
| 1020 | goto error; |
| 1021 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 1022 | cmd.args[0] = CMD_BER_CONTROL; |
| 1023 | cmd.args[1] = 0; |
| 1024 | cmd.args[2] = 14; |
| 1025 | cmd.args[3] = 14; |
| 1026 | cmd.len = 4; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1027 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1028 | if (ret) |
| 1029 | goto error; |
| 1030 | } |
| 1031 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 1032 | /* init stats here in order signal app which stats are supported */ |
| 1033 | c->strength.len = 1; |
| 1034 | c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 1035 | c->cnr.len = 1; |
| 1036 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 1037 | c->post_bit_error.len = 1; |
| 1038 | c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 1039 | c->block_error.len = 1; |
| 1040 | c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
| 1041 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1042 | return ret; |
| 1043 | error_release_firmware: |
| 1044 | release_firmware(fw); |
| 1045 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 1046 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1047 | return ret; |
| 1048 | } |
| 1049 | |
| 1050 | static int tda10071_sleep(struct dvb_frontend *fe) |
| 1051 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1052 | struct tda10071_dev *dev = fe->demodulator_priv; |
| 1053 | struct i2c_client *client = dev->client; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1054 | struct tda10071_cmd cmd; |
| 1055 | int ret, i; |
| 1056 | struct tda10071_reg_val_mask tab[] = { |
| 1057 | { 0xcd, 0x07, 0x07 }, |
| 1058 | { 0x80, 0x02, 0x02 }, |
| 1059 | { 0xcd, 0xc0, 0xc0 }, |
| 1060 | { 0xce, 0x1b, 0x1b }, |
| 1061 | { 0x9d, 0x01, 0x01 }, |
| 1062 | { 0x9d, 0x02, 0x02 }, |
| 1063 | { 0x9e, 0x01, 0x01 }, |
| 1064 | { 0x87, 0x80, 0x80 }, |
| 1065 | { 0xce, 0x08, 0x08 }, |
| 1066 | { 0xce, 0x10, 0x10 }, |
| 1067 | }; |
| 1068 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1069 | if (!dev->warm) { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1070 | ret = -EFAULT; |
| 1071 | goto error; |
| 1072 | } |
| 1073 | |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 1074 | cmd.args[0] = CMD_SET_SLEEP_MODE; |
| 1075 | cmd.args[1] = 0; |
| 1076 | cmd.args[2] = 1; |
| 1077 | cmd.len = 3; |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1078 | ret = tda10071_cmd_execute(dev, &cmd); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1079 | if (ret) |
| 1080 | goto error; |
| 1081 | |
| 1082 | for (i = 0; i < ARRAY_SIZE(tab); i++) { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1083 | ret = tda10071_wr_reg_mask(dev, tab[i].reg, tab[i].val, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1084 | tab[i].mask); |
| 1085 | if (ret) |
| 1086 | goto error; |
| 1087 | } |
| 1088 | |
| 1089 | return ret; |
| 1090 | error: |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 1091 | dev_dbg(&client->dev, "failed=%d\n", ret); |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1092 | return ret; |
| 1093 | } |
| 1094 | |
| 1095 | static int tda10071_get_tune_settings(struct dvb_frontend *fe, |
| 1096 | struct dvb_frontend_tune_settings *s) |
| 1097 | { |
| 1098 | s->min_delay_ms = 8000; |
| 1099 | s->step_size = 0; |
| 1100 | s->max_drift = 0; |
| 1101 | |
| 1102 | return 0; |
| 1103 | } |
| 1104 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1105 | static struct dvb_frontend_ops tda10071_ops = { |
Antti Palosaari | 2b49fad | 2012-03-12 18:21:20 -0300 | [diff] [blame] | 1106 | .delsys = { SYS_DVBS, SYS_DVBS2 }, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1107 | .info = { |
| 1108 | .name = "NXP TDA10071", |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1109 | .frequency_min = 950000, |
| 1110 | .frequency_max = 2150000, |
| 1111 | .frequency_tolerance = 5000, |
| 1112 | .symbol_rate_min = 1000000, |
| 1113 | .symbol_rate_max = 45000000, |
| 1114 | .caps = FE_CAN_INVERSION_AUTO | |
| 1115 | FE_CAN_FEC_1_2 | |
| 1116 | FE_CAN_FEC_2_3 | |
| 1117 | FE_CAN_FEC_3_4 | |
| 1118 | FE_CAN_FEC_4_5 | |
| 1119 | FE_CAN_FEC_5_6 | |
| 1120 | FE_CAN_FEC_6_7 | |
| 1121 | FE_CAN_FEC_7_8 | |
| 1122 | FE_CAN_FEC_8_9 | |
| 1123 | FE_CAN_FEC_AUTO | |
| 1124 | FE_CAN_QPSK | |
| 1125 | FE_CAN_RECOVER | |
| 1126 | FE_CAN_2G_MODULATION |
| 1127 | }, |
| 1128 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1129 | .get_tune_settings = tda10071_get_tune_settings, |
| 1130 | |
| 1131 | .init = tda10071_init, |
| 1132 | .sleep = tda10071_sleep, |
| 1133 | |
Mauro Carvalho Chehab | b2a29b5 | 2011-12-26 14:46:22 -0300 | [diff] [blame] | 1134 | .set_frontend = tda10071_set_frontend, |
| 1135 | .get_frontend = tda10071_get_frontend, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1136 | |
| 1137 | .read_status = tda10071_read_status, |
| 1138 | .read_snr = tda10071_read_snr, |
| 1139 | .read_signal_strength = tda10071_read_signal_strength, |
| 1140 | .read_ber = tda10071_read_ber, |
| 1141 | .read_ucblocks = tda10071_read_ucblocks, |
| 1142 | |
| 1143 | .diseqc_send_master_cmd = tda10071_diseqc_send_master_cmd, |
| 1144 | .diseqc_recv_slave_reply = tda10071_diseqc_recv_slave_reply, |
| 1145 | .diseqc_send_burst = tda10071_diseqc_send_burst, |
| 1146 | |
| 1147 | .set_tone = tda10071_set_tone, |
| 1148 | .set_voltage = tda10071_set_voltage, |
| 1149 | }; |
| 1150 | |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1151 | static struct dvb_frontend *tda10071_get_dvb_frontend(struct i2c_client *client) |
| 1152 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1153 | struct tda10071_dev *dev = i2c_get_clientdata(client); |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1154 | |
| 1155 | dev_dbg(&client->dev, "\n"); |
| 1156 | |
| 1157 | return &dev->fe; |
| 1158 | } |
| 1159 | |
| 1160 | static int tda10071_probe(struct i2c_client *client, |
| 1161 | const struct i2c_device_id *id) |
| 1162 | { |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 1163 | struct tda10071_dev *dev; |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1164 | struct tda10071_platform_data *pdata = client->dev.platform_data; |
| 1165 | int ret; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1166 | unsigned int uitmp; |
| 1167 | static const struct regmap_config regmap_config = { |
| 1168 | .reg_bits = 8, |
| 1169 | .val_bits = 8, |
| 1170 | }; |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1171 | |
| 1172 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 1173 | if (!dev) { |
| 1174 | ret = -ENOMEM; |
| 1175 | goto err; |
| 1176 | } |
| 1177 | |
| 1178 | dev->client = client; |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 1179 | mutex_init(&dev->cmd_execute_mutex); |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 1180 | dev->clk = pdata->clk; |
| 1181 | dev->i2c_wr_max = pdata->i2c_wr_max; |
| 1182 | dev->ts_mode = pdata->ts_mode; |
| 1183 | dev->spec_inv = pdata->spec_inv; |
| 1184 | dev->pll_multiplier = pdata->pll_multiplier; |
| 1185 | dev->tuner_i2c_addr = pdata->tuner_i2c_addr; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1186 | dev->regmap = devm_regmap_init_i2c(client, ®map_config); |
| 1187 | if (IS_ERR(dev->regmap)) { |
| 1188 | ret = PTR_ERR(dev->regmap); |
| 1189 | goto err_kfree; |
| 1190 | } |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1191 | |
| 1192 | /* chip ID */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1193 | ret = regmap_read(dev->regmap, 0xff, &uitmp); |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1194 | if (ret) |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1195 | goto err_kfree; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1196 | if (uitmp != 0x0f) { |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1197 | ret = -ENODEV; |
| 1198 | goto err_kfree; |
| 1199 | } |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1200 | |
| 1201 | /* chip type */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1202 | ret = regmap_read(dev->regmap, 0xdd, &uitmp); |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1203 | if (ret) |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1204 | goto err_kfree; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1205 | if (uitmp != 0x00) { |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1206 | ret = -ENODEV; |
| 1207 | goto err_kfree; |
| 1208 | } |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1209 | |
| 1210 | /* chip version */ |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1211 | ret = regmap_read(dev->regmap, 0xfe, &uitmp); |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1212 | if (ret) |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1213 | goto err_kfree; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 1214 | if (uitmp != 0x01) { |
Antti Palosaari | ab80b19 | 2015-06-06 08:11:16 -0300 | [diff] [blame] | 1215 | ret = -ENODEV; |
| 1216 | goto err_kfree; |
| 1217 | } |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1218 | |
| 1219 | /* create dvb_frontend */ |
| 1220 | memcpy(&dev->fe.ops, &tda10071_ops, sizeof(struct dvb_frontend_ops)); |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1221 | dev->fe.demodulator_priv = dev; |
| 1222 | i2c_set_clientdata(client, dev); |
| 1223 | |
| 1224 | /* setup callbacks */ |
| 1225 | pdata->get_dvb_frontend = tda10071_get_dvb_frontend; |
| 1226 | |
| 1227 | dev_info(&client->dev, "NXP TDA10071 successfully identified\n"); |
| 1228 | return 0; |
| 1229 | err_kfree: |
| 1230 | kfree(dev); |
| 1231 | err: |
| 1232 | dev_dbg(&client->dev, "failed=%d\n", ret); |
| 1233 | return ret; |
| 1234 | } |
| 1235 | |
| 1236 | static int tda10071_remove(struct i2c_client *client) |
| 1237 | { |
| 1238 | struct tda10071_dev *dev = i2c_get_clientdata(client); |
| 1239 | |
| 1240 | dev_dbg(&client->dev, "\n"); |
| 1241 | |
| 1242 | kfree(dev); |
| 1243 | return 0; |
| 1244 | } |
| 1245 | |
| 1246 | static const struct i2c_device_id tda10071_id_table[] = { |
| 1247 | {"tda10071_cx24118", 0}, |
| 1248 | {} |
| 1249 | }; |
| 1250 | MODULE_DEVICE_TABLE(i2c, tda10071_id_table); |
| 1251 | |
| 1252 | static struct i2c_driver tda10071_driver = { |
| 1253 | .driver = { |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 1254 | .name = "tda10071", |
| 1255 | .suppress_bind_attrs = true, |
| 1256 | }, |
| 1257 | .probe = tda10071_probe, |
| 1258 | .remove = tda10071_remove, |
| 1259 | .id_table = tda10071_id_table, |
| 1260 | }; |
| 1261 | |
| 1262 | module_i2c_driver(tda10071_driver); |
| 1263 | |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 1264 | MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); |
| 1265 | MODULE_DESCRIPTION("NXP TDA10071 DVB-S/S2 demodulator driver"); |
| 1266 | MODULE_LICENSE("GPL"); |
Antti Palosaari | 03f4efc | 2012-09-12 11:37:29 -0300 | [diff] [blame] | 1267 | MODULE_FIRMWARE(TDA10071_FIRMWARE); |