From: Axel Lin <axel.lin@ingics.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>,
linux-kernel@vger.kernel.org
Subject: [RFT][PATCH] pinctrl: msm: Fix set gpio setting
Date: Fri, 13 Dec 2013 21:35:55 +0800 [thread overview]
Message-ID: <1386941755.17095.2.camel@phoenix> (raw)
Set g->out_bit bit for gpio output high, clear g->out_bit bit for gpio output
low.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Bjorn,
I don't have the datasheet, just found current code does not make sense
because current code unconditionally set BIT(g->out_bit) in msm_gpio_set.
I assume setting g->out_bit bit for gpio output high, clear the bit
for gpio output low.
Please check if this patch is correct.
Thanks,
Axel
drivers/pinctrl/pinctrl-msm.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c
index 28b90ab..4537d0d 100644
--- a/drivers/pinctrl/pinctrl-msm.c
+++ b/drivers/pinctrl/pinctrl-msm.c
@@ -435,7 +435,12 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in
spin_lock_irqsave(&pctrl->lock, flags);
- writel(value ? BIT(g->out_bit) : 0, pctrl->regs + g->io_reg);
+ val = readl(pctrl->regs + g->io_reg);
+ if (value)
+ val |= BIT(g->out_bit);
+ else
+ val &= ~BIT(g->out_bit);
+ writel(val, pctrl->regs + g->io_reg);
val = readl(pctrl->regs + g->ctl_reg);
val |= BIT(g->oe_bit);
@@ -476,7 +481,10 @@ static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
spin_lock_irqsave(&pctrl->lock, flags);
val = readl(pctrl->regs + g->io_reg);
- val |= BIT(g->out_bit);
+ if (value)
+ val |= BIT(g->out_bit);
+ else
+ val &= ~BIT(g->out_bit);
writel(val, pctrl->regs + g->io_reg);
spin_unlock_irqrestore(&pctrl->lock, flags);
--
1.8.1.2
next reply other threads:[~2013-12-13 13:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 13:35 Axel Lin [this message]
2013-12-20 9:14 ` [RFT][PATCH] pinctrl: msm: Fix set gpio setting Linus Walleij
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=1386941755.17095.2.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=bjorn.andersson@sonymobile.com \
--cc=linus.walleij@linaro.org \
--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