rk30:add tsadc support
[firefly-linux-kernel-4.4.55.git] / drivers / adc / plat / rk30_tsadc.h
1 /* drivers/adc/chips/rk29_adc.h
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation.
6  *
7 */
8
9 #ifndef __ASM_RK30_ADC_H
10 #define __ASM_RK30_ADC_H
11
12 #define ADC_DATA                0x00
13 #define ADC_DATA_MASK           0x3ff
14
15 #define ADC_STAS                0x04
16 #define ADC_STAS_BUSY           (1<<0)
17
18 #define ADC_CTRL                0x08
19 #define ADC_CTRL_CH(ch)         (0x07 - ((ch)<<0))
20 #define ADC_CTRL_POWER_UP       (1<<3)
21 #define ADC_CTRL_START          (1<<4)
22 #define ADC_CTRL_IRQ_ENABLE     (1<<5)
23 #define ADC_CTRL_IRQ_STATUS     (1<<6)
24
25 #define ADC_DLY_PU_SOC          0x0C 
26
27 #define ADC_CLK_RATE            1  //1M
28 #define SAMPLE_RATE             (20/ADC_CLK_RATE)  //20 CLK
29
30 struct tsadc_table
31 {
32         int code;
33         int temp;
34 };
35
36 static struct tsadc_table table_code_to_temp[] =
37 {
38         {3800, -40},
39         {3792, -35},
40         {3783, -30},
41         {3774, -25},
42         {3765, -20},
43         {3756, -15},
44         {3747, -10},
45         {3737, -5},
46         {3728, 0},
47         {3718, 5},
48         
49         {3708, 10},
50         {3698, 15},
51         {3688, 20},
52         {3678, 25},
53         {3667, 30},
54         {3656, 35},
55         {3645, 40},
56         {3634, 45},
57         {3623, 50},
58         {3611, 55},
59         
60         {3600, 60},
61         {3588, 65},
62         {3575, 70},
63         {3563, 75},
64         {3550, 80},
65         {3537, 85},
66         {3524, 90},
67         {3510, 95},
68         {3496, 100},
69         {3482, 105},
70         
71         {3467, 110},
72         {3452, 115},
73         {3437, 120},
74         {3421, 125},
75
76 };
77
78
79
80 #endif /* __ASM_RK30_ADC_H */