From patchwork Thu Apr 28 12:36:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66896 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp188295qge; Thu, 28 Apr 2016 05:36:14 -0700 (PDT) X-Received: by 10.98.38.130 with SMTP id m124mr20224852pfm.14.1461846974064; Thu, 28 Apr 2016 05:36:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si15945816pas.37.2016.04.28.05.36.13; Thu, 28 Apr 2016 05:36:14 -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 S1752541AbcD1MgL (ORCPT + 4 others); Thu, 28 Apr 2016 08:36:11 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:34334 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbcD1MgJ (ORCPT ); Thu, 28 Apr 2016 08:36:09 -0400 Received: by mail-lf0-f41.google.com with SMTP id j11so93332643lfb.1 for ; Thu, 28 Apr 2016 05:36:08 -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=zAjBAWjYdIq6zrg+5EFH5i9grFp1FA7CVGunAJrAmg8=; b=QOPinVOGBKYM8JbY6lrtN2z/kvTYBYmY/sNhUNDFYNVgZ8s4X+43+Bj7/J9vBsVstb fsoip4wCaA1guw4z8fHPtxlBdfRdn/+mZI0elDayvmJLVz2ICEcOXBDTD44dSEdDyNvu RZm8vw3MoYlD4ao9rYZ71u8NGwGdDooJ3iAWA= 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=zAjBAWjYdIq6zrg+5EFH5i9grFp1FA7CVGunAJrAmg8=; b=gx+xDn4XWE0X6dPxLxPkGtOrbi31u+6Zf4UUu3MsoZBw0FWnlAXmQETEZo1Erm9Vcl GjfaLNcjiuZqQEJwW5UQhDVIiEyDOJRBV+ZavCHZCclbjUp24jyx8MApUJVnIIAwtvpx 1wCzCy0U96hgiF++q+1QhFPRof09N30pGRp6k5g9fqLdDtSz3BpKHjermb+a3CzKS2Uu dm9dy3k7eOxwfM+dQQumda2+cYI43A/eS/mtI6Oq5LILesReeTOWWntSDAu46lEiEe7z 9Dk3MGjFlBYtQ9SU0qouKifRf+XFlRNSqty3hrPEljM5o/hfkFHEtX34szSpkBSuf8cT jflQ== X-Gm-Message-State: AOPr4FWHVsAJW2gmiryKQYJgs5aV3qf1lOeQhuUgKk/t59FsU7wlnQE6Biea/tCabywhXeHz X-Received: by 10.25.32.213 with SMTP id g204mr6012737lfg.119.1461846967651; Thu, 28 Apr 2016 05:36:07 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v4sm1677514lbi.20.2016.04.28.05.36.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 05:36:07 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij Subject: [PATCH 2/2] gpio: pl061: implement .get_direction() Date: Thu, 28 Apr 2016 14:36:04 +0200 Message-Id: <1461846964-30854-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 Implement this callback so that the driver reports correctly the direction setting of each line. Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pl061.c | 8 ++++++++ 1 file changed, 8 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-pl061.c b/drivers/gpio/gpio-pl061.c index 70eb9ada002e..6e3c1430616f 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -61,6 +61,13 @@ struct pl061_gpio { #endif }; +static int pl061_get_direction(struct gpio_chip *gc, unsigned offset) +{ + struct pl061_gpio *chip = gpiochip_get_data(gc); + + return !(readb(chip->base + GPIODIR) & BIT(offset)); +} + static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) { struct pl061_gpio *chip = gpiochip_get_data(gc); @@ -315,6 +322,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) chip->gc.free = gpiochip_generic_free; } + chip->gc.get_direction = pl061_get_direction; chip->gc.direction_input = pl061_direction_input; chip->gc.direction_output = pl061_direction_output; chip->gc.get = pl061_get_value;