398bf579bc308f7f8206b74fea91889bb20cef86
[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 /* platform device data structures */
24 struct platform_device;
25 struct i2c_client;
26 struct rk2818_sdmmc_platform_data {
27         unsigned int host_caps;
28         unsigned int host_ocr_avail;
29         unsigned int use_dma:1;
30         unsigned int no_detect:1;
31         char dma_name[8];
32         void    (*cfg_gpio)(struct platform_device *dev);
33 };
34
35 struct rk2818_i2c_spi_data {
36         int     bus_num;        
37         unsigned int    flags;     
38         unsigned int    slave_addr; 
39         unsigned long   scl_rate;   
40 };
41 struct rk2818_i2c_platform_data {
42         int     bus_num;        
43         unsigned int    flags;     
44         unsigned int    slave_addr; 
45         unsigned long   scl_rate;   
46 #define I2C_MODE_IRQ    0
47 #define I2C_MODE_POLL   1
48         unsigned int    mode:1;
49         void    (*cfg_gpio)(struct platform_device *dev);
50 };
51
52 struct rk2818_fb_gpio{
53     u32 display_on;
54     u32 lcd_standby;
55     u32 mcu_fmk_pin;
56 };
57
58 struct rk2818_fb_iomux{
59     char *data16;
60     char *data18;
61     char *data24;
62     char *den;
63     char *vsync;
64     char *mcu_fmk;
65 };
66
67 struct rk2818_fb_mach_info {
68     struct rk2818_fb_gpio *gpio;
69     struct rk2818_fb_iomux *iomux;
70 };
71
72 struct rk2818bl_info{
73     u32 pwm_id;
74     u32 pw_pin;
75     u32 bl_ref;
76     char *pw_iomux;
77     struct timer_list timer;  
78     struct notifier_block freq_transition;
79 };
80
81 struct rk2818_gpio_expander_info {
82         unsigned int gpio_num;// ³õʼ»¯µÄpin ½Åºê¶¨Òå È磺RK2818_PIN_PI0
83         unsigned int pin_type;//³õʼ»¯µÄpin ÎªÊäÈëpin»¹ÊÇÊä³öpin È磺GPIO_IN
84         unsigned int pin_value;//Èç¹ûΪ output pin ÉèÖõçƽ£¬È磺GPIO_HIGH
85 };
86
87
88 struct pca9554_platform_data {
89         /*  the first extern gpio number in all of gpio groups */
90         unsigned gpio_base;
91         unsigned        gpio_pin_num;
92         /*  the first gpio irq  number in all of irq source */
93
94         unsigned gpio_irq_start;
95         unsigned irq_pin_num;        //ÖжϵĸöÊý
96         unsigned    pca9954_irq_pin;        //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
97         /* initial polarity inversion setting */
98         uint16_t        invert;
99         struct rk2818_gpio_expander_info  *settinginfo;
100         int  settinginfolen;
101         void            *context;       /* param to setup/teardown */
102
103         int             (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
104         int             (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
105         char            **names;
106 };
107
108 /*lcd*/
109 struct lcd_td043mgea1_data{
110     u32 pin_txd;
111     u32 pin_clk;
112     u32 pin_cs;
113     void (*screen_set_iomux)(u8 enable);
114 };
115
116 //ROCKCHIP AD KEY CODE ,for demo board
117 //      key             --->    EV      
118 #define AD2KEY1                 114   ///VOLUME_DOWN
119 #define AD2KEY2                 115   ///VOLUME_UP
120 #define AD2KEY3                 59    ///MENU
121 #define AD2KEY4                 102   ///HOME
122 #define AD2KEY5                 158   ///BACK
123 #define AD2KEY6                 61    ///CALL
124 #define AD2KEY7                 127   ///SEARCH
125 #define ENDCALL                                 62
126 #define KEYSTART                                28                      //ENTER
127 #define KEYMENU                                 AD2KEY6         ///CALL
128 #define KEY_PLAY_SHORT_PRESS    KEYSTART        //code for short press the play key
129 #define KEY_PLAY_LONG_PRESS             ENDCALL         //code for long press the play key
130
131 //ADC Registers
132 typedef  struct tagADC_keyst
133 {
134         unsigned int adc_value;
135         unsigned int adc_keycode;
136 }ADC_keyst,*pADC_keyst;
137
138 /*ad key*/
139 struct adc_key_data{
140     u32 pin_playon;
141     u32 playon_level;
142     u32 adc_empty;
143     u32 adc_invalid;
144     u32 adc_drift;
145     u32 adc_chn;
146     ADC_keyst * adc_key_table;
147     unsigned char *initKeyCode;
148     u32 adc_key_cnt;
149 };
150
151 /* common init routines for use by arch/arm/mach-msm/board-*.c */
152 void __init rk2818_add_devices(void);
153 void __init rk2818_map_common_io(void);
154 void __init rk2818_init_irq(void);
155 void __init rk2818_init_gpio(void);
156 void __init rk2818_clock_init(void);
157
158 #endif