aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/gpio-config.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-19 11:49:33 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-19 11:49:33 -0700
commit349e1fba7e63b1067b5915337986060c13d9edd0 (patch)
tree7450f8355fb7f050066aab3fb94c1073e2080f7a /arch/arm/plat-samsung/gpio-config.c
parentcpumask: fix compat getaffinity (diff)
parentInput: s3c24xx_ts - depend on SAMSUNG_DEV_TS and update menu entry (diff)
downloadlinux-dev-349e1fba7e63b1067b5915337986060c13d9edd0.tar.xz
linux-dev-349e1fba7e63b1067b5915337986060c13d9edd0.zip
Merge branch 'for-linus/samsung4' of git://git.fluff.org/bjdooks/linux
* 'for-linus/samsung4' of git://git.fluff.org/bjdooks/linux: (98 commits) Input: s3c24xx_ts - depend on SAMSUNG_DEV_TS and update menu entry Input: s3c24xx_ts - Add FEAT for Samsung touchscreen support Input: s3c24xx_ts - Implement generic GPIO configuration callback ARM: SAMSUNG: Move s3c64xx dev-ts.c to plat-samsung and rename configuration ARM: SAMSUNG: Implements cfg_gpio function for Samsung touchscreen ARM: S3C64XX: Add touchscreen platform device definition ARM: SAMSUNG: Move mach/ts.h to plat/ts.h ARM: S5PC100: Move i2c helpers from plat-s5pc1xx to mach-s5pc100 ARM: S5PC100: Move frame buffer helpers from plat-s5pc1xx to mach-s5pc100 ARM: S5PC100: gpio.h cleanup ARM: S5PC100: Move gpio support from plat-s5pc1xx to mach-s5pc100 ARM: S5PC100: Use common functions for gpiolib implementation drivers: serial: S5PC100 serial driver cleanup ARM: S5PC100: Pre-requisite clock patch for plat-s5pc1xx to plat-s5p move ARM: SAMSUNG: Copy common I2C0 device helpers to machine directories ARM: SAMSUNG: move driver strength gpio configuration helper to common dir ARM: S5PV210: Add GPIOlib support ARM: SAMSUNGy: fix broken timer irq base ARM: SMDK6440: Add audio devices on board ARM: S5P6440: Add audio platform devices ...
Diffstat (limited to 'arch/arm/plat-samsung/gpio-config.c')
-rw-r--r--arch/arm/plat-samsung/gpio-config.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index 3282db360fa8..57b68a50f45e 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -33,9 +33,9 @@ int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
offset = pin - chip->chip.base;
- local_irq_save(flags);
+ s3c_gpio_lock(chip, flags);
ret = s3c_gpio_do_setcfg(chip, offset, config);
- local_irq_restore(flags);
+ s3c_gpio_unlock(chip, flags);
return ret;
}
@@ -51,9 +51,9 @@ unsigned s3c_gpio_getcfg(unsigned int pin)
if (chip) {
offset = pin - chip->chip.base;
- local_irq_save(flags);
+ s3c_gpio_lock(chip, flags);
ret = s3c_gpio_do_getcfg(chip, offset);
- local_irq_restore(flags);
+ s3c_gpio_unlock(chip, flags);
}
return ret;
@@ -72,9 +72,9 @@ int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
offset = pin - chip->chip.base;
- local_irq_save(flags);
+ s3c_gpio_lock(chip, flags);
ret = s3c_gpio_do_setpull(chip, offset, pull);
- local_irq_restore(flags);
+ s3c_gpio_unlock(chip, flags);
return ret;
}
@@ -261,3 +261,51 @@ s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
}
#endif /* CONFIG_S3C_GPIO_PULL_UP */
+#ifdef CONFIG_S5P_GPIO_DRVSTR
+s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin)
+{
+ struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
+ unsigned int off;
+ void __iomem *reg;
+ int shift;
+ u32 drvstr;
+
+ if (!chip)
+ return -EINVAL;
+
+ off = chip->chip.base - pin;
+ shift = off * 2;
+ reg = chip->base + 0x0C;
+
+ drvstr = __raw_readl(reg);
+ drvstr = 0xffff & (0x3 << shift);
+ drvstr = drvstr >> shift;
+
+ return (__force s5p_gpio_drvstr_t)drvstr;
+}
+EXPORT_SYMBOL(s5p_gpio_get_drvstr);
+
+int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr)
+{
+ struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
+ unsigned int off;
+ void __iomem *reg;
+ int shift;
+ u32 tmp;
+
+ if (!chip)
+ return -EINVAL;
+
+ off = chip->chip.base - pin;
+ shift = off * 2;
+ reg = chip->base + 0x0C;
+
+ tmp = __raw_readl(reg);
+ tmp |= drvstr << shift;
+
+ __raw_writel(tmp, reg);
+
+ return 0;
+}
+EXPORT_SYMBOL(s5p_gpio_set_drvstr);
+#endif /* CONFIG_S5P_GPIO_DRVSTR */