Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3381056ybp; Sun, 6 Oct 2019 10:40:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhl2ov+q00vuerBIL36f+zGjSuP+Isy7Gor81CSlLOSTyXgfLyP6JPJDLGE1+Q63YcMFrS X-Received: by 2002:a50:9250:: with SMTP id j16mr25801421eda.160.1570383633412; Sun, 06 Oct 2019 10:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383633; cv=none; d=google.com; s=arc-20160816; b=YkuHboZxLKbuGf5Pvec775mmbLDUgKngYv6Alea+WTYIkbxSYANMe0foZvYNWjrI1c YcZS7w0afvM12U+ps8hAAj4xDiTJqqNSU29DzacSx4rSvgmvStkGUOcepUYj8saBscYE Yl65WDM8xjqIfsK5T+MDbLsFVJI61mLX4HarC292A+LzN4L7Rb9D3JZcE2fH9trcZcfT JJdiM305wihO+ZhGpgRRbhAVOBSrHBrGl1usEFmdMkSzkONdhZ3InJEmhBkQnhBhc52r IR7vsjot0H/dNBlFHEmnkj4H6IY8VtZmr7cFOEeZ0q/XZZWeX4MKvLicKM6lENXcttLi 85vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6ziAQpVqemP4EuGb63b1ScsYUw2/1+vn9qpgqpKzg78=; b=NWmpdQS0TYrmK+lU+KDCWMHdvnJX+4ZZU4uJ/ngfgGazK5Mx4dUb+XTzGNKDDk/Hln YLLiPva9ERZZ552Fhjw8s4uHki7hgHG44B1HvGs4uIzkbVVgFHmKYRbZssK8mSdCzo3w WY7j7VOsnQSqxb4cdpb/sl0c1ytOBNhJyG4iys5Kg/fh4Mi/yxc75FPBwqPgZM1keoFt qlK7cdAsVB5ARqnMFJCM0xXzI8+dGu9tadPlWTywsO2ARFpa3cHc5ezRgSzBXd3KlRJW ohxk/tItWmo+DoeTBnfNtlqIcDvKOj9E119w5aQGf9Dh0a+WPlrKvSI+luItyi6owsSq EpUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SPsyPDyT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si5581202ejg.30.2019.10.06.10.40.09; Sun, 06 Oct 2019 10:40:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SPsyPDyT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730290AbfJFRga (ORCPT + 99 others); Sun, 6 Oct 2019 13:36:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:35258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729639AbfJFRg2 (ORCPT ); Sun, 6 Oct 2019 13:36:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4055920700; Sun, 6 Oct 2019 17:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383386; bh=Xhdwc27crQh8QWKhbFFcu+WZDtv79dO+TPMXSEimq/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPsyPDyToZ4BpL8/IIxhQwxsF5rI0qfSZTygmCjdJh1ecmyT0Tny0dsaJ3VxS/jd+ RZKohjyZiPjvOOHNM566HyEByvpKFZnCJLL9PKgiCIqiOkDFUoHJ4fmH9jq0qJ3M3N PcLsjT8PLKWZVd1EbvP79emtOO6+SF+FaQmRDpc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Torgue , Amelie Delaunay , Linus Walleij , Sasha Levin Subject: [PATCH 5.2 041/137] pinctrl: stmfx: update pinconf settings Date: Sun, 6 Oct 2019 19:20:25 +0200 Message-Id: <20191006171212.422419325@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171209.403038733@linuxfoundation.org> References: <20191006171209.403038733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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