Skip to content

Commit

Permalink
ARM: S3C24XX: Remove s3c2410_gpio_getcfg(), implement s3c_gpio_getcfg()
Browse files Browse the repository at this point in the history
Add s3c_gpio_getcfg() and change anything using s3c2410_gpio_getcfg() to
use this instead.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Ben Dooks committed May 6, 2010
1 parent 97a3399 commit 9933847
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 21 deletions.
19 changes: 0 additions & 19 deletions arch/arm/plat-s3c24xx/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-s3c24xx/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions arch/arm/plat-samsung/gpio-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/plat-samsung/include/plat/gpio-cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9933847

Please sign in to comment.