0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __TDA18271_H__
0010 #define __TDA18271_H__
0011
0012 #include <linux/i2c.h>
0013 #include <media/dvb_frontend.h>
0014
0015 struct tda18271_std_map_item {
0016 u16 if_freq;
0017
0018
0019 unsigned int agc_mode:2;
0020
0021 unsigned int std:3;
0022
0023 unsigned int fm_rfn:1;
0024
0025 unsigned int if_lvl:3;
0026
0027 unsigned int rfagc_top:7;
0028 };
0029
0030 struct tda18271_std_map {
0031 struct tda18271_std_map_item fm_radio;
0032 struct tda18271_std_map_item atv_b;
0033 struct tda18271_std_map_item atv_dk;
0034 struct tda18271_std_map_item atv_gh;
0035 struct tda18271_std_map_item atv_i;
0036 struct tda18271_std_map_item atv_l;
0037 struct tda18271_std_map_item atv_lc;
0038 struct tda18271_std_map_item atv_mn;
0039 struct tda18271_std_map_item atsc_6;
0040 struct tda18271_std_map_item dvbt_6;
0041 struct tda18271_std_map_item dvbt_7;
0042 struct tda18271_std_map_item dvbt_8;
0043 struct tda18271_std_map_item qam_6;
0044 struct tda18271_std_map_item qam_7;
0045 struct tda18271_std_map_item qam_8;
0046 };
0047
0048 enum tda18271_role {
0049 TDA18271_MASTER = 0,
0050 TDA18271_SLAVE,
0051 };
0052
0053 enum tda18271_i2c_gate {
0054 TDA18271_GATE_AUTO = 0,
0055 TDA18271_GATE_ANALOG,
0056 TDA18271_GATE_DIGITAL,
0057 };
0058
0059 enum tda18271_output_options {
0060
0061 TDA18271_OUTPUT_LT_XT_ON = 0,
0062
0063
0064 TDA18271_OUTPUT_LT_OFF = 1,
0065
0066
0067 TDA18271_OUTPUT_XT_OFF = 2,
0068 };
0069
0070 enum tda18271_small_i2c {
0071 TDA18271_39_BYTE_CHUNK_INIT = 0,
0072 TDA18271_16_BYTE_CHUNK_INIT = 16,
0073 TDA18271_08_BYTE_CHUNK_INIT = 8,
0074 TDA18271_03_BYTE_CHUNK_INIT = 3,
0075 };
0076
0077 struct tda18271_config {
0078
0079 struct tda18271_std_map *std_map;
0080
0081
0082 enum tda18271_role role;
0083
0084
0085 enum tda18271_i2c_gate gate;
0086
0087
0088 enum tda18271_output_options output_opt;
0089
0090
0091 enum tda18271_small_i2c small_i2c;
0092
0093
0094 unsigned int rf_cal_on_startup:1;
0095
0096
0097
0098
0099 unsigned int delay_cal:1;
0100
0101
0102 unsigned int config;
0103 };
0104
0105 #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
0106
0107 enum tda18271_mode {
0108 TDA18271_ANALOG = 0,
0109 TDA18271_DIGITAL,
0110 };
0111
0112 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271)
0113 extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
0114 struct i2c_adapter *i2c,
0115 struct tda18271_config *cfg);
0116 #else
0117 static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
0118 u8 addr,
0119 struct i2c_adapter *i2c,
0120 struct tda18271_config *cfg)
0121 {
0122 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0123 return NULL;
0124 }
0125 #endif
0126
0127 #endif