GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / plat-samsung / include / plat / gpio-cfg-helpers.h
blob48a239d558b8c7c504af376614462e6e074b1d5c
1 /* linux/arch/arm/plat-s3c/include/plat/gpio-cfg-helper.h
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
8 * S3C Platform - GPIO pin configuration helper definitions
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 /* This is meant for core cpu support, machine or other driver files
16 * should not be including this header.
19 #ifndef __PLAT_GPIO_CFG_HELPERS_H
20 #define __PLAT_GPIO_CFG_HELPERS_H __FILE__
22 /* As a note, all gpio configuration functions are entered exclusively, either
23 * with the relevant lock held or the system prevented from doing anything else
24 * by disabling interrupts.
27 static inline int s3c_gpio_do_setcfg(struct s3c_gpio_chip *chip,
28 unsigned int off, unsigned int config)
30 return (chip->config->set_config)(chip, off, config);
33 static inline unsigned s3c_gpio_do_getcfg(struct s3c_gpio_chip *chip,
34 unsigned int off)
36 return (chip->config->get_config)(chip, off);
39 static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
40 unsigned int off, s3c_gpio_pull_t pull)
42 return (chip->config->set_pull)(chip, off, pull);
45 /**
46 * s3c_gpio_setcfg_s3c24xx - S3C24XX style GPIO configuration.
47 * @chip: The gpio chip that is being configured.
48 * @off: The offset for the GPIO being configured.
49 * @cfg: The configuration value to set.
51 * This helper deal with the GPIO cases where the control register
52 * has two bits of configuration per gpio, which have the following
53 * functions:
54 * 00 = input
55 * 01 = output
56 * 1x = special function
58 extern int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip,
59 unsigned int off, unsigned int cfg);
61 /**
62 * s3c_gpio_getcfg_s3c24xx - S3C24XX style GPIO configuration read.
63 * @chip: The gpio chip that is being configured.
64 * @off: The offset for the GPIO being configured.
66 * The reverse of s3c_gpio_setcfg_s3c24xx(). Will return a value whicg
67 * could be directly passed back to s3c_gpio_setcfg_s3c24xx(), from the
68 * S3C_GPIO_SPECIAL() macro.
70 unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip,
71 unsigned int off);
73 /**
74 * s3c_gpio_setcfg_s3c24xx_a - S3C24XX style GPIO configuration (Bank A)
75 * @chip: The gpio chip that is being configured.
76 * @off: The offset for the GPIO being configured.
77 * @cfg: The configuration value to set.
79 * This helper deal with the GPIO cases where the control register
80 * has one bit of configuration for the gpio, where setting the bit
81 * means the pin is in special function mode and unset means output.
83 extern int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip,
84 unsigned int off, unsigned int cfg);
87 /**
88 * s3c_gpio_getcfg_s3c24xx_a - S3C24XX style GPIO configuration read (Bank A)
89 * @chip: The gpio chip that is being configured.
90 * @off: The offset for the GPIO being configured.
92 * The reverse of s3c_gpio_setcfg_s3c24xx_a() turning an GPIO into a usable
93 * GPIO configuration value.
95 * @sa s3c_gpio_getcfg_s3c24xx
96 * @sa s3c_gpio_getcfg_s3c64xx_4bit
98 extern unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip,
99 unsigned int off);
102 * s3c_gpio_setcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config.
103 * @chip: The gpio chip that is being configured.
104 * @off: The offset for the GPIO being configured.
105 * @cfg: The configuration value to set.
107 * This helper deal with the GPIO cases where the control register has 4 bits
108 * of control per GPIO, generally in the form of:
109 * 0000 = Input
110 * 0001 = Output
111 * others = Special functions (dependant on bank)
113 * Note, since the code to deal with the case where there are two control
114 * registers instead of one, we do not have a separate set of functions for
115 * each case.
117 extern int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip,
118 unsigned int off, unsigned int cfg);
122 * s3c_gpio_getcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config read.
123 * @chip: The gpio chip that is being configured.
124 * @off: The offset for the GPIO being configured.
126 * The reverse of s3c_gpio_setcfg_s3c64xx_4bit(), turning a gpio configuration
127 * register setting into a value the software can use, such as could be passed
128 * to s3c_gpio_setcfg_s3c64xx_4bit().
130 * @sa s3c_gpio_getcfg_s3c24xx
132 extern unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip,
133 unsigned int off);
135 /* Pull-{up,down} resistor controls.
137 * S3C2410,S3C2440,S3C24A0 = Pull-UP,
138 * S3C2412,S3C2413 = Pull-Down
139 * S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
140 * S3C2443 = Pull-Both [not same as S3C6400]
144 * s3c_gpio_setpull_1up() - Pull configuration for choice of up or none.
145 * @chip: The gpio chip that is being configured.
146 * @off: The offset for the GPIO being configured.
147 * @param: pull: The pull mode being requested.
149 * This is a helper function for the case where we have GPIOs with one
150 * bit configuring the presence of a pull-up resistor.
152 extern int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
153 unsigned int off, s3c_gpio_pull_t pull);
156 * s3c_gpio_setpull_1down() - Pull configuration for choice of down or none
157 * @chip: The gpio chip that is being configured
158 * @off: The offset for the GPIO being configured
159 * @param: pull: The pull mode being requested
161 * This is a helper function for the case where we have GPIOs with one
162 * bit configuring the presence of a pull-down resistor.
164 extern int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip,
165 unsigned int off, s3c_gpio_pull_t pull);
168 * s3c_gpio_setpull_upown() - Pull configuration for choice of up, down or none
169 * @chip: The gpio chip that is being configured.
170 * @off: The offset for the GPIO being configured.
171 * @param: pull: The pull mode being requested.
173 * This is a helper function for the case where we have GPIOs with two
174 * bits configuring the presence of a pull resistor, in the following
175 * order:
176 * 00 = No pull resistor connected
177 * 01 = Pull-up resistor connected
178 * 10 = Pull-down resistor connected
180 extern int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip,
181 unsigned int off, s3c_gpio_pull_t pull);
185 * s3c_gpio_getpull_updown() - Get configuration for choice of up, down or none
186 * @chip: The gpio chip that the GPIO pin belongs to
187 * @off: The offset to the pin to get the configuration of.
189 * This helper function reads the state of the pull-{up,down} resistor for the
190 * given GPIO in the same case as s3c_gpio_setpull_upown.
192 extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
193 unsigned int off);
196 * s3c_gpio_getpull_1up() - Get configuration for choice of up or none
197 * @chip: The gpio chip that the GPIO pin belongs to
198 * @off: The offset to the pin to get the configuration of.
200 * This helper function reads the state of the pull-up resistor for the
201 * given GPIO in the same case as s3c_gpio_setpull_1up.
203 extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
204 unsigned int off);
207 * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443.
208 * @chip: The gpio chip that is being configured.
209 * @off: The offset for the GPIO being configured.
210 * @param: pull: The pull mode being requested.
212 * This is a helper function for the case where we have GPIOs with two
213 * bits configuring the presence of a pull resistor, in the following
214 * order:
215 * 00 = Pull-up resistor connected
216 * 10 = Pull-down resistor connected
217 * x1 = No pull up resistor
219 extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
220 unsigned int off, s3c_gpio_pull_t pull);
223 * s3c_gpio_getpull_s3c2443() - Get configuration for s3c2443 pull resistors
224 * @chip: The gpio chip that the GPIO pin belongs to.
225 * @off: The offset to the pin to get the configuration of.
227 * This helper function reads the state of the pull-{up,down} resistor for the
228 * given GPIO in the same case as s3c_gpio_setpull_upown.
230 extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip,
231 unsigned int off);
233 #endif /* __PLAT_GPIO_CFG_HELPERS_H */