* [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask @ 2012-02-21 17:37 Roland Stigge 2012-02-21 17:37 ` [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 Roland Stigge 2012-02-23 12:49 ` [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Arnd Bergmann 0 siblings, 2 replies; 4+ messages in thread From: Roland Stigge @ 2012-02-21 17:37 UTC (permalink / raw) To: linux-arm-kernel Add missing mask to pin bit selection in gpio-lpc32xx.c (#define GPIO3_PIN_IN_SEL) Signed-off-by: Roland Stigge <stigge@antcom.de> --- drivers/gpio/gpio-lpc32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-2.6.orig/drivers/gpio/gpio-lpc32xx.c +++ linux-2.6/drivers/gpio/gpio-lpc32xx.c @@ -59,7 +59,7 @@ #define GPO3_PIN_TO_BIT(x) (1 << (x)) #define GPIO012_PIN_IN_SEL(x, y) (((x) >> (y)) & 1) #define GPIO3_PIN_IN_SHIFT(x) ((x) == 5 ? 24 : 10 + (x)) -#define GPIO3_PIN_IN_SEL(x, y) ((x) >> GPIO3_PIN_IN_SHIFT(y)) +#define GPIO3_PIN_IN_SEL(x, y) (((x) >> GPIO3_PIN_IN_SHIFT(y)) & 1) #define GPIO3_PIN5_IN_SEL(x) (((x) >> 24) & 1) #define GPI3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 2012-02-21 17:37 [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Roland Stigge @ 2012-02-21 17:37 ` Roland Stigge 2012-02-25 0:26 ` Kevin Wells 2012-02-23 12:49 ` [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Arnd Bergmann 1 sibling, 1 reply; 4+ messages in thread From: Roland Stigge @ 2012-02-21 17:37 UTC (permalink / raw) To: linux-arm-kernel The chip offers the function to detect the current state of output of the GPO P3 pins. Useful for reading GPIO output state in Linux' GPIO API, e.g. via sysfs Signed-off-by: Roland Stigge <stigge@antcom.de> --- drivers/gpio/gpio-lpc32xx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- linux-2.6.orig/drivers/gpio/gpio-lpc32xx.c +++ linux-2.6/drivers/gpio/gpio-lpc32xx.c @@ -62,9 +62,11 @@ #define GPIO3_PIN_IN_SEL(x, y) (((x) >> GPIO3_PIN_IN_SHIFT(y)) & 1) #define GPIO3_PIN5_IN_SEL(x) (((x) >> 24) & 1) #define GPI3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1) +#define GPO3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1) struct gpio_regs { void __iomem *inp_state; + void __iomem *outp_state; void __iomem *outp_set; void __iomem *outp_clr; void __iomem *dir_set; @@ -145,6 +147,7 @@ static struct gpio_regs gpio_grp_regs_p2 static struct gpio_regs gpio_grp_regs_p3 = { .inp_state = LPC32XX_GPIO_P3_INP_STATE, + .outp_state = LPC32XX_GPIO_P3_OUTP_STATE, .outp_set = LPC32XX_GPIO_P3_OUTP_SET, .outp_clr = LPC32XX_GPIO_P3_OUTP_CLR, .dir_set = LPC32XX_GPIO_P2_DIR_SET, @@ -240,6 +243,12 @@ static int __get_gpi_state_p3(struct lpc return GPI3_PIN_IN_SEL(__raw_readl(group->gpio_grp->inp_state), pin); } +static int __get_gpo_state_p3(struct lpc32xx_gpio_chip *group, + unsigned pin) +{ + return GPO3_PIN_IN_SEL(__raw_readl(group->gpio_grp->outp_state), pin); +} + /* * GENERIC_GPIO primitives. */ @@ -340,6 +349,13 @@ static void lpc32xx_gpo_set_value(struct __set_gpo_level_p3(group, pin, value); } +static int lpc32xx_gpo_get_value(struct gpio_chip *chip, unsigned pin) +{ + struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); + + return __get_gpo_state_p3(group, pin); +} + static int lpc32xx_gpio_request(struct gpio_chip *chip, unsigned pin) { if (pin < chip->ngpio) @@ -427,6 +443,7 @@ static struct lpc32xx_gpio_chip lpc32xx_ .label = "gpo_p3", .direction_output = lpc32xx_gpio_dir_out_always, .set = lpc32xx_gpo_set_value, + .get = lpc32xx_gpo_get_value, .request = lpc32xx_gpio_request, .base = LPC32XX_GPO_P3_GRP, .ngpio = LPC32XX_GPO_P3_MAX, ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 2012-02-21 17:37 ` [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 Roland Stigge @ 2012-02-25 0:26 ` Kevin Wells 0 siblings, 0 replies; 4+ messages in thread From: Kevin Wells @ 2012-02-25 0:26 UTC (permalink / raw) To: linux-arm-kernel >The chip offers the function to detect the current state of output of the GPO >P3 pins. Useful for reading GPIO output state in Linux' GPIO API, e.g. via >sysfs > >Signed-off-by: Roland Stigge <stigge@antcom.de> > I hate to be picky on this one, but can a comment be added that this only reads the programmed output state and not the actual state of the pin? (Unfortunately) GPO pins have no method to monitor their actual output state. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask 2012-02-21 17:37 [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Roland Stigge 2012-02-21 17:37 ` [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 Roland Stigge @ 2012-02-23 12:49 ` Arnd Bergmann 1 sibling, 0 replies; 4+ messages in thread From: Arnd Bergmann @ 2012-02-23 12:49 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 21 February 2012, Roland Stigge wrote: > Add missing mask to pin bit selection in gpio-lpc32xx.c > (#define GPIO3_PIN_IN_SEL) > > Signed-off-by: Roland Stigge <stigge@antcom.de> Sorry I picked on the old thread first. Acked-by: Arnd Bergmann <arnd@arndb.de> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-25 0:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-21 17:37 [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Roland Stigge 2012-02-21 17:37 ` [PATCH v2 2/2] GPIO: LPC32xx: Add output reading to GPO P3 Roland Stigge 2012-02-25 0:26 ` Kevin Wells 2012-02-23 12:49 ` [PATCH v2 1/2] GPIO: LPC32xx: Fix missing bit selection mask Arnd Bergmann
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.