From patchwork Sun May 1 08:32:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66982 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp531336qge; Sun, 1 May 2016 01:32:23 -0700 (PDT) X-Received: by 10.98.10.136 with SMTP id 8mr42866648pfk.67.1462091543564; Sun, 01 May 2016 01:32:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dz4si13963156pab.12.2016.05.01.01.32.23; Sun, 01 May 2016 01:32:23 -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 S1750892AbcEAIcW (ORCPT + 4 others); Sun, 1 May 2016 04:32:22 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:33276 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbcEAIcT (ORCPT ); Sun, 1 May 2016 04:32:19 -0400 Received: by mail-lf0-f41.google.com with SMTP id y84so159353306lfc.0 for ; Sun, 01 May 2016 01:32:18 -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=O9Mcflv2ak8ID1Fo/kiNKg40W1mmktF+8jFkDSPjS/U=; b=K8RSrRkBPkjL8xPe/Fel6VBjrvkLjj/50llrXwMlBvh/D+UuERdS0HEjW/MQ/EIGBv ZrF1NXAw8XkulriFz02aaOpd2wq/JMJvBGekZrSoxBgE4DaEVP/Jc1xbH6FCD7T7I8JS DTGu84vRT86HRli0nsjXBt7xBO1jACoV8hWMk= 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=O9Mcflv2ak8ID1Fo/kiNKg40W1mmktF+8jFkDSPjS/U=; b=mlGvf+4qtcAT1jBoZhmz9IfL0N2NWEKnwyugrQvwYdnVf25ORWn8wVbdKpA0DqbvRU 7Gm0g/fWXcbAcAgQsm9GlHjdjo8rpXh8D8SCGQdyy5BIeSt/nNvcVACHC94sEQeo4emw 9Cp7lbq3KH4qncpnqN12lLwME1q0+EHGUu1G59cZTA8g5cxEFPS7wSRgVuN82zGBxFcc tAtV/Ay+8Lz/m3gC2U//Ed9xFGRVS7hmuL2Jevx78khS9QdZez/U0AeKR+8HLUew8PYb wY3QUW1NggYAoMuvaHi+DNRl34jvKVh9EGrSuHWnI1z9RsoNFeLSbx8doEZ7d7/LDm5T ue0Q== X-Gm-Message-State: AOPr4FU3qjOzUfMirFYlVzCDqZrdTIFLdguLp5xOst2s4rTIYh4zfCpNiCToB70s/TcXkkjU X-Received: by 10.112.84.202 with SMTP id b10mr12055540lbz.41.1462091537053; Sun, 01 May 2016 01:32:17 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-927b71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.123.146]) by smtp.gmail.com with ESMTPSA id l21sm3448309lfi.37.2016.05.01.01.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 May 2016 01:32:16 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Duc Dang , Feng Kan Subject: [PATCH] gpio: xgene: implement .get_direction() Date: Sun, 1 May 2016 10:32:10 +0200 Message-Id: <1462091530-27288-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 implements the .get_direction() callback for the xgene GPIO controller. Cc: Duc Dang Cc: Feng Kan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-xgene.c | 12 ++++++++++++ 1 file changed, 12 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/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c index 46faecd1f580..dc85dcd47d19 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -85,6 +85,17 @@ static void xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) spin_unlock_irqrestore(&chip->lock, flags); } +static int xgene_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) +{ + struct xgene_gpio *chip = gpiochip_get_data(gc); + unsigned long bank_offset, bit_offset; + + bank_offset = GPIO_SET_DR_OFFSET + GPIO_BANK_OFFSET(offset); + bit_offset = GPIO_BIT_OFFSET(offset); + + return !!(ioread32(chip->base + bank_offset) & BIT(bit_offset)); +} + static int xgene_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) { struct xgene_gpio *chip = gpiochip_get_data(gc); @@ -184,6 +195,7 @@ static int xgene_gpio_probe(struct platform_device *pdev) spin_lock_init(&gpio->lock); gpio->chip.parent = &pdev->dev; + gpio->chip.get_direction = xgene_gpio_get_direction; gpio->chip.direction_input = xgene_gpio_dir_in; gpio->chip.direction_output = xgene_gpio_dir_out; gpio->chip.get = xgene_gpio_get;