Commit 4aa7cf79 authored by Olof Johansson's avatar Olof Johansson

Merge branch 'next/gpio-samsung' of...

Merge branch 'next/gpio-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/drivers

From Kukjin Kim:
This is for Samsung gpio stuff and got the ack from Linus Walleij.

* 'next/gpio-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung:
  gpio: samsung: use pr_* instead of printk
  gpio: samsung: Fix input mode setting function for GPIO int
  ARM: SAMSUNG: Insert bitmap_gpio_int member in samsung_gpio_chip
parents a19e2337 343db4bd
...@@ -48,6 +48,7 @@ struct samsung_gpio_cfg; ...@@ -48,6 +48,7 @@ struct samsung_gpio_cfg;
* @config: special function and pull-resistor control information. * @config: special function and pull-resistor control information.
* @lock: Lock for exclusive access to this gpio bank. * @lock: Lock for exclusive access to this gpio bank.
* @pm_save: Save information for suspend/resume support. * @pm_save: Save information for suspend/resume support.
* @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not.
* *
* This wrapper provides the necessary information for the Samsung * This wrapper provides the necessary information for the Samsung
* specific gpios being registered with gpiolib. * specific gpios being registered with gpiolib.
...@@ -71,6 +72,7 @@ struct samsung_gpio_chip { ...@@ -71,6 +72,7 @@ struct samsung_gpio_chip {
#ifdef CONFIG_PM #ifdef CONFIG_PM
u32 pm_save[4]; u32 pm_save[4];
#endif #endif
u32 bitmap_gpio_int;
}; };
static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
......
...@@ -185,7 +185,7 @@ int __init s5p_register_gpio_interrupt(int pin) ...@@ -185,7 +185,7 @@ int __init s5p_register_gpio_interrupt(int pin)
/* check if the group has been already registered */ /* check if the group has been already registered */
if (my_chip->irq_base) if (my_chip->irq_base)
return my_chip->irq_base + offset; goto success;
/* register gpio group */ /* register gpio group */
ret = s5p_gpioint_add(my_chip); ret = s5p_gpioint_add(my_chip);
...@@ -193,9 +193,13 @@ int __init s5p_register_gpio_interrupt(int pin) ...@@ -193,9 +193,13 @@ int __init s5p_register_gpio_interrupt(int pin)
my_chip->chip.to_irq = samsung_gpiolib_to_irq; my_chip->chip.to_irq = samsung_gpiolib_to_irq;
printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", printk(KERN_INFO "Registered interrupt support for gpio group %d.\n",
group); group);
return my_chip->irq_base + offset; goto success;
} }
return ret; return ret;
success:
my_chip->bitmap_gpio_int |= BIT(offset);
return my_chip->irq_base + offset;
} }
int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups)
......
...@@ -42,12 +42,6 @@ ...@@ -42,12 +42,6 @@
#include <plat/gpio-fns.h> #include <plat/gpio-fns.h>
#include <plat/pm.h> #include <plat/pm.h>
#ifndef DEBUG_GPIO
#define gpio_dbg(x...) do { } while (0)
#else
#define gpio_dbg(x...) printk(KERN_DEBUG x)
#endif
int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip, int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
unsigned int off, samsung_gpio_pull_t pull) unsigned int off, samsung_gpio_pull_t pull)
{ {
...@@ -596,10 +590,13 @@ static int samsung_gpiolib_4bit_input(struct gpio_chip *chip, ...@@ -596,10 +590,13 @@ static int samsung_gpiolib_4bit_input(struct gpio_chip *chip,
unsigned long con; unsigned long con;
con = __raw_readl(base + GPIOCON_OFF); con = __raw_readl(base + GPIOCON_OFF);
con &= ~(0xf << con_4bit_shift(offset)); if (ourchip->bitmap_gpio_int & BIT(offset))
con |= 0xf << con_4bit_shift(offset);
else
con &= ~(0xf << con_4bit_shift(offset));
__raw_writel(con, base + GPIOCON_OFF); __raw_writel(con, base + GPIOCON_OFF);
gpio_dbg("%s: %p: CON now %08lx\n", __func__, base, con); pr_debug("%s: %p: CON now %08lx\n", __func__, base, con);
return 0; return 0;
} }
...@@ -627,7 +624,7 @@ static int samsung_gpiolib_4bit_output(struct gpio_chip *chip, ...@@ -627,7 +624,7 @@ static int samsung_gpiolib_4bit_output(struct gpio_chip *chip,
__raw_writel(con, base + GPIOCON_OFF); __raw_writel(con, base + GPIOCON_OFF);
__raw_writel(dat, base + GPIODAT_OFF); __raw_writel(dat, base + GPIODAT_OFF);
gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
return 0; return 0;
} }
...@@ -671,7 +668,7 @@ static int samsung_gpiolib_4bit2_input(struct gpio_chip *chip, ...@@ -671,7 +668,7 @@ static int samsung_gpiolib_4bit2_input(struct gpio_chip *chip,
con &= ~(0xf << con_4bit_shift(offset)); con &= ~(0xf << con_4bit_shift(offset));
__raw_writel(con, regcon); __raw_writel(con, regcon);
gpio_dbg("%s: %p: CON %08lx\n", __func__, base, con); pr_debug("%s: %p: CON %08lx\n", __func__, base, con);
return 0; return 0;
} }
...@@ -706,7 +703,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip, ...@@ -706,7 +703,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip,
__raw_writel(con, regcon); __raw_writel(con, regcon);
__raw_writel(dat, base + GPIODAT_OFF); __raw_writel(dat, base + GPIODAT_OFF);
gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
return 0; return 0;
} }
...@@ -926,10 +923,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) ...@@ -926,10 +923,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
#ifdef CONFIG_PM #ifdef CONFIG_PM
if (chip->pm != NULL) { if (chip->pm != NULL) {
if (!chip->pm->save || !chip->pm->resume) if (!chip->pm->save || !chip->pm->resume)
printk(KERN_ERR "gpio: %s has missing PM functions\n", pr_err("gpio: %s has missing PM functions\n",
gc->label); gc->label);
} else } else
printk(KERN_ERR "gpio: %s has no PM function\n", gc->label); pr_err("gpio: %s has no PM function\n", gc->label);
#endif #endif
/* gpiochip_add() prints own failure message on error. */ /* gpiochip_add() prints own failure message on error. */
...@@ -1081,6 +1078,8 @@ static void __init samsung_gpiolib_add_4bit_chips(struct samsung_gpio_chip *chip ...@@ -1081,6 +1078,8 @@ static void __init samsung_gpiolib_add_4bit_chips(struct samsung_gpio_chip *chip
if ((base != NULL) && (chip->base == NULL)) if ((base != NULL) && (chip->base == NULL))
chip->base = base + ((i) * 0x20); chip->base = base + ((i) * 0x20);
chip->bitmap_gpio_int = 0;
samsung_gpiolib_add(chip); samsung_gpiolib_add(chip);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment