1 #ifndef __RKCAMSYS_GPIO_H__
2 #define __RKCAMSYS_GPIO_H__
4 #if defined(CONFIG_ARCH_ROCKCHIP)
5 #define RK30_PIN0_PA0 (0)
10 static inline unsigned int camsys_gpio_group_pin(unsigned char *io_name)
12 unsigned char *pin_char;
15 if (strstr(io_name, "PA")) {
16 pin_char = strstr(io_name, "PA");
18 pin = *pin_char - 0x30;
19 } else if (strstr(io_name, "PB")) {
20 pin_char = strstr(io_name, "PB");
22 pin = *pin_char - 0x30;
24 } else if (strstr(io_name, "PC")) {
25 pin_char = strstr(io_name, "PC");
27 pin = *pin_char - 0x30;
29 } else if (strstr(io_name, "PD")) {
30 pin_char = strstr(io_name, "PD");
32 pin = *pin_char - 0x30;
38 static inline unsigned int camsys_gpio_group(unsigned char *io_name)
42 if (strstr(io_name, "PIN0"))
44 else if (strstr(io_name, "PIN1"))
46 else if (strstr(io_name, "PIN2"))
48 else if (strstr(io_name, "PIN3"))
50 else if (strstr(io_name, "PIN4"))
52 else if (strstr(io_name, "PIN5"))
54 else if (strstr(io_name, "PIN6"))
56 else if (strstr(io_name, "PIN7"))
58 else if (strstr(io_name, "PIN8"))
63 static inline unsigned int camsys_gpio_get(unsigned char *io_name)
67 unsigned int group_pin;
68 #if (defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) ||\
69 defined(CONFIG_ARCH_RK319X) || defined(CONFIG_ARCH_ROCKCHIP))
70 if (strstr(io_name, "RK30_")) {
72 group = camsys_gpio_group(io_name);
73 group_pin = camsys_gpio_group_pin(io_name);
74 if (group >= GPIO_BANKS) {
77 if (cpu_is_rk3288()) {
78 /* bank 0 only has 24 pins ,not 32 pins */
80 gpio += 24 + (group - 1) * NUM_GROUP
86 gpio += group * NUM_GROUP + group_pin;