Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3388925ybp; Sun, 6 Oct 2019 10:51:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+IdFlZNDhZpSsDDY3ZNeAhYJJQ/x/hE6kMG3gy43mtT1RS8AiTKMJEWoe1XmQHdzeNeyZ X-Received: by 2002:a17:906:fc2:: with SMTP id c2mr20565164ejk.261.1570384277132; Sun, 06 Oct 2019 10:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384277; cv=none; d=google.com; s=arc-20160816; b=rtkydeYtaJhLv3LaW0vikaNuOIfV2h6fZsODCHIfY+ga2w0faWXa2v7QYYKzm+v2jQ GgzMnUUVqacknW2e6HMdHxR8qWisk3wxxOkswxaIOy2gw0bskgpItziPSLF5cU2CeSKW 8oOIHlaAzbk1heUwaZcjbU0Hc6pSu5fevGVrCsycdv3pPYWF4jL9uV8CyV4jz4vQsUtf oe9XyTqMN57rYCRrUfzmpS+NPMzLIYpVdWflWRIlDdIZoqo5kYSy8qcAztsQNY9z5n3W FtqgAM6VvkD2yFtX8euCPlfjUqyeHMaQFgCDGzFtUFbffziZMBjcTprJRCnCeoJsj+zt +X1w== 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=5lEEOR1SJ7xpqodaS68/qgJXBPGFdVWAcDp8cY+kkvM=; b=O2Ft2Bo/t7po1RT1bH99+Z5A9Ek2v3/pNT/rCm1R3MjcI9HCJLj0FDlivGHoq31/VA y/fdvh2owtN+Pjivs4h/x/38LHBKUD/iG6AsIKaQlXZcYrKWK+Nn4JW9onRZvcTd0iLp Zf+GNceCuu2nZ4KNnIdxr99dj2Dm2WkedYNQeN9Nfk9t9A/WVKoaH5Q09tS3fEvrWJeD Gb+uVpL7fewCEVEFE2CntvipzFKCNTzvzKgKvRkIPxE64OVf916FODui8T78mqARjLvf GIc3I0hGpIhyd4WJnfUl9dCES4YVwvpR+12I6F8R/UNOSv+vW5KhenTEexKEclnflZkc J1aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UByN6hUw; 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 l16si5894393ejx.141.2019.10.06.10.50.53; Sun, 06 Oct 2019 10:51:17 -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=UByN6hUw; 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 S1731284AbfJFRlx (ORCPT + 99 others); Sun, 6 Oct 2019 13:41:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730904AbfJFRjx (ORCPT ); Sun, 6 Oct 2019 13:39:53 -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 CC6F020700; Sun, 6 Oct 2019 17:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383592; bh=/P72MjB8XhN4/ZZi1bmLbv5QAnQz2BwhA6RjE5T6u/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UByN6hUw8+16soSfpBR1tScePHSYCMBpLPc+2ccI9VHDr7gF6N0OY9Gnoukqes24h dM0D5oiCrf8lpMtkuCiyEuuys2YpNHzRvG1sE4GnmhCd38JpKWG+TwWwUUYoe7IaKF 0Pe8rSUoRSc3BxfJ1rL8l654C9x++9QE+tT0OZOM= 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.3 023/166] pinctrl: stmfx: update pinconf settings Date: Sun, 6 Oct 2019 19:19:49 +0200 Message-Id: <20191006171215.115873449@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171212.850660298@linuxfoundation.org> References: <20191006171212.850660298@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 d3332da356372..31b6e511670fc 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