aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2010-10-25 02:57:16 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-10-25 02:57:16 -0400
commit4d9374f39e40f7c7fc15acbfe01dceeee850509f (patch)
tree31ec5c2ae0ae753a7bdb5a34f3a607fdda2db6c6 /arch/arm/plat-samsung
parentdc6c0ca39daad44f3169656296ef81d39a6dc7f5 (diff)
parentdff2126c548d54b040997257407a69a6cdf7a5b6 (diff)
Merge branch 'next-gpio-update' into for-next
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/gpio-config.c31
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h38
2 files changed, 69 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index e3d41eaed1ff..8a372110a850 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -41,6 +41,37 @@ int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
41} 41}
42EXPORT_SYMBOL(s3c_gpio_cfgpin); 42EXPORT_SYMBOL(s3c_gpio_cfgpin);
43 43
44int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
45 unsigned int cfg)
46{
47 int ret;
48
49 for (; nr > 0; nr--, start++) {
50 ret = s3c_gpio_cfgpin(start, cfg);
51 if (ret != 0)
52 return ret;
53 }
54
55 return 0;
56}
57EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range);
58
59int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
60 unsigned int cfg, s3c_gpio_pull_t pull)
61{
62 int ret;
63
64 for (; nr > 0; nr--, start++) {
65 s3c_gpio_setpull(start, pull);
66 ret = s3c_gpio_cfgpin(start, cfg);
67 if (ret != 0)
68 return ret;
69 }
70
71 return 0;
72}
73EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
74
44unsigned s3c_gpio_getcfg(unsigned int pin) 75unsigned s3c_gpio_getcfg(unsigned int pin)
45{ 76{
46 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); 77 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 5b43b95da68e..e4b5cf126fa9 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -108,6 +108,19 @@ extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
108 */ 108 */
109extern unsigned s3c_gpio_getcfg(unsigned int pin); 109extern unsigned s3c_gpio_getcfg(unsigned int pin);
110 110
111/**
112 * s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range
113 * @start: The pin number to start at
114 * @nr: The number of pins to configure from @start.
115 * @cfg: The configuration for the pin's function
116 *
117 * Call s3c_gpio_cfgpin() for the @nr pins starting at @start.
118 *
119 * @sa s3c_gpio_cfgpin.
120 */
121extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
122 unsigned int cfg);
123
111/* Define values for the pull-{up,down} available for each gpio pin. 124/* Define values for the pull-{up,down} available for each gpio pin.
112 * 125 *
113 * These values control the state of the weak pull-{up,down} resistors 126 * These values control the state of the weak pull-{up,down} resistors
@@ -140,6 +153,31 @@ extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
140*/ 153*/
141extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); 154extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
142 155
156/* configure `all` aspects of an gpio */
157
158/**
159 * s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
160 * @start: The gpio number to start at.
161 * @nr: The number of gpio to configure from @start.
162 * @cfg: The configuration to use
163 * @pull: The pull setting to use.
164 *
165 * Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
166 * @gpio and running for @size.
167 *
168 * @sa s3c_gpio_cfgpin
169 * @sa s3c_gpio_setpull
170 * @sa s3c_gpio_cfgpin_range
171 */
172extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
173 unsigned int cfg, s3c_gpio_pull_t pull);
174
175static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
176 unsigned int cfg)
177{
178 return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
179}
180
143/* Define values for the drvstr available for each gpio pin. 181/* Define values for the drvstr available for each gpio pin.
144 * 182 *
145 * These values control the value of the output signal driver strength, 183 * These values control the value of the output signal driver strength,