update i2c add i2c poll mode
[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_platform_data {
36         int     bus_num;        
37         unsigned int    flags;     
38         unsigned int    slave_addr; 
39         unsigned long   scl_rate;   
40 #define I2C_MODE_IRQ    0
41 #define I2C_MODE_POLL   1
42         unsigned int    mode:1;
43         void    (*cfg_gpio)(struct platform_device *dev);
44 };
45
46 struct rk2818_fb_gpio{
47     u32 display_on;
48     u32 lcd_standby;
49     u32 mcu_fmk_pin;
50 };
51
52 struct rk2818_fb_iomux{
53     char *data16;
54     char *data18;
55     char *data24;
56     char *den;
57     char *vsync;
58     char *mcu_fmk;
59 };
60
61 struct rk2818_fb_mach_info {
62     struct rk2818_fb_gpio *gpio;
63     struct rk2818_fb_iomux *iomux;
64 };
65
66 struct rk2818bl_info{
67     u32 pwm_id;
68     u32 pw_pin;
69     u32 bl_ref;
70     char *pw_iomux;
71     struct timer_list timer;  
72     struct notifier_block freq_transition;
73 };
74
75 struct rk2818_gpio_expander_info {
76         unsigned int gpio_num;// ³õʼ»¯µÄpin ½Åºê¶¨Òå È磺RK2818_PIN_PI0
77         unsigned int pin_type;//³õʼ»¯µÄpin ÎªÊäÈëpin»¹ÊÇÊä³öpin È磺GPIO_IN
78         unsigned int pin_value;//Èç¹ûΪ output pin ÉèÖõçƽ£¬È磺GPIO_HIGH
79 };
80
81
82 struct pca9554_platform_data {
83         /*  the first extern gpio number in all of gpio groups */
84         unsigned gpio_base;
85         unsigned        gpio_pin_num;
86         /*  the first gpio irq  number in all of irq source */
87
88         unsigned gpio_irq_start;
89         unsigned irq_pin_num;        //ÖжϵĸöÊý
90         unsigned    pca9954_irq_pin;        //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
91         /* initial polarity inversion setting */
92         uint16_t        invert;
93         struct rk2818_gpio_expander_info  *settinginfo;
94         int  settinginfolen;
95         void            *context;       /* param to setup/teardown */
96
97         int             (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
98         int             (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
99         char            **names;
100 };
101 /* common init routines for use by arch/arm/mach-msm/board-*.c */
102 void __init rk2818_add_devices(void);
103 void __init rk2818_map_common_io(void);
104 void __init rk2818_init_irq(void);
105 void __init rk2818_init_gpio(void);
106 void __init rk2818_clock_init(void);
107
108 #endif