All of lore.kernel.org
 help / color / mirror / Atom feed
* BGPIOF_READ_OUTPUT_REG_SET problem
@ 2015-12-16 14:05 Michael Trimarchi
  2015-12-16 14:50 ` Vladimir Zapolskiy
  2015-12-17  9:00 ` Linus Walleij
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Trimarchi @ 2015-12-16 14:05 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: Linus Walleij, linux-gpio, michael

Hi

I have get a problem using gpio and imx6q freescale architecture. I don't
really understand how should work your change and I have done a quick
fix for me. Can you explain what was the idea?

Michael

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index a3f0753..f9c6ff7 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -139,11 +139,14 @@ static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio)
 {
 	struct bgpio_chip *bgc = to_bgpio_chip(gc);
 	unsigned long pinmask = bgc->pin2mask(bgc, gpio);
+	unsigned long reg;
 
 	if (bgc->dir & pinmask)
-		return bgc->read_reg(bgc->reg_set) & pinmask;
+		reg = bgc->read_reg(bgc->reg_set) & pinmask;
 	else
-		return bgc->read_reg(bgc->reg_dat) & pinmask;
+		reg = bgc->read_reg(bgc->reg_dat) & pinmask;
+
+	return !!(reg &  bgc->pin2mask(bgc, gpio));
 }
 
 static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-12-17  9:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 14:05 BGPIOF_READ_OUTPUT_REG_SET problem Michael Trimarchi
2015-12-16 14:50 ` Vladimir Zapolskiy
2015-12-16 15:25   ` Michael Trimarchi
2015-12-16 18:17     ` Michael Trimarchi
2015-12-16 19:18       ` Vladimir Zapolskiy
     [not found]         ` <CAOf5uwmM2T6VVVfBLUED5=a4ZMpY10oJg_r3FCzAW+XkRLxbww@mail.gmail.com>
2015-12-16 20:01           ` Vladimir Zapolskiy
2015-12-17  7:31             ` Michael Trimarchi
2015-12-16 18:58     ` Vladimir Zapolskiy
2015-12-17  9:09       ` Linus Walleij
2015-12-17  9:00 ` Linus Walleij
2015-12-17  9:04   ` Michael Trimarchi

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.