18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Realtek RTL2832 DVB-T demodulator driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com>
68c2ecf20Sopenharmony_ci * Copyright (C) 2012-2014 Antti Palosaari <crope@iki.fi>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef RTL2832_PRIV_H
108c2ecf20Sopenharmony_ci#define RTL2832_PRIV_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/regmap.h>
138c2ecf20Sopenharmony_ci#include <linux/math64.h>
148c2ecf20Sopenharmony_ci#include <linux/bitops.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
178c2ecf20Sopenharmony_ci#include <media/dvb_math.h>
188c2ecf20Sopenharmony_ci#include "rtl2832.h"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct rtl2832_dev {
218c2ecf20Sopenharmony_ci	struct rtl2832_platform_data *pdata;
228c2ecf20Sopenharmony_ci	struct i2c_client *client;
238c2ecf20Sopenharmony_ci	struct regmap_config regmap_config;
248c2ecf20Sopenharmony_ci	struct regmap *regmap;
258c2ecf20Sopenharmony_ci	struct i2c_mux_core *muxc;
268c2ecf20Sopenharmony_ci	struct dvb_frontend fe;
278c2ecf20Sopenharmony_ci	enum fe_status fe_status;
288c2ecf20Sopenharmony_ci	u64 post_bit_error_prev; /* for old DVBv3 read_ber() calculation */
298c2ecf20Sopenharmony_ci	u64 post_bit_error;
308c2ecf20Sopenharmony_ci	u64 post_bit_count;
318c2ecf20Sopenharmony_ci	bool sleeping;
328c2ecf20Sopenharmony_ci	struct delayed_work i2c_gate_work;
338c2ecf20Sopenharmony_ci	unsigned long filters; /* PID filter */
348c2ecf20Sopenharmony_ci	bool slave_ts;
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct rtl2832_reg_entry {
388c2ecf20Sopenharmony_ci	u16 start_address;
398c2ecf20Sopenharmony_ci	u8 msb;
408c2ecf20Sopenharmony_ci	u8 lsb;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct rtl2832_reg_value {
448c2ecf20Sopenharmony_ci	int reg;
458c2ecf20Sopenharmony_ci	u32 value;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Demod register bit names */
498c2ecf20Sopenharmony_cienum DVBT_REG_BIT_NAME {
508c2ecf20Sopenharmony_ci	DVBT_SOFT_RST,
518c2ecf20Sopenharmony_ci	DVBT_IIC_REPEAT,
528c2ecf20Sopenharmony_ci	DVBT_TR_WAIT_MIN_8K,
538c2ecf20Sopenharmony_ci	DVBT_RSD_BER_FAIL_VAL,
548c2ecf20Sopenharmony_ci	DVBT_EN_BK_TRK,
558c2ecf20Sopenharmony_ci	DVBT_REG_PI,
568c2ecf20Sopenharmony_ci	DVBT_REG_PFREQ_1_0,
578c2ecf20Sopenharmony_ci	DVBT_PD_DA8,
588c2ecf20Sopenharmony_ci	DVBT_LOCK_TH,
598c2ecf20Sopenharmony_ci	DVBT_BER_PASS_SCAL,
608c2ecf20Sopenharmony_ci	DVBT_CE_FFSM_BYPASS,
618c2ecf20Sopenharmony_ci	DVBT_ALPHAIIR_N,
628c2ecf20Sopenharmony_ci	DVBT_ALPHAIIR_DIF,
638c2ecf20Sopenharmony_ci	DVBT_EN_TRK_SPAN,
648c2ecf20Sopenharmony_ci	DVBT_LOCK_TH_LEN,
658c2ecf20Sopenharmony_ci	DVBT_CCI_THRE,
668c2ecf20Sopenharmony_ci	DVBT_CCI_MON_SCAL,
678c2ecf20Sopenharmony_ci	DVBT_CCI_M0,
688c2ecf20Sopenharmony_ci	DVBT_CCI_M1,
698c2ecf20Sopenharmony_ci	DVBT_CCI_M2,
708c2ecf20Sopenharmony_ci	DVBT_CCI_M3,
718c2ecf20Sopenharmony_ci	DVBT_SPEC_INIT_0,
728c2ecf20Sopenharmony_ci	DVBT_SPEC_INIT_1,
738c2ecf20Sopenharmony_ci	DVBT_SPEC_INIT_2,
748c2ecf20Sopenharmony_ci	DVBT_AD_EN_REG,
758c2ecf20Sopenharmony_ci	DVBT_AD_EN_REG1,
768c2ecf20Sopenharmony_ci	DVBT_EN_BBIN,
778c2ecf20Sopenharmony_ci	DVBT_MGD_THD0,
788c2ecf20Sopenharmony_ci	DVBT_MGD_THD1,
798c2ecf20Sopenharmony_ci	DVBT_MGD_THD2,
808c2ecf20Sopenharmony_ci	DVBT_MGD_THD3,
818c2ecf20Sopenharmony_ci	DVBT_MGD_THD4,
828c2ecf20Sopenharmony_ci	DVBT_MGD_THD5,
838c2ecf20Sopenharmony_ci	DVBT_MGD_THD6,
848c2ecf20Sopenharmony_ci	DVBT_MGD_THD7,
858c2ecf20Sopenharmony_ci	DVBT_EN_CACQ_NOTCH,
868c2ecf20Sopenharmony_ci	DVBT_AD_AV_REF,
878c2ecf20Sopenharmony_ci	DVBT_PIP_ON,
888c2ecf20Sopenharmony_ci	DVBT_SCALE1_B92,
898c2ecf20Sopenharmony_ci	DVBT_SCALE1_B93,
908c2ecf20Sopenharmony_ci	DVBT_SCALE1_BA7,
918c2ecf20Sopenharmony_ci	DVBT_SCALE1_BA9,
928c2ecf20Sopenharmony_ci	DVBT_SCALE1_BAA,
938c2ecf20Sopenharmony_ci	DVBT_SCALE1_BAB,
948c2ecf20Sopenharmony_ci	DVBT_SCALE1_BAC,
958c2ecf20Sopenharmony_ci	DVBT_SCALE1_BB0,
968c2ecf20Sopenharmony_ci	DVBT_SCALE1_BB1,
978c2ecf20Sopenharmony_ci	DVBT_KB_P1,
988c2ecf20Sopenharmony_ci	DVBT_KB_P2,
998c2ecf20Sopenharmony_ci	DVBT_KB_P3,
1008c2ecf20Sopenharmony_ci	DVBT_OPT_ADC_IQ,
1018c2ecf20Sopenharmony_ci	DVBT_AD_AVI,
1028c2ecf20Sopenharmony_ci	DVBT_AD_AVQ,
1038c2ecf20Sopenharmony_ci	DVBT_K1_CR_STEP12,
1048c2ecf20Sopenharmony_ci	DVBT_TRK_KS_P2,
1058c2ecf20Sopenharmony_ci	DVBT_TRK_KS_I2,
1068c2ecf20Sopenharmony_ci	DVBT_TR_THD_SET2,
1078c2ecf20Sopenharmony_ci	DVBT_TRK_KC_P2,
1088c2ecf20Sopenharmony_ci	DVBT_TRK_KC_I2,
1098c2ecf20Sopenharmony_ci	DVBT_CR_THD_SET2,
1108c2ecf20Sopenharmony_ci	DVBT_PSET_IFFREQ,
1118c2ecf20Sopenharmony_ci	DVBT_SPEC_INV,
1128c2ecf20Sopenharmony_ci	DVBT_BW_INDEX,
1138c2ecf20Sopenharmony_ci	DVBT_RSAMP_RATIO,
1148c2ecf20Sopenharmony_ci	DVBT_CFREQ_OFF_RATIO,
1158c2ecf20Sopenharmony_ci	DVBT_FSM_STAGE,
1168c2ecf20Sopenharmony_ci	DVBT_RX_CONSTEL,
1178c2ecf20Sopenharmony_ci	DVBT_RX_HIER,
1188c2ecf20Sopenharmony_ci	DVBT_RX_C_RATE_LP,
1198c2ecf20Sopenharmony_ci	DVBT_RX_C_RATE_HP,
1208c2ecf20Sopenharmony_ci	DVBT_GI_IDX,
1218c2ecf20Sopenharmony_ci	DVBT_FFT_MODE_IDX,
1228c2ecf20Sopenharmony_ci	DVBT_RSD_BER_EST,
1238c2ecf20Sopenharmony_ci	DVBT_CE_EST_EVM,
1248c2ecf20Sopenharmony_ci	DVBT_RF_AGC_VAL,
1258c2ecf20Sopenharmony_ci	DVBT_IF_AGC_VAL,
1268c2ecf20Sopenharmony_ci	DVBT_DAGC_VAL,
1278c2ecf20Sopenharmony_ci	DVBT_SFREQ_OFF,
1288c2ecf20Sopenharmony_ci	DVBT_CFREQ_OFF,
1298c2ecf20Sopenharmony_ci	DVBT_POLAR_RF_AGC,
1308c2ecf20Sopenharmony_ci	DVBT_POLAR_IF_AGC,
1318c2ecf20Sopenharmony_ci	DVBT_AAGC_HOLD,
1328c2ecf20Sopenharmony_ci	DVBT_EN_RF_AGC,
1338c2ecf20Sopenharmony_ci	DVBT_EN_IF_AGC,
1348c2ecf20Sopenharmony_ci	DVBT_IF_AGC_MIN,
1358c2ecf20Sopenharmony_ci	DVBT_IF_AGC_MAX,
1368c2ecf20Sopenharmony_ci	DVBT_RF_AGC_MIN,
1378c2ecf20Sopenharmony_ci	DVBT_RF_AGC_MAX,
1388c2ecf20Sopenharmony_ci	DVBT_IF_AGC_MAN,
1398c2ecf20Sopenharmony_ci	DVBT_IF_AGC_MAN_VAL,
1408c2ecf20Sopenharmony_ci	DVBT_RF_AGC_MAN,
1418c2ecf20Sopenharmony_ci	DVBT_RF_AGC_MAN_VAL,
1428c2ecf20Sopenharmony_ci	DVBT_DAGC_TRG_VAL,
1438c2ecf20Sopenharmony_ci	DVBT_AGC_TARG_VAL,
1448c2ecf20Sopenharmony_ci	DVBT_LOOP_GAIN_3_0,
1458c2ecf20Sopenharmony_ci	DVBT_LOOP_GAIN_4,
1468c2ecf20Sopenharmony_ci	DVBT_VTOP,
1478c2ecf20Sopenharmony_ci	DVBT_KRF,
1488c2ecf20Sopenharmony_ci	DVBT_AGC_TARG_VAL_0,
1498c2ecf20Sopenharmony_ci	DVBT_AGC_TARG_VAL_8_1,
1508c2ecf20Sopenharmony_ci	DVBT_AAGC_LOOP_GAIN,
1518c2ecf20Sopenharmony_ci	DVBT_LOOP_GAIN2_3_0,
1528c2ecf20Sopenharmony_ci	DVBT_LOOP_GAIN2_4,
1538c2ecf20Sopenharmony_ci	DVBT_LOOP_GAIN3,
1548c2ecf20Sopenharmony_ci	DVBT_VTOP1,
1558c2ecf20Sopenharmony_ci	DVBT_VTOP2,
1568c2ecf20Sopenharmony_ci	DVBT_VTOP3,
1578c2ecf20Sopenharmony_ci	DVBT_KRF1,
1588c2ecf20Sopenharmony_ci	DVBT_KRF2,
1598c2ecf20Sopenharmony_ci	DVBT_KRF3,
1608c2ecf20Sopenharmony_ci	DVBT_KRF4,
1618c2ecf20Sopenharmony_ci	DVBT_EN_GI_PGA,
1628c2ecf20Sopenharmony_ci	DVBT_THD_LOCK_UP,
1638c2ecf20Sopenharmony_ci	DVBT_THD_LOCK_DW,
1648c2ecf20Sopenharmony_ci	DVBT_THD_UP1,
1658c2ecf20Sopenharmony_ci	DVBT_THD_DW1,
1668c2ecf20Sopenharmony_ci	DVBT_INTER_CNT_LEN,
1678c2ecf20Sopenharmony_ci	DVBT_GI_PGA_STATE,
1688c2ecf20Sopenharmony_ci	DVBT_EN_AGC_PGA,
1698c2ecf20Sopenharmony_ci	DVBT_CKOUTPAR,
1708c2ecf20Sopenharmony_ci	DVBT_CKOUT_PWR,
1718c2ecf20Sopenharmony_ci	DVBT_SYNC_DUR,
1728c2ecf20Sopenharmony_ci	DVBT_ERR_DUR,
1738c2ecf20Sopenharmony_ci	DVBT_SYNC_LVL,
1748c2ecf20Sopenharmony_ci	DVBT_ERR_LVL,
1758c2ecf20Sopenharmony_ci	DVBT_VAL_LVL,
1768c2ecf20Sopenharmony_ci	DVBT_SERIAL,
1778c2ecf20Sopenharmony_ci	DVBT_SER_LSB,
1788c2ecf20Sopenharmony_ci	DVBT_CDIV_PH0,
1798c2ecf20Sopenharmony_ci	DVBT_CDIV_PH1,
1808c2ecf20Sopenharmony_ci	DVBT_MPEG_IO_OPT_2_2,
1818c2ecf20Sopenharmony_ci	DVBT_MPEG_IO_OPT_1_0,
1828c2ecf20Sopenharmony_ci	DVBT_CKOUTPAR_PIP,
1838c2ecf20Sopenharmony_ci	DVBT_CKOUT_PWR_PIP,
1848c2ecf20Sopenharmony_ci	DVBT_SYNC_LVL_PIP,
1858c2ecf20Sopenharmony_ci	DVBT_ERR_LVL_PIP,
1868c2ecf20Sopenharmony_ci	DVBT_VAL_LVL_PIP,
1878c2ecf20Sopenharmony_ci	DVBT_CKOUTPAR_PID,
1888c2ecf20Sopenharmony_ci	DVBT_CKOUT_PWR_PID,
1898c2ecf20Sopenharmony_ci	DVBT_SYNC_LVL_PID,
1908c2ecf20Sopenharmony_ci	DVBT_ERR_LVL_PID,
1918c2ecf20Sopenharmony_ci	DVBT_VAL_LVL_PID,
1928c2ecf20Sopenharmony_ci	DVBT_SM_PASS,
1938c2ecf20Sopenharmony_ci	DVBT_UPDATE_REG_2,
1948c2ecf20Sopenharmony_ci	DVBT_BTHD_P3,
1958c2ecf20Sopenharmony_ci	DVBT_BTHD_D3,
1968c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG0,
1978c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG1,
1988c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG2,
1998c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG3,
2008c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG4,
2018c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG5,
2028c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG6,
2038c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG7,
2048c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG8,
2058c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG9,
2068c2ecf20Sopenharmony_ci	DVBT_FUNC4_REG10,
2078c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG0,
2088c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG1,
2098c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG2,
2108c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG3,
2118c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG4,
2128c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG5,
2138c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG6,
2148c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG7,
2158c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG8,
2168c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG9,
2178c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG10,
2188c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG11,
2198c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG12,
2208c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG13,
2218c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG14,
2228c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG15,
2238c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG16,
2248c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG17,
2258c2ecf20Sopenharmony_ci	DVBT_FUNC5_REG18,
2268c2ecf20Sopenharmony_ci	DVBT_AD7_SETTING,
2278c2ecf20Sopenharmony_ci	DVBT_RSSI_R,
2288c2ecf20Sopenharmony_ci	DVBT_ACI_DET_IND,
2298c2ecf20Sopenharmony_ci	DVBT_REG_MON,
2308c2ecf20Sopenharmony_ci	DVBT_REG_MONSEL,
2318c2ecf20Sopenharmony_ci	DVBT_REG_GPE,
2328c2ecf20Sopenharmony_ci	DVBT_REG_GPO,
2338c2ecf20Sopenharmony_ci	DVBT_REG_4MSEL,
2348c2ecf20Sopenharmony_ci	DVBT_TEST_REG_1,
2358c2ecf20Sopenharmony_ci	DVBT_TEST_REG_2,
2368c2ecf20Sopenharmony_ci	DVBT_TEST_REG_3,
2378c2ecf20Sopenharmony_ci	DVBT_TEST_REG_4,
2388c2ecf20Sopenharmony_ci	DVBT_REG_BIT_NAME_ITEM_TERMINATOR,
2398c2ecf20Sopenharmony_ci};
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_fc2580[] = {
2428c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x39},
2438c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
2448c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x5a},
2458c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x16},
2468c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x6},
2478c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
2488c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x16},
2498c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
2508c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
2518c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
2528c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
2538c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
2548c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
2558c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
2568c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
2578c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
2588c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x9c},
2598c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
2608c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
2618c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
2628c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9f4},
2638c2ecf20Sopenharmony_ci};
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_tua9001[] = {
2668c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x39},
2678c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
2688c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x5a},
2698c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x16},
2708c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x6},
2718c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
2728c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x16},
2738c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
2748c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
2758c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
2768c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
2778c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
2788c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
2798c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
2808c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
2818c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
2828c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x9c},
2838c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
2848c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
2858c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
2868c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9f4},
2878c2ecf20Sopenharmony_ci	{DVBT_OPT_ADC_IQ,                0x1},
2888c2ecf20Sopenharmony_ci	{DVBT_AD_AVI,                    0x0},
2898c2ecf20Sopenharmony_ci	{DVBT_AD_AVQ,                    0x0},
2908c2ecf20Sopenharmony_ci	{DVBT_SPEC_INV,                  0x0},
2918c2ecf20Sopenharmony_ci};
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_fc0012[] = {
2948c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x5a},
2958c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
2968c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x5a},
2978c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x16},
2988c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x6},
2998c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
3008c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x16},
3018c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
3028c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
3038c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
3048c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
3058c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
3068c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
3078c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
3088c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
3098c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
3108c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x80},
3118c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
3128c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
3138c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
3148c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9bf},
3158c2ecf20Sopenharmony_ci	{DVBT_EN_GI_PGA,                 0x0},
3168c2ecf20Sopenharmony_ci	{DVBT_THD_LOCK_UP,               0x0},
3178c2ecf20Sopenharmony_ci	{DVBT_THD_LOCK_DW,               0x0},
3188c2ecf20Sopenharmony_ci	{DVBT_THD_UP1,                  0x11},
3198c2ecf20Sopenharmony_ci	{DVBT_THD_DW1,                  0xef},
3208c2ecf20Sopenharmony_ci	{DVBT_INTER_CNT_LEN,             0xc},
3218c2ecf20Sopenharmony_ci	{DVBT_GI_PGA_STATE,              0x0},
3228c2ecf20Sopenharmony_ci	{DVBT_EN_AGC_PGA,                0x1},
3238c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAN,                0x0},
3248c2ecf20Sopenharmony_ci	{DVBT_SPEC_INV,                  0x0},
3258c2ecf20Sopenharmony_ci};
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_e4000[] = {
3288c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x5a},
3298c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
3308c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x5a},
3318c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x18},
3328c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x8},
3338c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
3348c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x18},
3358c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
3368c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
3378c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
3388c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
3398c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
3408c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
3418c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
3428c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
3438c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
3448c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x80},
3458c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
3468c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
3478c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
3488c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9d4},
3498c2ecf20Sopenharmony_ci	{DVBT_EN_GI_PGA,                 0x0},
3508c2ecf20Sopenharmony_ci	{DVBT_THD_LOCK_UP,               0x0},
3518c2ecf20Sopenharmony_ci	{DVBT_THD_LOCK_DW,               0x0},
3528c2ecf20Sopenharmony_ci	{DVBT_THD_UP1,                  0x14},
3538c2ecf20Sopenharmony_ci	{DVBT_THD_DW1,                  0xec},
3548c2ecf20Sopenharmony_ci	{DVBT_INTER_CNT_LEN,             0xc},
3558c2ecf20Sopenharmony_ci	{DVBT_GI_PGA_STATE,              0x0},
3568c2ecf20Sopenharmony_ci	{DVBT_EN_AGC_PGA,                0x1},
3578c2ecf20Sopenharmony_ci	{DVBT_REG_GPE,                   0x1},
3588c2ecf20Sopenharmony_ci	{DVBT_REG_GPO,                   0x1},
3598c2ecf20Sopenharmony_ci	{DVBT_REG_MONSEL,                0x1},
3608c2ecf20Sopenharmony_ci	{DVBT_REG_MON,                   0x1},
3618c2ecf20Sopenharmony_ci	{DVBT_REG_4MSEL,                 0x0},
3628c2ecf20Sopenharmony_ci	{DVBT_SPEC_INV,                  0x0},
3638c2ecf20Sopenharmony_ci};
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_r820t[] = {
3668c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x39},
3678c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
3688c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x40},
3698c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x16},
3708c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x8},
3718c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
3728c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x18},
3738c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
3748c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
3758c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
3768c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
3778c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
3788c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
3798c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
3808c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
3818c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
3828c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x80},
3838c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
3848c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
3858c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
3868c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9f4},
3878c2ecf20Sopenharmony_ci	{DVBT_SPEC_INV,                  0x1},
3888c2ecf20Sopenharmony_ci};
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_cistatic const struct rtl2832_reg_value rtl2832_tuner_init_si2157[] = {
3918c2ecf20Sopenharmony_ci	{DVBT_DAGC_TRG_VAL,             0x39},
3928c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_0,            0x0},
3938c2ecf20Sopenharmony_ci	{DVBT_AGC_TARG_VAL_8_1,         0x40},
3948c2ecf20Sopenharmony_ci	{DVBT_AAGC_LOOP_GAIN,           0x16},
3958c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_3_0,            0x8},
3968c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN2_4,              0x1},
3978c2ecf20Sopenharmony_ci	{DVBT_LOOP_GAIN3,               0x18},
3988c2ecf20Sopenharmony_ci	{DVBT_VTOP1,                    0x35},
3998c2ecf20Sopenharmony_ci	{DVBT_VTOP2,                    0x21},
4008c2ecf20Sopenharmony_ci	{DVBT_VTOP3,                    0x21},
4018c2ecf20Sopenharmony_ci	{DVBT_KRF1,                      0x0},
4028c2ecf20Sopenharmony_ci	{DVBT_KRF2,                     0x40},
4038c2ecf20Sopenharmony_ci	{DVBT_KRF3,                     0x10},
4048c2ecf20Sopenharmony_ci	{DVBT_KRF4,                     0x10},
4058c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MIN,               0x80},
4068c2ecf20Sopenharmony_ci	{DVBT_IF_AGC_MAX,               0x7f},
4078c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MIN,               0x80},
4088c2ecf20Sopenharmony_ci	{DVBT_RF_AGC_MAX,               0x7f},
4098c2ecf20Sopenharmony_ci	{DVBT_POLAR_RF_AGC,              0x0},
4108c2ecf20Sopenharmony_ci	{DVBT_POLAR_IF_AGC,              0x0},
4118c2ecf20Sopenharmony_ci	{DVBT_AD7_SETTING,            0xe9f4},
4128c2ecf20Sopenharmony_ci	{DVBT_SPEC_INV,                  0x0},
4138c2ecf20Sopenharmony_ci};
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci#endif /* RTL2832_PRIV_H */
416