Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030309Ab3FTOHH (ORCPT ); Thu, 20 Jun 2013 10:07:07 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:44263 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030294Ab3FTOHD (ORCPT ); Thu, 20 Jun 2013 10:07:03 -0400 From: To: , Linus Walleij Cc: Olivier Clergeaud , Lee Jones , Fabio Baltieri , Patrice Chotard Subject: [PATCH v2 2/4] pinctrl: abx500: fix abx500_gpio_get() Date: Thu, 20 Jun 2013 16:05:43 +0200 Message-Id: <1371737145-27662-3-git-send-email-patrice.chotard.st@gmail.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1371737145-27662-1-git-send-email-patrice.chotard.st@gmail.com> References: <1371737145-27662-1-git-send-email-patrice.chotard.st@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1508 Lines: 49 From: Patrice Chotard _ allow to get output GPIO value _ as there is no GPIO0 on ABX500, use correct offset with abx500_gpio_get_bit() Signed-off-by: Patrice Chotard --- drivers/pinctrl/pinctrl-abx500.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index d1d42e7..5bf66ad 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -162,10 +162,23 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset) { struct abx500_pinctrl *pct = to_abx500_pinctrl(chip); bool bit; + bool is_out; + u8 gpio_offset = offset - 1; int ret; - ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, - offset, &bit); + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, + gpio_offset, &is_out); + if (ret < 0) { + dev_err(pct->dev, "%s failed\n", __func__); + return ret; + } + + if (is_out) + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG, + gpio_offset, &bit); + else + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, + gpio_offset, &bit); if (ret < 0) { dev_err(pct->dev, "%s failed\n", __func__); return ret; -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/