ARM: S3C24XX: Remove s3c2410_gpio_getcfg(), implement s3c_gpio_getcfg()
Add s3c_gpio_getcfg() and change anything using s3c2410_gpio_getcfg() to use this instead. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
This commit is contained in:
parent
97a339995f
commit
9933847b29
5 changed files with 39 additions and 21 deletions
|
@ -33,25 +33,6 @@
|
|||
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
unsigned int s3c2410_gpio_getcfg(unsigned int pin)
|
||||
{
|
||||
void __iomem *base = S3C24XX_GPIO_BASE(pin);
|
||||
unsigned long val = __raw_readl(base);
|
||||
|
||||
if (pin < S3C2410_GPIO_BANKB) {
|
||||
val >>= S3C2410_GPIO_OFFSET(pin);
|
||||
val &= 1;
|
||||
val += 1;
|
||||
} else {
|
||||
val >>= S3C2410_GPIO_OFFSET(pin)*2;
|
||||
val &= 3;
|
||||
}
|
||||
|
||||
return val | S3C2410_GPIO_INPUT;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(s3c2410_gpio_getcfg);
|
||||
|
||||
void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
|
||||
{
|
||||
void __iomem *base = S3C24XX_GPIO_BASE(pin);
|
||||
|
|
|
@ -98,11 +98,11 @@ static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
|
|||
else
|
||||
irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
|
||||
|
||||
pinstate = s3c2410_gpio_getcfg(pin);
|
||||
pinstate = s3c_gpio_getcfg(pin);
|
||||
|
||||
if (!irqstate) {
|
||||
if (pinstate == S3C2410_GPIO_IRQ)
|
||||
S3C_PMDBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin);
|
||||
S3C_PMDBG("Leaving IRQ %d (pin %d) as is\n", irq, pin);
|
||||
} else {
|
||||
if (pinstate == S3C2410_GPIO_IRQ) {
|
||||
S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin);
|
||||
|
|
|
@ -41,6 +41,26 @@ int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
|
|||
}
|
||||
EXPORT_SYMBOL(s3c_gpio_cfgpin);
|
||||
|
||||
unsigned s3c_gpio_getcfg(unsigned int pin)
|
||||
{
|
||||
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
|
||||
unsigned long flags;
|
||||
unsigned ret = 0;
|
||||
int offset;
|
||||
|
||||
if (chip) {
|
||||
offset = pin - chip->chip.base;
|
||||
|
||||
local_irq_save(flags);
|
||||
ret = s3c_gpio_do_getcfg(chip, offset);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(s3c_gpio_getcfg);
|
||||
|
||||
|
||||
int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
|
||||
{
|
||||
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
|
||||
|
|
|
@ -30,6 +30,12 @@ static inline int s3c_gpio_do_setcfg(struct s3c_gpio_chip *chip,
|
|||
return (chip->config->set_config)(chip, off, config);
|
||||
}
|
||||
|
||||
static inline unsigned s3c_gpio_do_getcfg(struct s3c_gpio_chip *chip,
|
||||
unsigned int off)
|
||||
{
|
||||
return (chip->config->get_config)(chip, off);
|
||||
}
|
||||
|
||||
static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
|
||||
unsigned int off, s3c_gpio_pull_t pull)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,17 @@ struct s3c_gpio_cfg {
|
|||
*/
|
||||
extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
|
||||
|
||||
/**
|
||||
* s3c_gpio_getcfg - Read the current function for a GPIO pin
|
||||
* @pin: The pin to read the configuration value for.
|
||||
*
|
||||
* Read the configuration state of the given @pin, returning a value that
|
||||
* could be passed back to s3c_gpio_cfgpin().
|
||||
*
|
||||
* @sa s3c_gpio_cfgpin
|
||||
*/
|
||||
extern unsigned s3c_gpio_getcfg(unsigned int pin);
|
||||
|
||||
/* Define values for the pull-{up,down} available for each gpio pin.
|
||||
*
|
||||
* These values control the state of the weak pull-{up,down} resistors
|
||||
|
|
Loading…
Reference in a new issue