From patchwork Thu Apr 28 12:34:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66893 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp187421qge; Thu, 28 Apr 2016 05:34:32 -0700 (PDT) X-Received: by 10.66.119.177 with SMTP id kv17mr20242079pab.124.1461846872408; Thu, 28 Apr 2016 05:34:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si10158165pfb.21.2016.04.28.05.34.32; Thu, 28 Apr 2016 05:34:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbcD1MeT (ORCPT + 4 others); Thu, 28 Apr 2016 08:34:19 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:35930 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502AbcD1MeS (ORCPT ); Thu, 28 Apr 2016 08:34:18 -0400 Received: by mail-lf0-f45.google.com with SMTP id u64so82301811lff.3 for ; Thu, 28 Apr 2016 05:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8exjwp0KoTulzEtrsBcpnchmzombAFGw317PyS9yAT4=; b=GzKVYHUpj9PwBUHiJ+BUUcCOzeoxKNbI1st22pNQbU/S+D5adXlJnF+ZGksJXNNIxT Nk3sVJUcrPUdRo96cN8/csBdcvI/meBgST2/fxe8t2dZxJc2k2rBxqFsLT85jflFiagH P/jqC62Z+gf/zOVAXJzDYr8YXmCdrEvQ0KwRY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8exjwp0KoTulzEtrsBcpnchmzombAFGw317PyS9yAT4=; b=mXMU6f3RRhXGGB6uJZOHhagv+hkpn+IbMrOVW6eT2RP32lKzoyTajIMWaVzkwCQ75B Ug6+YMvt8g7nWWF8ag+ubBoM22sfCR2H7suqoh7b8fusZw520BM+JmtF8ECfQURgxeRa KKfJkVS7hAtlPEtctJg/4gUXKW9DWNIrUumv8I78RqNfL3JtHyJL5GFVbz20RqtL0aYo Wsy5ETud+xG7yjLTENe5Y2Bn79cKR4LetW6AUZY/Qbu7Ulo4LPEbCPUy0UeiCKr2DgQP SJIN4EHRejT6bdlLfc22rsNKI7VqfwtRv8oxuYSqzTMr4U8OheWIpGVeC7/esZyfuZgJ 8IVQ== X-Gm-Message-State: AOPr4FX7AV5xB3z14Z377ae4gRenVndIPHr1ekm137udhzAWnTsErhQD3yJ2rOZJAqjdcloz X-Received: by 10.25.169.144 with SMTP id s138mr6117754lfe.108.1461846856351; Thu, 28 Apr 2016 05:34:16 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e185sm1689486lfg.45.2016.04.28.05.34.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 05:34:15 -0700 (PDT) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2] pinctrl: nomadik: implement .get_direction() Date: Thu, 28 Apr 2016 14:34:09 +0200 Message-Id: <1461846849-30311-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.11 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the Nomadik gpiochip support the .get_direction() callback. Signed-off-by: Linus Walleij --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.4.11 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index a121c0c06234..76a08b96cc67 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -861,6 +861,20 @@ static void nmk_gpio_latent_irq_handler(struct irq_desc *desc) /* I/O Functions */ +static int nmk_gpio_get_dir(struct gpio_chip *chip, unsigned offset) +{ + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); + int dir; + + clk_enable(nmk_chip->clk); + + dir = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset)); + + clk_disable(nmk_chip->clk); + + return dir; +} + static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) { struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); @@ -1220,6 +1234,7 @@ static int nmk_gpio_probe(struct platform_device *dev) chip = &nmk_chip->chip; chip->request = gpiochip_generic_request; chip->free = gpiochip_generic_free; + chip->get_direction = nmk_gpio_get_dir; chip->direction_input = nmk_gpio_make_input; chip->get = nmk_gpio_get_input; chip->direction_output = nmk_gpio_make_output;