]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 4783/1: S3C24XX: Add s3c2410_gpio_getpull()
authorBen Dooks <ben-linux@fluff.org>
Mon, 28 Jan 2008 12:01:23 +0000 (13:01 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 28 Jan 2008 13:20:51 +0000 (13:20 +0000)
Add the call s3c2410_gpio_getpull() to return the
current state of the pin's pull-up.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/plat-s3c24xx/gpio.c
include/asm-arm/arch-s3c2410/hardware.h

index ec3a09c4d18189b486b900c6b62cfc9d3fea5d87..7cc6faec25d974b98c8ff84ff244bc60835316fb 100644 (file)
@@ -122,6 +122,19 @@ void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
 
 EXPORT_SYMBOL(s3c2410_gpio_pullup);
 
+int s3c2410_gpio_getpull(unsigned int pin)
+{
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
+       unsigned long offs = S3C2410_GPIO_OFFSET(pin);
+
+       if (pin < S3C2410_GPIO_BANKB)
+               return -EINVAL;
+
+       return (__raw_readl(base + 0x08) & (1L << offs)) ? 1 : 0;
+}
+
+EXPORT_SYMBOL(s3c2410_gpio_getpull);
+
 void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
 {
        void __iomem *base = S3C24XX_GPIO_BASE(pin);
index faeaba514ffebc877b43a249e31eab3e33913357..20509e4540f6c277861c683505579675d202d263 100644 (file)
@@ -87,6 +87,18 @@ extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
 
 extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
 
+/* s3c2410_gpio_getpull
+ *
+ * Read the state of the pull-up on a given pin
+ *
+ * return:
+ *     < 0 => error code
+ *       0 => enabled
+ *       1 => disabled
+*/
+
+extern int s3c2410_gpio_getpull(unsigned int pin);
+
 extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
 
 extern unsigned int s3c2410_gpio_getpin(unsigned int pin);