1 #ifndef __RKCAMSYS_GPIO_H__
2 #define __RKCAMSYS_GPIO_H__
4 //#include <mach/gpio.h>
6 #if defined(CONFIG_ARCH_ROCKCHIP)
7 #define RK30_PIN0_PA0 (0)
12 static inline unsigned int camsys_gpio_group_pin(unsigned char *io_name)
14 unsigned char *pin_char;
17 if (strstr(io_name, "PA")) {
18 pin_char = strstr(io_name, "PA");
20 pin = *pin_char - 0x30;
21 } else if (strstr(io_name, "PB")) {
22 pin_char = strstr(io_name, "PB");
24 pin = *pin_char - 0x30;
26 } else if (strstr(io_name, "PC")) {
27 pin_char = strstr(io_name, "PC");
29 pin = *pin_char - 0x30;
31 } else if (strstr(io_name, "PD")) {
32 pin_char = strstr(io_name, "PD");
34 pin = *pin_char - 0x30;
41 static inline unsigned int camsys_gpio_group(unsigned char *io_name)
45 if (strstr(io_name,"PIN0")) {
47 } else if (strstr(io_name,"PIN1")) {
49 } else if (strstr(io_name,"PIN2")) {
51 } else if (strstr(io_name,"PIN3")) {
53 } else if (strstr(io_name,"PIN4")) {
55 } else if (strstr(io_name,"PIN5")) {
57 } else if (strstr(io_name,"PIN6")) {
64 static inline unsigned int camsys_gpio_get(unsigned char *io_name)
68 unsigned int group_pin;
70 #if (defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) || defined(CONFIG_ARCH_RK319X) ||defined(CONFIG_ARCH_ROCKCHIP))
71 if (strstr(io_name, "RK30_")) {
73 group = camsys_gpio_group(io_name);
74 group_pin = camsys_gpio_group_pin(io_name);
76 if (group >= GPIO_BANKS) {
79 gpio += group*NUM_GROUP + group_pin;