From: Marc Zyngier <maz@misterjones.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Miao <eric.y.miao@gmail.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpio: max732x: fix input configuration for open-drain pins
Date: Fri, 23 Apr 2010 15:37:43 +0200 [thread overview]
Message-ID: <53798eb0b7ee483000fcd94fb76af377@localhost> (raw)
In-Reply-To: <20100420165148.49711c3c.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
On Tue, 20 Apr 2010 16:51:48 -0700, Andrew Morton
<akpm@linux-foundation.org> wrote:
>> On Tue, 16 Mar 2010 10:19:00 +0100
>
> I bet you thought I'd forgotten.
Naaaah... I trust your memory more than mine... ;-)
> You really did mean `&' here, but one very much expects a variable
> called is_foo to be a boolean, and booleans want `&&'.
Actually, the attached patch is a much simpler solution to this particular
one. We already checked that the pin is input-capable. Use the same mask to
check that the pin is also output-capable, and thus open-drain. No need for
an additional variable.
Thanks,
M.
--
Who you jivin' with that Cosmik Debris?
[-- Attachment #2: 0001-gpio-max732x-fix-input-configuration-for-open-drain-.patch --]
[-- Type: text/plain, Size: 1154 bytes --]
From 3ff7ff7f13145a6a46ffa2e0cc350bee1f120577 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@misterjones.org>
Date: Fri, 23 Apr 2010 12:25:53 +0100
Subject: [PATCH] gpio: max732x: fix input configuration for open-drain pins
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>
---
drivers/gpio/max732x.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c
index f786824..ad6a80b 100644
--- a/drivers/gpio/max732x.c
+++ b/drivers/gpio/max732x.c
@@ -188,6 +188,13 @@ static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned 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 ((mask & chip->dir_output))
+ max732x_gpio_set_value(gc, off, 1);
+
return 0;
}
--
1.7.0.4
prev parent reply other threads:[~2010-04-23 13:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 9:19 [PATCH] gpio: max732x: fix input configuration for open-drain pins Marc Zyngier
2010-04-15 13:10 ` Eric Miao
2010-04-20 23:51 ` Andrew Morton
2010-04-23 13:37 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53798eb0b7ee483000fcd94fb76af377@localhost \
--to=maz@misterjones.org \
--cc=akpm@linux-foundation.org \
--cc=eric.y.miao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox