From patchwork Tue Mar 31 15:11:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Sierra X-Patchwork-Id: 456651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BE9B41401AF for ; Wed, 1 Apr 2015 02:41:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754503AbbCaPlN (ORCPT ); Tue, 31 Mar 2015 11:41:13 -0400 Received: from xes-mad.com ([216.165.139.218]:33961 "EHLO xes-mad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754586AbbCaPlM (ORCPT ); Tue, 31 Mar 2015 11:41:12 -0400 X-Greylist: delayed 1643 seconds by postgrey-1.27 at vger.kernel.org; Tue, 31 Mar 2015 11:41:12 EDT Received: from zimbra.xes-mad.com (zimbra.xes-mad.com [10.52.0.127]) by xes-mad.com (8.13.8/8.13.8) with ESMTP id t2VFBlPK005145; Tue, 31 Mar 2015 10:11:47 -0500 Date: Tue, 31 Mar 2015 10:11:47 -0500 (CDT) From: Aaron Sierra To: Linus Walleij , Vincent Donnefort , Lee Jones Cc: linux-gpio@vger.kernel.org Message-ID: <1061824414.20722.1427814707516.JavaMail.zimbra@xes-inc.com> In-Reply-To: <1599636860.20707.1427814686822.JavaMail.zimbra@xes-inc.com> Subject: [PATCH] gpio: ich: Implement get_direction function MIME-Version: 1.0 X-Originating-IP: [10.52.16.65] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF35 (Linux)/8.0.6_GA_5922) Thread-Topic: gpio: ich: Implement get_direction function Thread-Index: W0zlOHJ9/Nh4OfJLbAkVrotvvURsoA== Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Allow the kernel to query the driver for a GPIO's pin direction. Signed-off-by: Aaron Sierra --- drivers/gpio/gpio-ich.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c index 7818cd1..4ba7ed5 100644 --- a/drivers/gpio/gpio-ich.c +++ b/drivers/gpio/gpio-ich.c @@ -173,6 +173,11 @@ static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) return !!(ichx_priv.use_gpio & (1 << (nr / 32))); } +static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr) +{ + return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT; +} + static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { /* @@ -286,6 +291,7 @@ static void ichx_gpiolib_setup(struct gpio_chip *chip) ichx_priv.desc->get : ichx_gpio_get; chip->set = ichx_gpio_set; + chip->get_direction = ichx_gpio_get_direction; chip->direction_input = ichx_gpio_direction_input; chip->direction_output = ichx_gpio_direction_output; chip->base = modparam_gpiobase;