diff options
author | Olof Johansson <olof@lixom.net> | 2012-11-21 13:13:53 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-11-21 13:13:53 -0500 |
commit | 4aa7cf79b1f760b5751d1686329351c2e060791b (patch) | |
tree | 1c05a37804a577a01011de8e4c781f2833b3ca9c | |
parent | a19e2337790a7a0b8593c7d0b694dab83bfbd489 (diff) | |
parent | 343db4bda61feb3ac177d73f006e3527dcb431da (diff) |
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
-rw-r--r-- | arch/arm/plat-samsung/include/plat/gpio-core.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-samsung/s5p-irq-gpioint.c | 8 | ||||
-rw-r--r-- | drivers/gpio/gpio-samsung.c | 25 |
3 files changed, 20 insertions, 15 deletions
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h index 1fe6917f6a2a..dfd8b7af8c7a 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-core.h +++ b/arch/arm/plat-samsung/include/plat/gpio-core.h | |||
@@ -48,6 +48,7 @@ struct samsung_gpio_cfg; | |||
48 | * @config: special function and pull-resistor control information. | 48 | * @config: special function and pull-resistor control information. |
49 | * @lock: Lock for exclusive access to this gpio bank. | 49 | * @lock: Lock for exclusive access to this gpio bank. |
50 | * @pm_save: Save information for suspend/resume support. | 50 | * @pm_save: Save information for suspend/resume support. |
51 | * @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not. | ||
51 | * | 52 | * |
52 | * This wrapper provides the necessary information for the Samsung | 53 | * This wrapper provides the necessary information for the Samsung |
53 | * specific gpios being registered with gpiolib. | 54 | * specific gpios being registered with gpiolib. |
@@ -71,6 +72,7 @@ struct samsung_gpio_chip { | |||
71 | #ifdef CONFIG_PM | 72 | #ifdef CONFIG_PM |
72 | u32 pm_save[4]; | 73 | u32 pm_save[4]; |
73 | #endif | 74 | #endif |
75 | u32 bitmap_gpio_int; | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) | 78 | static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) |
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c index 23557d30e44c..bae56131a50a 100644 --- a/arch/arm/plat-samsung/s5p-irq-gpioint.c +++ b/arch/arm/plat-samsung/s5p-irq-gpioint.c | |||
@@ -185,7 +185,7 @@ int __init s5p_register_gpio_interrupt(int pin) | |||
185 | 185 | ||
186 | /* check if the group has been already registered */ | 186 | /* check if the group has been already registered */ |
187 | if (my_chip->irq_base) | 187 | if (my_chip->irq_base) |
188 | return my_chip->irq_base + offset; | 188 | goto success; |
189 | 189 | ||
190 | /* register gpio group */ | 190 | /* register gpio group */ |
191 | ret = s5p_gpioint_add(my_chip); | 191 | ret = s5p_gpioint_add(my_chip); |
@@ -193,9 +193,13 @@ int __init s5p_register_gpio_interrupt(int pin) | |||
193 | my_chip->chip.to_irq = samsung_gpiolib_to_irq; | 193 | my_chip->chip.to_irq = samsung_gpiolib_to_irq; |
194 | printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", | 194 | printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", |
195 | group); | 195 | group); |
196 | return my_chip->irq_base + offset; | 196 | goto success; |
197 | } | 197 | } |
198 | return ret; | 198 | return ret; |
199 | success: | ||
200 | my_chip->bitmap_gpio_int |= BIT(offset); | ||
201 | |||
202 | return my_chip->irq_base + offset; | ||
199 | } | 203 | } |
200 | 204 | ||
201 | int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) | 205 | int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index a006f0db15af..43c4595b5cf0 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -42,12 +42,6 @@ | |||
42 | #include <plat/gpio-fns.h> | 42 | #include <plat/gpio-fns.h> |
43 | #include <plat/pm.h> | 43 | #include <plat/pm.h> |
44 | 44 | ||
45 | #ifndef DEBUG_GPIO | ||
46 | #define gpio_dbg(x...) do { } while (0) | ||
47 | #else | ||
48 | #define gpio_dbg(x...) printk(KERN_DEBUG x) | ||
49 | #endif | ||
50 | |||
51 | int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip, | 45 | int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip, |
52 | unsigned int off, samsung_gpio_pull_t pull) | 46 | unsigned int off, samsung_gpio_pull_t pull) |
53 | { | 47 | { |
@@ -596,10 +590,13 @@ static int samsung_gpiolib_4bit_input(struct gpio_chip *chip, | |||
596 | unsigned long con; | 590 | unsigned long con; |
597 | 591 | ||
598 | con = __raw_readl(base + GPIOCON_OFF); | 592 | con = __raw_readl(base + GPIOCON_OFF); |
599 | con &= ~(0xf << con_4bit_shift(offset)); | 593 | if (ourchip->bitmap_gpio_int & BIT(offset)) |
594 | con |= 0xf << con_4bit_shift(offset); | ||
595 | else | ||
596 | con &= ~(0xf << con_4bit_shift(offset)); | ||
600 | __raw_writel(con, base + GPIOCON_OFF); | 597 | __raw_writel(con, base + GPIOCON_OFF); |
601 | 598 | ||
602 | gpio_dbg("%s: %p: CON now %08lx\n", __func__, base, con); | 599 | pr_debug("%s: %p: CON now %08lx\n", __func__, base, con); |
603 | 600 | ||
604 | return 0; | 601 | return 0; |
605 | } | 602 | } |
@@ -627,7 +624,7 @@ static int samsung_gpiolib_4bit_output(struct gpio_chip *chip, | |||
627 | __raw_writel(con, base + GPIOCON_OFF); | 624 | __raw_writel(con, base + GPIOCON_OFF); |
628 | __raw_writel(dat, base + GPIODAT_OFF); | 625 | __raw_writel(dat, base + GPIODAT_OFF); |
629 | 626 | ||
630 | gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); | 627 | pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); |
631 | 628 | ||
632 | return 0; | 629 | return 0; |
633 | } | 630 | } |
@@ -671,7 +668,7 @@ static int samsung_gpiolib_4bit2_input(struct gpio_chip *chip, | |||
671 | con &= ~(0xf << con_4bit_shift(offset)); | 668 | con &= ~(0xf << con_4bit_shift(offset)); |
672 | __raw_writel(con, regcon); | 669 | __raw_writel(con, regcon); |
673 | 670 | ||
674 | gpio_dbg("%s: %p: CON %08lx\n", __func__, base, con); | 671 | pr_debug("%s: %p: CON %08lx\n", __func__, base, con); |
675 | 672 | ||
676 | return 0; | 673 | return 0; |
677 | } | 674 | } |
@@ -706,7 +703,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip, | |||
706 | __raw_writel(con, regcon); | 703 | __raw_writel(con, regcon); |
707 | __raw_writel(dat, base + GPIODAT_OFF); | 704 | __raw_writel(dat, base + GPIODAT_OFF); |
708 | 705 | ||
709 | gpio_dbg("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); | 706 | pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat); |
710 | 707 | ||
711 | return 0; | 708 | return 0; |
712 | } | 709 | } |
@@ -926,10 +923,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) | |||
926 | #ifdef CONFIG_PM | 923 | #ifdef CONFIG_PM |
927 | if (chip->pm != NULL) { | 924 | if (chip->pm != NULL) { |
928 | if (!chip->pm->save || !chip->pm->resume) | 925 | if (!chip->pm->save || !chip->pm->resume) |
929 | printk(KERN_ERR "gpio: %s has missing PM functions\n", | 926 | pr_err("gpio: %s has missing PM functions\n", |
930 | gc->label); | 927 | gc->label); |
931 | } else | 928 | } else |
932 | printk(KERN_ERR "gpio: %s has no PM function\n", gc->label); | 929 | pr_err("gpio: %s has no PM function\n", gc->label); |
933 | #endif | 930 | #endif |
934 | 931 | ||
935 | /* gpiochip_add() prints own failure message on error. */ | 932 | /* 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 | if ((base != NULL) && (chip->base == NULL)) | 1078 | if ((base != NULL) && (chip->base == NULL)) |
1082 | chip->base = base + ((i) * 0x20); | 1079 | chip->base = base + ((i) * 0x20); |
1083 | 1080 | ||
1081 | chip->bitmap_gpio_int = 0; | ||
1082 | |||
1084 | samsung_gpiolib_add(chip); | 1083 | samsung_gpiolib_add(chip); |
1085 | } | 1084 | } |
1086 | } | 1085 | } |