From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFBAC432C1 for ; Tue, 24 Sep 2019 16:59:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE1F62054F for ; Tue, 24 Sep 2019 16:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569344399; bh=Xhdwc27crQh8QWKhbFFcu+WZDtv79dO+TPMXSEimq/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p45slzNW2Iv3Sj8Ke/iLjhB3uSIUfQuD14devKzGyzxdU2lRTYP7R/kFzuGTRVWLQ iSxpNFPiUR1dyCm0Z9g8GEMcMlAFls3mRLEb8vVKp+k74qdePO3wHp6B93VaM/mmtq 4X/RUmokcfzwvE3/rvmgfK2pAyqj5VAJ25e9lv/o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407246AbfIXQ7z (ORCPT ); Tue, 24 Sep 2019 12:59:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:37220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633217AbfIXQqc (ORCPT ); Tue, 24 Sep 2019 12:46:32 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0812222BF; Tue, 24 Sep 2019 16:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569343591; bh=Xhdwc27crQh8QWKhbFFcu+WZDtv79dO+TPMXSEimq/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkZmzkhmOE9nDkSdm1H6yiV9YA3fmgmYajSsbOnunIRYXYxas8OkXau8fdn+vpVUo QAtt0nEUsEYwHT2+qHJ2WvRZ6Fln2IOUrLBi49nJ7PBtUbk3Fgju1xwkqb2tQYBzvp EWK4dwA+CV6snt/3xDmTM8iah4Si7KuWRaCRsIG0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexandre Torgue , Amelie Delaunay , Linus Walleij , Sasha Levin , linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 18/70] pinctrl: stmfx: update pinconf settings Date: Tue, 24 Sep 2019 12:44:57 -0400 Message-Id: <20190924164549.27058-18-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190924164549.27058-1-sashal@kernel.org> References: <20190924164549.27058-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Alexandre Torgue [ Upstream commit a502b343ebd0eab38f3cb33fbb84011847cf5aac ] According to the following tab (coming from STMFX datasheet), updates have to done in stmfx_pinconf_set function: -"type" has to be set when "bias" is configured as "pull-up or pull-down" -PIN_CONFIG_DRIVE_PUSH_PULL should only be used when gpio is configured as output. There is so no need to check direction. DIR | TYPE | PUPD | MFX GPIO configuration ----|------|------|--------------------------------------------------- 1 | 1 | 1 | OUTPUT open drain with internal pull-up resistor ----|------|------|--------------------------------------------------- 1 | 1 | 0 | OUTPUT open drain with internal pull-down resistor ----|------|------|--------------------------------------------------- 1 | 0 | 0/1 | OUTPUT push pull no pull ----|------|------|--------------------------------------------------- 0 | 1 | 1 | INPUT with internal pull-up resistor ----|------|------|--------------------------------------------------- 0 | 1 | 0 | INPUT with internal pull-down resistor ----|------|------|--------------------------------------------------- 0 | 0 | 1 | INPUT floating ----|------|------|--------------------------------------------------- 0 | 0 | 0 | analog (GPIO not used, default setting) Signed-off-by: Alexandre Torgue Signed-off-by: Amelie Delaunay Link: https://lore.kernel.org/r/1564053416-32192-1-git-send-email-amelie.delaunay@st.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/pinctrl-stmfx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index eba872ce4a7cb..c82ad4b629e3e 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -296,29 +296,29 @@ static int stmfx_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, switch (param) { case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: case PIN_CONFIG_BIAS_DISABLE: + case PIN_CONFIG_DRIVE_PUSH_PULL: + ret = stmfx_pinconf_set_type(pctl, pin, 0); + if (ret) + return ret; + break; case PIN_CONFIG_BIAS_PULL_DOWN: + ret = stmfx_pinconf_set_type(pctl, pin, 1); + if (ret) + return ret; ret = stmfx_pinconf_set_pupd(pctl, pin, 0); if (ret) return ret; break; case PIN_CONFIG_BIAS_PULL_UP: - ret = stmfx_pinconf_set_pupd(pctl, pin, 1); + ret = stmfx_pinconf_set_type(pctl, pin, 1); if (ret) return ret; - break; - case PIN_CONFIG_DRIVE_OPEN_DRAIN: - if (!dir) - ret = stmfx_pinconf_set_type(pctl, pin, 1); - else - ret = stmfx_pinconf_set_type(pctl, pin, 0); + ret = stmfx_pinconf_set_pupd(pctl, pin, 1); if (ret) return ret; break; - case PIN_CONFIG_DRIVE_PUSH_PULL: - if (!dir) - ret = stmfx_pinconf_set_type(pctl, pin, 0); - else - ret = stmfx_pinconf_set_type(pctl, pin, 1); + case PIN_CONFIG_DRIVE_OPEN_DRAIN: + ret = stmfx_pinconf_set_type(pctl, pin, 1); if (ret) return ret; break; -- 2.20.1