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 | #ifndef TDA10071_PRIV |
| 22 | #define TDA10071_PRIV |
| 23 | |
| 24 | #include "dvb_frontend.h" |
| 25 | #include "tda10071.h" |
| 26 | #include <linux/firmware.h> |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 27 | #include <linux/regmap.h> |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 28 | |
Antti Palosaari | fca3e00 | 2015-04-20 20:04:00 -0300 | [diff] [blame] | 29 | struct tda10071_dev { |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 30 | struct dvb_frontend fe; |
Antti Palosaari | d69abb7 | 2015-04-16 11:46:24 -0300 | [diff] [blame] | 31 | struct i2c_client *client; |
Antti Palosaari | 54ab48e | 2015-04-20 22:21:44 -0300 | [diff] [blame] | 32 | struct regmap *regmap; |
Antti Palosaari | e14432a | 2015-04-21 09:58:15 -0300 | [diff] [blame] | 33 | struct mutex cmd_execute_mutex; |
Antti Palosaari | 59ca2ce | 2015-04-20 19:54:56 -0300 | [diff] [blame] | 34 | u32 clk; |
| 35 | u16 i2c_wr_max; |
| 36 | u8 ts_mode; |
| 37 | bool spec_inv; |
| 38 | u8 pll_multiplier; |
| 39 | u8 tuner_i2c_addr; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 40 | |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 41 | u8 meas_count; |
| 42 | u32 dvbv3_ber; |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 43 | enum fe_status fe_status; |
| 44 | enum fe_delivery_system delivery_system; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 45 | bool warm; /* FW running */ |
Antti Palosaari | 267897a | 2015-04-21 11:14:44 -0300 | [diff] [blame] | 46 | u64 post_bit_error; |
| 47 | u64 block_error; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | static struct tda10071_modcod { |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame] | 51 | enum fe_delivery_system delivery_system; |
| 52 | enum fe_modulation modulation; |
| 53 | enum fe_code_rate fec; |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 54 | u8 val; |
| 55 | } TDA10071_MODCOD[] = { |
| 56 | /* NBC-QPSK */ |
| 57 | { SYS_DVBS2, QPSK, FEC_AUTO, 0x00 }, |
| 58 | { SYS_DVBS2, QPSK, FEC_1_2, 0x04 }, |
| 59 | { SYS_DVBS2, QPSK, FEC_3_5, 0x05 }, |
| 60 | { SYS_DVBS2, QPSK, FEC_2_3, 0x06 }, |
| 61 | { SYS_DVBS2, QPSK, FEC_3_4, 0x07 }, |
| 62 | { SYS_DVBS2, QPSK, FEC_4_5, 0x08 }, |
| 63 | { SYS_DVBS2, QPSK, FEC_5_6, 0x09 }, |
| 64 | { SYS_DVBS2, QPSK, FEC_8_9, 0x0a }, |
| 65 | { SYS_DVBS2, QPSK, FEC_9_10, 0x0b }, |
| 66 | /* 8PSK */ |
Antti Palosaari | bc760cd | 2014-07-07 09:05:15 -0300 | [diff] [blame] | 67 | { SYS_DVBS2, PSK_8, FEC_AUTO, 0x00 }, |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 68 | { SYS_DVBS2, PSK_8, FEC_3_5, 0x0c }, |
| 69 | { SYS_DVBS2, PSK_8, FEC_2_3, 0x0d }, |
| 70 | { SYS_DVBS2, PSK_8, FEC_3_4, 0x0e }, |
| 71 | { SYS_DVBS2, PSK_8, FEC_5_6, 0x0f }, |
| 72 | { SYS_DVBS2, PSK_8, FEC_8_9, 0x10 }, |
| 73 | { SYS_DVBS2, PSK_8, FEC_9_10, 0x11 }, |
| 74 | /* QPSK */ |
| 75 | { SYS_DVBS, QPSK, FEC_AUTO, 0x2d }, |
| 76 | { SYS_DVBS, QPSK, FEC_1_2, 0x2e }, |
| 77 | { SYS_DVBS, QPSK, FEC_2_3, 0x2f }, |
| 78 | { SYS_DVBS, QPSK, FEC_3_4, 0x30 }, |
| 79 | { SYS_DVBS, QPSK, FEC_5_6, 0x31 }, |
| 80 | { SYS_DVBS, QPSK, FEC_7_8, 0x32 }, |
| 81 | }; |
| 82 | |
| 83 | struct tda10071_reg_val_mask { |
| 84 | u8 reg; |
| 85 | u8 val; |
| 86 | u8 mask; |
| 87 | }; |
| 88 | |
| 89 | /* firmware filename */ |
Antti Palosaari | 03f4efc | 2012-09-12 11:37:29 -0300 | [diff] [blame] | 90 | #define TDA10071_FIRMWARE "dvb-fe-tda10071.fw" |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 91 | |
| 92 | /* firmware commands */ |
| 93 | #define CMD_DEMOD_INIT 0x10 |
| 94 | #define CMD_CHANGE_CHANNEL 0x11 |
| 95 | #define CMD_MPEG_CONFIG 0x13 |
| 96 | #define CMD_TUNER_INIT 0x15 |
| 97 | #define CMD_GET_AGCACC 0x1a |
| 98 | |
| 99 | #define CMD_LNB_CONFIG 0x20 |
| 100 | #define CMD_LNB_SEND_DISEQC 0x21 |
| 101 | #define CMD_LNB_SET_DC_LEVEL 0x22 |
| 102 | #define CMD_LNB_PCB_CONFIG 0x23 |
| 103 | #define CMD_LNB_SEND_TONEBURST 0x24 |
| 104 | #define CMD_LNB_UPDATE_REPLY 0x25 |
| 105 | |
| 106 | #define CMD_GET_FW_VERSION 0x35 |
| 107 | #define CMD_SET_SLEEP_MODE 0x36 |
| 108 | #define CMD_BER_CONTROL 0x3e |
| 109 | #define CMD_BER_UPDATE_COUNTERS 0x3f |
| 110 | |
Yannick Guerrini | a87a4d3 | 2015-02-26 07:13:06 -0300 | [diff] [blame] | 111 | /* firmware command struct */ |
Antti Palosaari | 21c8ba3 | 2012-07-01 15:59:13 -0300 | [diff] [blame] | 112 | #define TDA10071_ARGLEN 30 |
Antti Palosaari | de8e420 | 2011-08-01 01:07:39 -0300 | [diff] [blame] | 113 | struct tda10071_cmd { |
| 114 | u8 args[TDA10071_ARGLEN]; |
| 115 | u8 len; |
| 116 | }; |
| 117 | |
| 118 | |
| 119 | #endif /* TDA10071_PRIV */ |