* [RFT][PATCH] pinctrl: msm: Fix set gpio setting
@ 2013-12-13 13:35 Axel Lin
2013-12-20 9:14 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-12-13 13:35 UTC (permalink / raw)
To: Linus Walleij; +Cc: Bjorn Andersson, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFT][PATCH] pinctrl: msm: Fix set gpio setting
2013-12-13 13:35 [RFT][PATCH] pinctrl: msm: Fix set gpio setting Axel Lin
@ 2013-12-20 9:14 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2013-12-20 9:14 UTC (permalink / raw)
To: Axel Lin; +Cc: Bjorn Andersson, linux-kernel@vger.kernel.org
On Fri, Dec 13, 2013 at 2:35 PM, Axel Lin <axel.lin@ingics.com> wrote:
> 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.
I've tentatively applied this as Björn is busy right now, and I got a
sort-of-ack over IRC. If it turns out to be problematic we can revisit
this later.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-20 9:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13 13:35 [RFT][PATCH] pinctrl: msm: Fix set gpio setting Axel Lin
2013-12-20 9:14 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox