From: Venkat Reddy Talla <vreddytalla@nvidia.com>
To: linus.walleij@linaro.org, gnurou@gmail.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ldewangan@nvidia.com, vreddytalla@nvidia.com
Subject: [PATCH 1/1] gpio: max77620: get gpio value based on direction
Date: Mon, 27 Jun 2016 16:26:24 +0530 [thread overview]
Message-ID: <1467024984-28138-1-git-send-email-vreddytalla@nvidia.com> (raw)
Gpio direction is determined by DIRx bit of GPIO
configuration register, return max77620 gpio value
based on direction in or out.
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
---
drivers/gpio/gpio-max77620.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 8658c32..b46b436 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -123,7 +123,10 @@ static int max77620_gpio_get(struct gpio_chip *gc, unsigned int offset)
return ret;
}
- return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
+ if (val & MAX77620_CNFG_GPIO_DIR_MASK)
+ return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
+ else
+ return !!(val & MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK);
}
static int max77620_gpio_dir_output(struct gpio_chip *gc, unsigned int offset,
--
2.1.4
next reply other threads:[~2016-06-27 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 10:56 Venkat Reddy Talla [this message]
2016-06-29 5:08 ` [PATCH 1/1] gpio: max77620: get gpio value based on direction Alexandre Courbot
2016-07-04 9:40 ` 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=1467024984-28138-1-git-send-email-vreddytalla@nvidia.com \
--to=vreddytalla@nvidia.com \
--cc=gnurou@gmail.com \
--cc=ldewangan@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).