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 char *pin_char = NULL;
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)
40 unsigned int group = 0;
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)
65 unsigned int gpio = 0;
66 unsigned int group = 0;
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);
77 if (group >= GPIO_BANKS)
80 gpio += group * NUM_GROUP + group_pin;