* + gpio-max732x-fix-input-configuration-for-open-drain-pins.patch added to -mm tree
@ 2010-04-23 18:20 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2010-04-23 18:20 UTC (permalink / raw)
To: mm-commits; +Cc: maz, eric.y.miao
The patch titled
gpio: max732x: fix input configuration for open-drain pins
has been added to the -mm tree. Its filename is
gpio-max732x-fix-input-configuration-for-open-drain-pins.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: gpio: max732x: fix input configuration for open-drain pins
From: Marc Zyngier <maz@misterjones.org>
Fix a bug I noticed while hacking on the max732x driver for interrupt
support. According to the datasheets, open-drain pins have to be
configured as output-high (which in that case is actually high impedance)
to be used as input.
Signed-off-by: Marc Zyngier <maz@misterjones.org>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/gpio/max732x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff -puN drivers/gpio/max732x.c~gpio-max732x-fix-input-configuration-for-open-drain-pins drivers/gpio/max732x.c
--- a/drivers/gpio/max732x.c~gpio-max732x-fix-input-configuration-for-open-drain-pins
+++ a/drivers/gpio/max732x.c
@@ -232,6 +232,13 @@ static int max732x_gpio_direction_input(
return -EACCES;
}
+ /*
+ * Open-drain pins must be set to high impedance (which is
+ * equivalent to output-high) to be turned into an input.
+ */
+ if ((mask & chip->dir_output))
+ max732x_gpio_set_value(gc, off, 1);
+
return 0;
}
_
Patches currently in -mm which might be from maz@misterjones.org are
linux-next.patch
rtc-ds1302-add-some-abstraction-for-new-platform-support.patch
gpio-add-interrupt-handling-capability-to-max732x.patch
gpio-max732x-fix-input-configuration-for-open-drain-pins.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + gpio-max732x-fix-input-configuration-for-open-drain-pins.patch added to -mm tree
@ 2010-04-20 23:52 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2010-04-20 23:52 UTC (permalink / raw)
To: mm-commits; +Cc: maz, eric.y.miao
The patch titled
gpio: max732x: fix input configuration for open-drain pins
has been added to the -mm tree. Its filename is
gpio-max732x-fix-input-configuration-for-open-drain-pins.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: gpio: max732x: fix input configuration for open-drain pins
From: Marc Zyngier <maz@misterjones.org>
Fix a bug I noticed while hacking on the max732x driver for interrupt
support. According to the datasheets, open-drain pins have to be
configured as output-high (which in that case is actually high impedance)
to be used as input.
Signed-off-by: Marc Zyngier <maz@misterjones.org>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/gpio/max732x.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff -puN drivers/gpio/max732x.c~gpio-max732x-fix-input-configuration-for-open-drain-pins drivers/gpio/max732x.c
--- a/drivers/gpio/max732x.c~gpio-max732x-fix-input-configuration-for-open-drain-pins
+++ a/drivers/gpio/max732x.c
@@ -223,15 +223,25 @@ static int max732x_gpio_direction_input(
{
struct max732x_chip *chip;
unsigned int mask = 1u << off;
+ unsigned int is_input;
chip = container_of(gc, struct max732x_chip, gpio_chip);
- if ((mask & chip->dir_input) == 0) {
+ is_input = mask & chip->dir_input;
+
+ if (!is_input) {
dev_dbg(&chip->client->dev, "%s port %d is output only\n",
chip->client->name, off);
return -EACCES;
}
+ /*
+ * Open-drain pins must be set to high impedance (which is
+ * equivalent to output-high) to be turned into an input.
+ */
+ if ((is_input & chip->dir_output))
+ max732x_gpio_set_value(gc, off, 1);
+
return 0;
}
_
Patches currently in -mm which might be from maz@misterjones.org are
linux-next.patch
gpio-add-interrupt-handling-capability-to-max732x.patch
gpio-max732x-fix-input-configuration-for-open-drain-pins.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-23 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-23 18:20 + gpio-max732x-fix-input-configuration-for-open-drain-pins.patch added to -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2010-04-20 23:52 akpm
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.