添加tca6424的代码,需要注意的是由于此芯片中断响应必须在I2C的读完成之后操作SDA和SCL脚,在i2c-rk2818.c中添加了一个函数。如果有影响其他器件的工作...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2818 / include / mach / board.h
1 /* arch/arm/mach-rk2818/include/mach/board.h
2  *
3  * Copyright (C) 2010 ROCKCHIP, Inc.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  */
15
16 #ifndef __ASM_ARCH_RK2818_BOARD_H
17 #define __ASM_ARCH_RK2818_BOARD_H
18
19 #include <linux/types.h>
20 #include <linux/timer.h>
21 #include <linux/notifier.h>
22
23
24
25 #define INVALID_GPIO        -1
26
27
28 struct rk2818_io_cfg {
29         int (*io_init)(void *);
30         int (*io_deinit)(void *);
31 };
32
33 /* platform device data structures */
34 struct platform_device;
35 struct i2c_client;
36 struct rk2818_sdmmc_platform_data {
37         unsigned int host_caps;
38         unsigned int host_ocr_avail;
39         unsigned int use_dma:1;
40         unsigned int no_detect:1;
41         char dma_name[8];
42         int (*io_init)(void);
43         int (*io_deinit)(void);
44 };
45
46 struct rk2818_i2c_spi_data {
47         int     bus_num;        
48         unsigned int    flags;     
49         unsigned int    slave_addr; 
50         unsigned long   scl_rate;   
51 };
52 struct rk2818_i2c_platform_data {
53         int     bus_num;        
54         unsigned int    flags;     
55         unsigned int    slave_addr; 
56         unsigned long   scl_rate;   
57 #define I2C_MODE_IRQ    0
58 #define I2C_MODE_POLL   1
59         unsigned int    mode:1;
60         int (*io_init)(void);
61         int (*io_deinit)(void);
62 };
63
64 struct rk2818_fb_gpio{
65     u32 display_on;
66     u32 lcd_standby;
67     u32 mcu_fmk_pin;
68 };
69
70 struct rk2818_fb_iomux{
71     char *data16;
72     char *data18;
73     char *data24;
74     char *den;
75     char *vsync;
76     char *mcu_fmk;
77 };
78
79 struct rk2818_fb_mach_info {
80     struct rk2818_fb_gpio *gpio;
81     struct rk2818_fb_iomux *iomux;
82 };
83
84 struct rk2818_bl_info{
85     u32 pwm_id;
86     u32 bl_ref;
87     int (*io_init)(void);
88     int (*io_deinit)(void);
89     struct timer_list timer;  
90     struct notifier_block freq_transition;
91 };
92
93 struct rk2818_gpio_expander_info {
94         unsigned int gpio_num;// ³õʼ»¯µÄpin ½Åºê¶¨Òå È磺RK2818_PIN_PI0
95         unsigned int pin_type;//³õʼ»¯µÄpin ÎªÊäÈëpin»¹ÊÇÊä³öpin È磺GPIO_IN
96         unsigned int pin_value;//Èç¹ûΪ output pin ÉèÖõçƽ£¬È磺GPIO_HIGH
97 };
98
99
100 struct pca9554_platform_data {
101         /*  the first extern gpio number in all of gpio groups */
102         unsigned gpio_base;
103         unsigned        gpio_pin_num;
104         /*  the first gpio irq  number in all of irq source */
105
106         unsigned gpio_irq_start;
107         unsigned irq_pin_num;        //ÖжϵĸöÊý
108         unsigned    pca9954_irq_pin;        //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
109         /* initial polarity inversion setting */
110         uint16_t        invert;
111         struct rk2818_gpio_expander_info  *settinginfo;
112         int  settinginfolen;
113         void            *context;       /* param to setup/teardown */
114
115         int             (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
116         int             (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
117         char            **names;
118 };
119
120 struct tca6424_platform_data {
121         /*  the first extern gpio number in all of gpio groups */
122         unsigned gpio_base;
123         unsigned        gpio_pin_num;
124         /*  the first gpio irq  number in all of irq source */
125
126         unsigned gpio_irq_start;
127         unsigned irq_pin_num;        //ÖжϵĸöÊý
128         unsigned tca6424_irq_pin;        //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
129         /* initial polarity inversion setting */
130         uint16_t        invert;
131         struct rk2818_gpio_expander_info  *settinginfo;
132         int  settinginfolen;
133         void            *context;       /* param to setup/teardown */
134
135         int             (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
136         int             (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
137         char            **names;
138 };
139
140
141 /*lcd*/
142 struct lcd_td043mgea1_data{
143     u32 pin_txd;
144     u32 pin_clk;
145     u32 pin_cs;
146     void (*screen_set_iomux)(u8 enable);
147 };
148
149 /*battery*/
150 struct rk2818_battery_platform_data {
151         int (*io_init)(void);
152         int (*io_deinit)(void);
153         int charge_ok_pin;
154 };
155
156 /*g_sensor*/
157 struct rk2818_gs_platform_data {
158         int (*io_init)(void);
159         int (*io_deinit)(void);
160         int gsensor_irq_pin;
161 };
162
163 /*serial*/
164 struct rk2818_serial_platform_data {
165         int (*io_init)(void);
166         int (*io_deinit)(void);
167 };
168
169 /*i2s*/
170 struct rk2818_i2s_platform_data {
171         int (*io_init)(void);
172         int (*io_deinit)(void);
173 };
174
175 /*spi*/
176 struct spi_cs_gpio {
177         const char *name;
178         unsigned int cs_gpio;
179 };
180
181 struct rk2818_spi_platform_data {
182         int (*io_init)(void);
183         int (*io_deinit)(void);
184         struct spi_cs_gpio *chipselect_gpios;   
185         u16 num_chipselect;
186 };
187
188 //ROCKCHIP AD KEY CODE ,for demo board
189 //      key             --->    EV      
190 #define AD2KEY1                 114   ///VOLUME_DOWN
191 #define AD2KEY2                 115   ///VOLUME_UP
192 #define AD2KEY3                 59    ///MENU
193 #define AD2KEY4                 102   ///HOME
194 #define AD2KEY5                 158   ///BACK
195 #define AD2KEY6                 61    ///CALL
196 #define AD2KEY7                 127   ///SEARCH
197 #define ENDCALL                                 62
198 #define KEYSTART                                28                      //ENTER
199 #define KEYMENU                                 AD2KEY6         ///CALL
200 #define KEY_PLAY_SHORT_PRESS    KEYSTART        //code for short press the play key
201 #define KEY_PLAY_LONG_PRESS             ENDCALL         //code for long press the play key
202
203 //ADC Registers
204 typedef  struct tagADC_keyst
205 {
206         unsigned int adc_value;
207         unsigned int adc_keycode;
208 }ADC_keyst,*pADC_keyst;
209
210 /*ad key*/
211 struct adc_key_data{
212     u32 pin_playon;
213     u32 playon_level;
214     u32 adc_empty;
215     u32 adc_invalid;
216     u32 adc_drift;
217     u32 adc_chn;
218     ADC_keyst * adc_key_table;
219     unsigned char *initKeyCode;
220     u32 adc_key_cnt;
221 };
222
223 struct rk2818_adckey_platform_data {
224         int (*io_init)(void);
225         int (*io_deinit)(void);
226         struct adc_key_data *adc_key;
227 };
228
229 /* common init routines for use by arch/arm/mach-msm/board-*.c */
230 void __init rk2818_add_devices(void);
231 void __init rk2818_map_common_io(void);
232 void __init rk2818_init_irq(void);
233 void __init rk2818_init_gpio(void);
234 void __init rk2818_clock_init(void);
235
236 #endif