From patchwork Thu Dec 12 06:34:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 1208182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47YPD657ygz9sP6 for ; Thu, 12 Dec 2019 17:34:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726994AbfLLGep (ORCPT ); Thu, 12 Dec 2019 01:34:45 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:38388 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfLLGep (ORCPT ); Thu, 12 Dec 2019 01:34:45 -0500 Received: by mail-lj1-f195.google.com with SMTP id k8so943546ljh.5; Wed, 11 Dec 2019 22:34:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XaT0mQSTPp24MN650YkdiQloudL58RSz/+EV4tv1Bu0=; b=Xmi21QiKn2zDCH3nS0Zm4YeUh9HrZZkzEjVw7sqJBzN8Vta/LkpDDzg/4dxMsmxgxf SootWIVqbNE0dmcARSzXdu57r3cAFQ+kwhXT9yszEhhyPFsuF+o6qdSvBO4keGXi91rj Zo7qnHZ3xMAZLVnZ1XZ5aNY7F3IAn3SVa094tQmmjZSLazJWJmd8MPeZaIUGenFFg7I3 MJOtOUJBj38p2xrVUg5kHov0VW/axClh9DBlvBlX0Igik2HXhhYJFgVRolqEqH/X/JvT 7l4E4EOzv0bO908sn9/aPfqSKaWVpl+yI+xhPV3s7KQL0aMJQGktsnMU/CqJQEQzLu0F zTFg== X-Gm-Message-State: APjAAAUcIlM0L3syxoOZOpQHSH3n+qhiEra/EHcqhJAPCR1txUteFqcs RNweAwvaaI0Nv+humcCMTD0= X-Google-Smtp-Source: APXvYqwOjuTEwNQ0dlVXsI9sM9pSrkSPqnROfMb5KG1Nc5TKGJETF5upONj4y3FqsuHzHQvG5SSQmA== X-Received: by 2002:a2e:850f:: with SMTP id j15mr4689740lji.91.1576132483670; Wed, 11 Dec 2019 22:34:43 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id z9sm2330605ljm.40.2019.12.11.22.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 22:34:43 -0800 (PST) Date: Thu, 12 Dec 2019 08:34:32 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Message-ID: <2cd75bd04932d076708fae87d8b003778d876a1c.1576132131.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when returning GPIO direction to GPIO framework. Signed-off-by: Matti Vaittinen --- drivers/pinctrl/intel/pinctrl-intel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 4860bc9a4e48..2ba2ad8a55d9 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -944,7 +944,10 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) if (padcfg0 & PADCFG0_PMODE_MASK) return -EINVAL; - return !!(padcfg0 & PADCFG0_GPIOTXDIS); + if (padcfg0 & PADCFG0_GPIOTXDIS) + return GPIO_LINE_DIRECTION_IN; + + return GPIO_LINE_DIRECTION_OUT; } static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) From patchwork Thu Dec 12 06:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 1208183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47YPF41Ybfz9sP6 for ; Thu, 12 Dec 2019 17:35:36 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727954AbfLLGff (ORCPT ); Thu, 12 Dec 2019 01:35:35 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39551 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfLLGff (ORCPT ); Thu, 12 Dec 2019 01:35:35 -0500 Received: by mail-lf1-f68.google.com with SMTP id y1so783777lfb.6; Wed, 11 Dec 2019 22:35:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Hm/O+8iLvUpIN7zAOCeaNWnmTVwhDTl6QvgdqsBbH9s=; b=XAB6FCv57L78E1iIGJ3IPdh2HaaT9PQsoGjUozln9qScCDvV6N/geOkA6AtgR63e3B axPYgz2FHbyBADNSRy26XJIS9gfm4BR0fViIjzyFUX3jaYTGAntmmKhAkzIz0mAG4TyK 4utbaDAmotmhzsqZmLOcDemhiLMMi6upOBLfBh0fh+FzDbjXF0A7iZtbsxTL/r4X3J0e 3cAkSf9Y1mIMYq+Y7+HNsabFml55sdRtXTFBHuYD8jK8ipvWVBS3Mv5svebZh2Nal+Rq zajh1wHYaB7hp+SclkuzkI8Am1OaxZcLbN2TIK6lA+1res3cLeWFBz0EJjTcHigbFHC+ RGbQ== X-Gm-Message-State: APjAAAVUKcifNd3ai/ayjDGrNafLMIwcMRIVZtOB+VtkkRMj4lZbV/ni KmsqCGdkYTgYzuJoCbOyOAw= X-Google-Smtp-Source: APXvYqxNi8/Kpm3AwGj2j1bDb7P73QrEP+IeNBj1OPWrAiPOaK6R7yE1YE1kwHflhH2bYr5VImshIw== X-Received: by 2002:ac2:5ec3:: with SMTP id d3mr4584538lfq.176.1576132532549; Wed, 11 Dec 2019 22:35:32 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id m15sm2414125ljg.4.2019.12.11.22.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 22:35:32 -0800 (PST) Date: Thu, 12 Dec 2019 08:35:19 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] pinctrl: pinctrl-cherryview: Use GPIO direction definitions Message-ID: <78255e34b3542b57955565bcf1b518b1369dd541.1576132131.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when returning GPIO direction to GPIO framework. Signed-off-by: Matti Vaittinen --- drivers/pinctrl/intel/pinctrl-cherryview.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 582fa8a75559..7f049c17fce3 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c @@ -1287,7 +1287,10 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) direction = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK; direction >>= CHV_PADCTRL0_GPIOCFG_SHIFT; - return direction != CHV_PADCTRL0_GPIOCFG_GPO; + if (direction == CHV_PADCTRL0_GPIOCFG_GPO) + return GPIO_LINE_DIRECTION_OUT; + + return GPIO_LINE_DIRECTION_IN; } static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) From patchwork Thu Dec 12 06:35:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 1208184 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47YPFg4fXrz9sPL for ; Thu, 12 Dec 2019 17:36:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbfLLGgG (ORCPT ); Thu, 12 Dec 2019 01:36:06 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45067 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfLLGgG (ORCPT ); Thu, 12 Dec 2019 01:36:06 -0500 Received: by mail-lf1-f67.google.com with SMTP id 203so761975lfa.12; Wed, 11 Dec 2019 22:36:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=52GRzE2LrbCdRaFMXkD1n/FkbMFyp9p/ZmIw21up4vE=; b=q6OcrcVbM+A8DdWsv/LtCELRpSeU42vPkQgKnJ/M2pOZ0HDcjCXD718U0LlvWWXOUx 1eyiWiDaNNKPY8vYZ1pyiPwqA2sYGpMLPAle7uCH9DW0satUTOT2+OId42aRuiZHzjs/ XHWWryGHfVTXm+dk++Hwd1NsriObguFrFGrFjK74FSNl6R+ZfhGM4p5CGuxIY8GZRayr 14+GVMVEp99iBrRykFgw8PVV89AyBCv1BVz52iePzqEltDhXM7XWgfKYxZQj2YjO2fZy P/rApNBpCQL0FX5Dy91JVO7RTFXnMj2B6QESKoQtUqbIlBzJiCjEDtk5Ii0Oob+WwdlR oL6g== X-Gm-Message-State: APjAAAXFoEBZrgq2kyj6QQzJSR3CnB0Nq4ZBIxCn0ZGafMV7d/cjxths PMCv90es4/gaX84KPJ5RQg4= X-Google-Smtp-Source: APXvYqwxxrMCCWuOBCo0HRT3e+PdDzA5S9WWiy6/6joBzScC56EHuKPoH87AL6B09DWxdgKbyvDxDg== X-Received: by 2002:a19:4351:: with SMTP id m17mr4754990lfj.61.1576132564072; Wed, 11 Dec 2019 22:36:04 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id q25sm2381778lji.7.2019.12.11.22.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 22:36:03 -0800 (PST) Date: Thu, 12 Dec 2019 08:35:52 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] pinctrl: pinctrl-baytrail: Use GPIO direction definitions Message-ID: <0e8c584bff32da970510201b504e43a84a340cae.1576132131.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when returning GPIO direction to GPIO framework. Signed-off-by: Matti Vaittinen Acked-by: Andy Shevchenko --- drivers/pinctrl/intel/pinctrl-baytrail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 9ffb22211d2b..362276ad5640 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1160,9 +1160,9 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) raw_spin_unlock_irqrestore(&vg->lock, flags); if (!(value & BYT_OUTPUT_EN)) - return 0; + return GPIO_LINE_DIRECTION_OUT; if (!(value & BYT_INPUT_EN)) - return 1; + return GPIO_LINE_DIRECTION_IN; return -EINVAL; }