From patchwork Tue Oct 14 17:54:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Cohen X-Patchwork-Id: 399521 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 7A7CB1400B5 for ; Wed, 15 Oct 2014 04:54:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752873AbaJNRyI (ORCPT ); Tue, 14 Oct 2014 13:54:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:20966 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbaJNRyH (ORCPT ); Tue, 14 Oct 2014 13:54:07 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 14 Oct 2014 10:54:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,718,1406617200"; d="scan'208";a="618574233" Received: from psi-dev26.jf.intel.com ([10.7.199.57]) by orsmga002.jf.intel.com with ESMTP; 14 Oct 2014 10:54:02 -0700 From: David Cohen To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, balbi@ti.com, David Cohen , , Mathias Nyman Subject: [PATCH v2] pinctrl: baytrail: show output gpio state correctly on Intel Baytrail Date: Tue, 14 Oct 2014 10:54:37 -0700 Message-Id: <1413309277-32485-1-git-send-email-david.a.cohen@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1413224639-21552-1-git-send-email-david.a.cohen@linux.intel.com> References: <1413224639-21552-1-git-send-email-david.a.cohen@linux.intel.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Even if a gpio pin is set to output, we still need to set INPUT_EN functionality (by clearing INPUT_EN bit) to be able to read the pin's level. E.g. without this change, we'll always read low level state from sysfs. Cc: # v3.14+ Cc: Mathias Nyman Signed-off-by: David Cohen Reviewed-by: Felipe Balbi --- v1 to v2: improved patch's body description as requested by Felipe Balbi --- drivers/pinctrl/pinctrl-baytrail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index e12e5b07f6d7..c23d8ded936d 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c @@ -318,7 +318,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, "Potential Error: Setting GPIO with direct_irq_en to output"); reg_val = readl(reg) | BYT_DIR_MASK; - reg_val &= ~BYT_OUTPUT_EN; + reg_val &= ~(BYT_OUTPUT_EN | BYT_INPUT_EN); if (value) writel(reg_val | BYT_LEVEL, reg);