18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Antti Palosaari <crope@iki.fi> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef TDA10071_PRIV 98c2ecf20Sopenharmony_ci#define TDA10071_PRIV 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h> 128c2ecf20Sopenharmony_ci#include "tda10071.h" 138c2ecf20Sopenharmony_ci#include <linux/firmware.h> 148c2ecf20Sopenharmony_ci#include <linux/regmap.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistruct tda10071_dev { 178c2ecf20Sopenharmony_ci struct dvb_frontend fe; 188c2ecf20Sopenharmony_ci struct i2c_client *client; 198c2ecf20Sopenharmony_ci struct regmap *regmap; 208c2ecf20Sopenharmony_ci struct mutex cmd_execute_mutex; 218c2ecf20Sopenharmony_ci u32 clk; 228c2ecf20Sopenharmony_ci u16 i2c_wr_max; 238c2ecf20Sopenharmony_ci u8 ts_mode; 248c2ecf20Sopenharmony_ci bool spec_inv; 258c2ecf20Sopenharmony_ci u8 pll_multiplier; 268c2ecf20Sopenharmony_ci u8 tuner_i2c_addr; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci u8 meas_count; 298c2ecf20Sopenharmony_ci u32 dvbv3_ber; 308c2ecf20Sopenharmony_ci enum fe_status fe_status; 318c2ecf20Sopenharmony_ci enum fe_delivery_system delivery_system; 328c2ecf20Sopenharmony_ci bool warm; /* FW running */ 338c2ecf20Sopenharmony_ci u64 post_bit_error; 348c2ecf20Sopenharmony_ci u64 block_error; 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic struct tda10071_modcod { 388c2ecf20Sopenharmony_ci enum fe_delivery_system delivery_system; 398c2ecf20Sopenharmony_ci enum fe_modulation modulation; 408c2ecf20Sopenharmony_ci enum fe_code_rate fec; 418c2ecf20Sopenharmony_ci u8 val; 428c2ecf20Sopenharmony_ci} TDA10071_MODCOD[] = { 438c2ecf20Sopenharmony_ci /* NBC-QPSK */ 448c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_AUTO, 0x00 }, 458c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_1_2, 0x04 }, 468c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_3_5, 0x05 }, 478c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_2_3, 0x06 }, 488c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_3_4, 0x07 }, 498c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_4_5, 0x08 }, 508c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_5_6, 0x09 }, 518c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_8_9, 0x0a }, 528c2ecf20Sopenharmony_ci { SYS_DVBS2, QPSK, FEC_9_10, 0x0b }, 538c2ecf20Sopenharmony_ci /* 8PSK */ 548c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_AUTO, 0x00 }, 558c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_3_5, 0x0c }, 568c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_2_3, 0x0d }, 578c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_3_4, 0x0e }, 588c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_5_6, 0x0f }, 598c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_8_9, 0x10 }, 608c2ecf20Sopenharmony_ci { SYS_DVBS2, PSK_8, FEC_9_10, 0x11 }, 618c2ecf20Sopenharmony_ci /* QPSK */ 628c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_AUTO, 0x2d }, 638c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_1_2, 0x2e }, 648c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_2_3, 0x2f }, 658c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_3_4, 0x30 }, 668c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_5_6, 0x31 }, 678c2ecf20Sopenharmony_ci { SYS_DVBS, QPSK, FEC_7_8, 0x32 }, 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistruct tda10071_reg_val_mask { 718c2ecf20Sopenharmony_ci u8 reg; 728c2ecf20Sopenharmony_ci u8 val; 738c2ecf20Sopenharmony_ci u8 mask; 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* firmware filename */ 778c2ecf20Sopenharmony_ci#define TDA10071_FIRMWARE "dvb-fe-tda10071.fw" 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* firmware commands */ 808c2ecf20Sopenharmony_ci#define CMD_DEMOD_INIT 0x10 818c2ecf20Sopenharmony_ci#define CMD_CHANGE_CHANNEL 0x11 828c2ecf20Sopenharmony_ci#define CMD_MPEG_CONFIG 0x13 838c2ecf20Sopenharmony_ci#define CMD_TUNER_INIT 0x15 848c2ecf20Sopenharmony_ci#define CMD_GET_AGCACC 0x1a 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define CMD_LNB_CONFIG 0x20 878c2ecf20Sopenharmony_ci#define CMD_LNB_SEND_DISEQC 0x21 888c2ecf20Sopenharmony_ci#define CMD_LNB_SET_DC_LEVEL 0x22 898c2ecf20Sopenharmony_ci#define CMD_LNB_PCB_CONFIG 0x23 908c2ecf20Sopenharmony_ci#define CMD_LNB_SEND_TONEBURST 0x24 918c2ecf20Sopenharmony_ci#define CMD_LNB_UPDATE_REPLY 0x25 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define CMD_GET_FW_VERSION 0x35 948c2ecf20Sopenharmony_ci#define CMD_SET_SLEEP_MODE 0x36 958c2ecf20Sopenharmony_ci#define CMD_BER_CONTROL 0x3e 968c2ecf20Sopenharmony_ci#define CMD_BER_UPDATE_COUNTERS 0x3f 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* firmware command struct */ 998c2ecf20Sopenharmony_ci#define TDA10071_ARGLEN 30 1008c2ecf20Sopenharmony_cistruct tda10071_cmd { 1018c2ecf20Sopenharmony_ci u8 args[TDA10071_ARGLEN]; 1028c2ecf20Sopenharmony_ci u8 len; 1038c2ecf20Sopenharmony_ci}; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#endif /* TDA10071_PRIV */ 107