This source file includes following definitions.
- to_samsung_gpio
- samsung_gpiolib_getchip
- samsung_gpiolib_getchip
- s3c_gpiolib_track
1
2
3
4
5
6
7
8
9
10 #ifndef __PLAT_SAMSUNG_GPIO_CORE_H
11 #define __PLAT_SAMSUNG_GPIO_CORE_H
12
13
14 #include <mach/gpio-samsung.h>
15 #include <linux/gpio/driver.h>
16
17 #define GPIOCON_OFF (0x00)
18 #define GPIODAT_OFF (0x04)
19
20 #define con_4bit_shift(__off) ((__off) * 4)
21
22
23
24
25
26
27
28
29
30
31 struct samsung_gpio_chip;
32
33
34
35
36
37
38 struct samsung_gpio_pm {
39 void (*save)(struct samsung_gpio_chip *chip);
40 void (*resume)(struct samsung_gpio_chip *chip);
41 };
42
43 struct samsung_gpio_cfg;
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 struct samsung_gpio_chip {
68 struct gpio_chip chip;
69 struct samsung_gpio_cfg *config;
70 struct samsung_gpio_pm *pm;
71 void __iomem *base;
72 int irq_base;
73 int group;
74 spinlock_t lock;
75 #ifdef CONFIG_PM
76 u32 pm_save[4];
77 #endif
78 u32 bitmap_gpio_int;
79 };
80
81 static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
82 {
83 return container_of(gpc, struct samsung_gpio_chip, chip);
84 }
85
86
87
88
89
90
91
92
93
94 extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
95
96
97 extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default;
98
99 #ifdef CONFIG_S3C_GPIO_TRACK
100 extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
101
102 static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
103 {
104 return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
105 }
106 #else
107
108
109 extern struct samsung_gpio_chip s3c24xx_gpios[];
110
111 static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int pin)
112 {
113 struct samsung_gpio_chip *chip;
114
115 if (pin > S3C_GPIO_END)
116 return NULL;
117
118 chip = &s3c24xx_gpios[pin/32];
119 return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL;
120 }
121
122 static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { }
123 #endif
124
125 #ifdef CONFIG_PM
126 extern struct samsung_gpio_pm samsung_gpio_pm_1bit;
127 extern struct samsung_gpio_pm samsung_gpio_pm_2bit;
128 extern struct samsung_gpio_pm samsung_gpio_pm_4bit;
129 #define __gpio_pm(x) x
130 #else
131 #define samsung_gpio_pm_1bit NULL
132 #define samsung_gpio_pm_2bit NULL
133 #define samsung_gpio_pm_4bit NULL
134 #define __gpio_pm(x) NULL
135
136 #endif
137
138
139 #define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
140 #define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)
141
142 #endif