Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
0004  *
0005  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
0006  */
0007 
0008 #ifndef TDA10071_PRIV
0009 #define TDA10071_PRIV
0010 
0011 #include <media/dvb_frontend.h>
0012 #include "tda10071.h"
0013 #include <linux/firmware.h>
0014 #include <linux/regmap.h>
0015 
0016 struct tda10071_dev {
0017     struct dvb_frontend fe;
0018     struct i2c_client *client;
0019     struct regmap *regmap;
0020     struct mutex cmd_execute_mutex;
0021     u32 clk;
0022     u16 i2c_wr_max;
0023     u8 ts_mode;
0024     bool spec_inv;
0025     u8 pll_multiplier;
0026     u8 tuner_i2c_addr;
0027 
0028     u8 meas_count;
0029     u32 dvbv3_ber;
0030     enum fe_status fe_status;
0031     enum fe_delivery_system delivery_system;
0032     bool warm; /* FW running */
0033     u64 post_bit_error;
0034     u64 block_error;
0035 };
0036 
0037 static struct tda10071_modcod {
0038     enum fe_delivery_system delivery_system;
0039     enum fe_modulation modulation;
0040     enum fe_code_rate fec;
0041     u8 val;
0042 } TDA10071_MODCOD[] = {
0043     /* NBC-QPSK */
0044     { SYS_DVBS2, QPSK,  FEC_AUTO, 0x00 },
0045     { SYS_DVBS2, QPSK,  FEC_1_2,  0x04 },
0046     { SYS_DVBS2, QPSK,  FEC_3_5,  0x05 },
0047     { SYS_DVBS2, QPSK,  FEC_2_3,  0x06 },
0048     { SYS_DVBS2, QPSK,  FEC_3_4,  0x07 },
0049     { SYS_DVBS2, QPSK,  FEC_4_5,  0x08 },
0050     { SYS_DVBS2, QPSK,  FEC_5_6,  0x09 },
0051     { SYS_DVBS2, QPSK,  FEC_8_9,  0x0a },
0052     { SYS_DVBS2, QPSK,  FEC_9_10, 0x0b },
0053     /* 8PSK */
0054     { SYS_DVBS2, PSK_8, FEC_AUTO, 0x00 },
0055     { SYS_DVBS2, PSK_8, FEC_3_5,  0x0c },
0056     { SYS_DVBS2, PSK_8, FEC_2_3,  0x0d },
0057     { SYS_DVBS2, PSK_8, FEC_3_4,  0x0e },
0058     { SYS_DVBS2, PSK_8, FEC_5_6,  0x0f },
0059     { SYS_DVBS2, PSK_8, FEC_8_9,  0x10 },
0060     { SYS_DVBS2, PSK_8, FEC_9_10, 0x11 },
0061     /* QPSK */
0062     { SYS_DVBS,  QPSK,  FEC_AUTO, 0x2d },
0063     { SYS_DVBS,  QPSK,  FEC_1_2,  0x2e },
0064     { SYS_DVBS,  QPSK,  FEC_2_3,  0x2f },
0065     { SYS_DVBS,  QPSK,  FEC_3_4,  0x30 },
0066     { SYS_DVBS,  QPSK,  FEC_5_6,  0x31 },
0067     { SYS_DVBS,  QPSK,  FEC_7_8,  0x32 },
0068 };
0069 
0070 struct tda10071_reg_val_mask {
0071     u8 reg;
0072     u8 val;
0073     u8 mask;
0074 };
0075 
0076 /* firmware filename */
0077 #define TDA10071_FIRMWARE "dvb-fe-tda10071.fw"
0078 
0079 /* firmware commands */
0080 #define CMD_DEMOD_INIT          0x10
0081 #define CMD_CHANGE_CHANNEL      0x11
0082 #define CMD_MPEG_CONFIG         0x13
0083 #define CMD_TUNER_INIT          0x15
0084 #define CMD_GET_AGCACC          0x1a
0085 
0086 #define CMD_LNB_CONFIG          0x20
0087 #define CMD_LNB_SEND_DISEQC     0x21
0088 #define CMD_LNB_SET_DC_LEVEL    0x22
0089 #define CMD_LNB_PCB_CONFIG      0x23
0090 #define CMD_LNB_SEND_TONEBURST  0x24
0091 #define CMD_LNB_UPDATE_REPLY    0x25
0092 
0093 #define CMD_GET_FW_VERSION      0x35
0094 #define CMD_SET_SLEEP_MODE      0x36
0095 #define CMD_BER_CONTROL         0x3e
0096 #define CMD_BER_UPDATE_COUNTERS 0x3f
0097 
0098 /* firmware command struct */
0099 #define TDA10071_ARGLEN      30
0100 struct tda10071_cmd {
0101     u8 args[TDA10071_ARGLEN];
0102     u8 len;
0103 };
0104 
0105 
0106 #endif /* TDA10071_PRIV */