MT6620: add the new driver JB2 V1.0
[firefly-linux-kernel-4.4.55.git] / drivers / mtk_wcn_combo / drv_fm / mt6620 / inc / mt6620_fm_lib.h
1 #ifndef __MT6620_FM_LIB_H__
2 #define __MT6620_FM_LIB_H__
3
4 #include "fm_typedef.h"
5
6 #define MT6620_VOL_MAX   0x2B   // 43 volume(0-15)
7 enum {
8     DSPPATCH = 0xFFF9,
9     USDELAY = 0xFFFA,
10     MSDELAY = 0xFFFB,
11     HW_VER = 0xFFFD,
12     POLL_N = 0xFFFE, //poling check if bit(n) is '0'
13     POLL_P = 0xFFFF, //polling check if bit(n) is '1'
14 };
15
16 enum {
17     FM_PUS_DSPPATCH = DSPPATCH,
18     FM_PUS_USDELAY = USDELAY,
19     FM_PUS_MSDELAY = MSDELAY,
20     FM_PUS_HW_VER = HW_VER,
21     FM_PUS_POLL_N = POLL_N, //poling check if bit(n) is '0'
22     FM_PUS_POLL_P = POLL_P, //polling check if bit(n) is '1'
23     FM_PUS_MAX
24 };
25
26 enum {
27     DSP_PATH = 0x02,
28     DSP_COEFF = 0x03,
29     DSP_HW_COEFF = 0x04
30 };
31
32 enum IMG_TYPE {
33     IMG_WRONG = 0,
34     IMG_ROM,
35     IMG_PATCH,
36     IMG_COEFFICIENT,
37     IMG_HW_COEFFICIENT
38 };
39
40 enum {
41     mt6620_E1 = 0,
42     mt6620_E2
43 };
44
45 /*enum {
46     FM_LONG_ANA = 0,
47     FM_SHORT_ANA
48 };*/
49 enum {
50     MT6620_I2S_ON = 0,
51     MT6620_I2S_OFF
52 };
53
54 enum {
55     MT6620_I2S_MASTER = 0,
56     MT6620_I2S_SLAVE
57 };
58
59 enum {
60     MT6620_I2S_32K = 0,
61     MT6620_I2S_44K,
62     MT6620_I2S_48K
63 };
64
65 struct mt6620_fm_i2s_info {
66     fm_s32 status;
67     fm_s32 mode;
68     fm_s32 rate;
69 };
70 struct mt6620_fm_softmute_tune_cqi_t 
71 {  
72         fm_u16 ch;                              //current frequency
73         fm_u16 rssi;              // RSSI of current channel (raw data)
74         fm_u16 pamd;              // PAMD of current channel (raw data)
75         fm_u16 mr;              // MR of current channel (raw data)
76         fm_u16 atdc;              // ATDC of current channel (raw data)
77         fm_u16 prx;              // PRX of current channel (raw data)
78         fm_u16 smg;              // soft mute gain of current channel (raw data)
79 };
80
81 #define BITn(n) (uint16_t)(1<<(n))
82 #define MASK(n) (uint16_t)(~(1<<(n)))
83 //#define HiSideTableSize 1
84 #define FM_TX_PWR_CTRL_FREQ_THR 890
85 #define FM_TX_PWR_CTRL_TMP_THR_UP 45
86 #define FM_TX_PWR_CTRL_TMP_THR_DOWN 0
87
88 #define FM_TX_TRACKING_TIME_MAX 10000 //TX VCO tracking time, default 100ms
89
90 //#define MT6620_FPGA
91 //#define FM_MAIN_PGSEL   (0x9F)
92 /*
93 #define FM_MAIN_BASE            (0x0)
94 #define FM_MAIN_BITMAP0         (FM_MAIN_BASE + 0x80)
95 #define FM_MAIN_BITMAP1         (FM_MAIN_BASE + 0x81)
96 #define FM_MAIN_BITMAP2         (FM_MAIN_BASE + 0x82)
97 #define FM_MAIN_BITMAP3         (FM_MAIN_BASE + 0x83)
98 #define FM_MAIN_BITMAP4         (FM_MAIN_BASE + 0x84)
99 #define FM_MAIN_BITMAP5         (FM_MAIN_BASE + 0x85)
100 #define FM_MAIN_BITMAP6         (FM_MAIN_BASE + 0x86)
101 #define FM_MAIN_BITMAP7         (FM_MAIN_BASE + 0x87)
102 #define FM_MAIN_BITMAP8         (FM_MAIN_BASE + 0x88)
103 #define FM_MAIN_BITMAP9         (FM_MAIN_BASE + 0x89)
104 #define FM_MAIN_BITMAPA         (FM_MAIN_BASE + 0x8a)
105 #define FM_MAIN_BITMAPB         (FM_MAIN_BASE + 0x8b)
106 #define FM_MAIN_BITMAPC         (FM_MAIN_BASE + 0x8c)
107 #define FM_MAIN_BITMAPD         (FM_MAIN_BASE + 0x8d)
108 #define FM_MAIN_BITMAPE         (FM_MAIN_BASE + 0x8e)
109 #define FM_MAIN_BITMAPF         (FM_MAIN_BASE + 0x8f)
110 */
111 enum group_idx {
112         mono = 0,
113         stereo,
114         RSSI_threshold,
115         HCC_Enable,
116         PAMD_threshold,
117         Softmute_Enable,
118         De_emphasis,
119         HL_Side,
120         Demod_BW,
121         Dynamic_Limiter,
122         Softmute_Rate,
123         AFC_Enable,
124         Softmute_Level,
125         Analog_Volume,
126         GROUP_TOTAL_NUMS
127 };
128
129 enum item_idx {
130         Sblend_OFF = 0,
131         Sblend_ON,
132         ITEM_TOTAL_NUMS
133 };
134         
135 #endif