From patchwork Mon Feb 17 16:57:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 3664091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17098BF13A for ; Mon, 17 Feb 2014 17:02:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48E6520115 for ; Mon, 17 Feb 2014 17:02:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6190920200 for ; Mon, 17 Feb 2014 17:02:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFRYD-000356-78; Mon, 17 Feb 2014 17:00:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFRXc-0004lX-RC; Mon, 17 Feb 2014 16:59:36 +0000 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFRWa-0004dX-Cn for linux-arm-kernel@lists.infradead.org; Mon, 17 Feb 2014 16:58:42 +0000 Received: by mail-we0-f172.google.com with SMTP id u56so917329wes.3 for ; Mon, 17 Feb 2014 08:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cl8ByKVECsE7XwScED3uo9SENkGVwP6QMWjAGpEi7aY=; b=IKaGv3HwYONnASqqdt/C/02tq+CuprcpI6u+icdXrG0alQsfdD6fnHVoffGdp7JWxQ zQgWCnvgeKBvUIDSxl1/5VJclUtzzwgI07wk+CIhnZP5HLdkTn/yJ376p0dVkDJU3Dd1 Q0DFyY69TklnR7LgL6sR4Z/ryJYwOogJ9GQqnH//AL5Tk7UQWzFJkdHbU775Ielh5RMW b6pm7eXXAC/LJCi+awbv8hHtxnPOfkJm4peqWs/8M9O0F4Z1dofe0cNDC8YfG6ZY1zMM vr8HUdMdDBv8zxSH8c+MFOP8xWR4NyVDYDUd/r6x7nccQDwxg2AMUsHHlNBpfG5kYveQ DlyQ== X-Received: by 10.180.149.206 with SMTP id uc14mr14272322wib.10.1392656290697; Mon, 17 Feb 2014 08:58:10 -0800 (PST) Received: from lnx-rg.pr (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPSA id cm5sm33980500wid.5.2014.02.17.08.58.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Feb 2014 08:58:09 -0800 (PST) From: Richard Genoud To: Greg Kroah-Hartman Subject: [PATCH v3 6/7] pinctrl: at91: implement get_direction Date: Mon, 17 Feb 2014 17:57:26 +0100 Message-Id: <1392656247-3351-7-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1392656247-3351-1-git-send-email-richard.genoud@gmail.com> References: <1392656247-3351-1-git-send-email-richard.genoud@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140217_115832_735559_EF840506 X-CRM114-Status: GOOD ( 10.06 ) X-Spam-Score: -2.0 (--) Cc: Alexander Shiyan , Richard Genoud , Linus Walleij , Nicolas Ferre , linux-serial@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is needed for gpiod_get_direction(). Otherwise, it returns -EINVAL. Signed-off-by: Richard Genoud Acked-by: Linus Walleij --- drivers/pinctrl/pinctrl-at91.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index d990e33d8aa7..9bd18fdc604a 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1137,6 +1137,17 @@ static void at91_gpio_free(struct gpio_chip *chip, unsigned offset) pinctrl_free_gpio(gpio); } +static int at91_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +{ + struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); + void __iomem *pio = at91_gpio->regbase; + unsigned mask = 1 << offset; + u32 osr; + + osr = readl_relaxed(pio + PIO_OSR); + return !(osr & mask); +} + static int at91_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); @@ -1543,6 +1554,7 @@ static int at91_gpio_of_irq_setup(struct device_node *node, static struct gpio_chip at91_gpio_template = { .request = at91_gpio_request, .free = at91_gpio_free, + .get_direction = at91_gpio_get_direction, .direction_input = at91_gpio_direction_input, .get = at91_gpio_get, .direction_output = at91_gpio_direction_output,