Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69551
b: refs/heads/master
c: 3e0cc7e
h: refs/heads/master
i:
  69549: 146037d
  69547: 2e2458c
  69543: 5698085
  69535: 9842e2e
v: v3
  • Loading branch information
Russell King authored and Russell King committed Oct 15, 2007
1 parent f8b13fb commit 9208d8c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39cbd4896e39e2b93c33635a9abc1a4405827e14
refs/heads/master: 3e0cc7ee045fb53e8215fed7442455c0cee0ee93
38 changes: 38 additions & 0 deletions trunk/arch/arm/mach-pxa/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,44 @@ int pxa_gpio_mode(int gpio_mode)

EXPORT_SYMBOL(pxa_gpio_mode);

int gpio_direction_input(unsigned gpio)
{
unsigned long flags;
u32 mask;

if (gpio > pxa_last_gpio)
return -EINVAL;

mask = GPIO_bit(gpio);
local_irq_save(flags);
GPDR(gpio) &= ~mask;
local_irq_restore(flags);

return 0;
}
EXPORT_SYMBOL(gpio_direction_input);

int gpio_direction_output(unsigned gpio, int value)
{
unsigned long flags;
u32 mask;

if (gpio > pxa_last_gpio)
return -EINVAL;

mask = GPIO_bit(gpio);
local_irq_save(flags);
if (value)
GPSR(gpio) = mask;
else
GPCR(gpio) = mask;
GPDR(gpio) |= mask;
local_irq_restore(flags);

return 0;
}
EXPORT_SYMBOL(gpio_direction_output);

/*
* Return GPIO level
*/
Expand Down
12 changes: 2 additions & 10 deletions trunk/include/asm-arm/arch-pxa/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,8 @@ static inline void gpio_free(unsigned gpio)
return;
}

static inline int gpio_direction_input(unsigned gpio)
{
return pxa_gpio_mode(gpio | GPIO_IN);
}

static inline int gpio_direction_output(unsigned gpio, int value)
{
return pxa_gpio_mode(gpio | GPIO_OUT |
(value ? GPIO_DFLT_HIGH : GPIO_DFLT_LOW));
}
extern int gpio_direction_input(unsigned gpio);
extern int gpio_direction_output(unsigned gpio, int value);

static inline int __gpio_get_value(unsigned gpio)
{
Expand Down

0 comments on commit 9208d8c

Please sign in to comment.