Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3433708imu; Sun, 11 Nov 2018 15:01:26 -0800 (PST) X-Google-Smtp-Source: AJdET5fe8RwcYKe8vMCDj/wUlXh5uYFky2DAWccuaT3f6PIpvE7LowA1EVtzYfwnO9cbitJuELb3 X-Received: by 2002:a62:8c93:: with SMTP id m141-v6mr17565997pfd.239.1541977286031; Sun, 11 Nov 2018 15:01:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977286; cv=none; d=google.com; s=arc-20160816; b=yyx3F26NjLHfsdJe1kbcrVPFF5jse7TgBUSd0pNtQEyXvPpLUkUhdgB4qGjrkAXrQ4 T2pEkvtSnlHMci0saiXA0uV4sY+M6s2hBjZHUEwUIb9BlUfu0eYjG3fBhO0LjlZcrPDZ CUKrkFqPmax9xJr/ilVN8Nbpu5DdrJR7ShGMoGDPVbvLPUGJXIIagcZcGiTBX3vZqjAw 9opWhtxOHubTyXMTW40f2OTc9DnQFFeOHYmQFGKCZvOX3SphYkbJhSzPN+rSXlnloaLp cr3lRY5bKDuiQHYYmtETZW8XWQb7rMlT/xWfabjOmfuNedGBEi6Vf570FPDD1h9HZFkb jytA== 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=eGu/R58j/uz0R6kqrzyYMZhDFTkqsP3lo5VAdl8T63A=; b=tIy2TkOroFjHP+sYTT3/CaKqv6Hi2kMn1I4k5e32tl2TENwL+kBSF52B0f/uZOSwKt wFttnwqpzurLR2UhUllTlu/Yt8PhXkR4k9cM8cYOIrkqbz3ooC8AoJ+aLYZy83vRqgA6 7+5esV8hZgmN9jI2Ys72o6Y0MWaEH117AKWMscX958G7E3thAq6nK5ZKXLxsbL+Dhd3v RwdIersJSBhn1aqtjquK6Gih6m9k/hmKPGYdFclaOJAbFdWLt0eR1annXGeevzr8tN8b Ykt4J4SL+dWbeQ+cLO+joLH79rlub5noCtUvj1+/I6feQA+uxtIy5yir4KsieljROJTG u76g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kqnJDjI8; 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 o186-v6si17376926pfo.236.2018.11.11.15.01.11; Sun, 11 Nov 2018 15:01:26 -0800 (PST) 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=kqnJDjI8; 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 S2390702AbeKLIWc (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:52394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390677AbeKLIWc (ORCPT ); Mon, 12 Nov 2018 03:22:32 -0500 Received: from localhost (unknown [206.108.79.134]) (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 9C03E223C8; Sun, 11 Nov 2018 22:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975554; bh=0Yl7/V5hDVqfi2l9EzheY7KZA8YlQPPZ7aHdpbOr6r8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqnJDjI8mbkceMx+3WsXx8MGVSOhLPx2bEZ6028PbxgGS74pWcAsvg0S/Ytd5zyk/ J/SlIkde1YTFDUF8kw5OiSAYHRbVXoGR/4tThBsCUFtYJ3MlkJo+sWOAGdDwuau2o/ k5fTgKsd7VcmRB13i3jpPKmwVtOvtoJtuYGrC+WU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Stephen Boyd , Bjorn Andersson , Linus Walleij , Sasha Levin Subject: [PATCH 4.14 069/222] pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant Date: Sun, 11 Nov 2018 14:22:46 -0800 Message-Id: <20181111221654.093491964@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Douglas Anderson [ Upstream commit 0d5b476f8f57fcb06c45fe27681ac47254f63fd2 ] If you look at "pinconf-groups" in debugfs for ssbi-mpp you'll notice it looks like nonsense. The problem is fairly well described in commit 1cf86bc21257 ("pinctrl: qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant") and commit 05e0c828955c ("pinctrl: msm: Fix msm_config_group_get() to be compliant"), but it was pointed out that ssbi-mpp has the same problem. Let's fix it there too. NOTE: in case it's helpful to someone reading this, the way to tell whether to do the -EINVAL or not is to look at the PCONFDUMP for a given attribute. If the last element (has_arg) is false then you need to do the -EINVAL trick. ALSO NOTE: it seems unlikely that the values returned when we try to get PIN_CONFIG_BIAS_PULL_UP will actually be printed since "has_arg" is false for that one, but I guess it's still fine to return different values so I kept doing that. It seems like another driver (ssbi-gpio) uses a custom attribute (PM8XXX_QCOM_PULL_UP_STRENGTH) for something similar so maybe a future change should do that here too. Fixes: cfb24f6ebd38 ("pinctrl: Qualcomm SPMI PMIC MPP pin controller driver") Signed-off-by: Douglas Anderson Reviewed-by: Stephen Boyd Reviewed-by: Bjorn Andersson Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c @@ -345,13 +345,12 @@ static int pmic_mpp_config_get(struct pi switch (param) { case PIN_CONFIG_BIAS_DISABLE: - arg = pad->pullup == PMIC_MPP_PULL_UP_OPEN; + if (pad->pullup != PMIC_MPP_PULL_UP_OPEN) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_PULL_UP: switch (pad->pullup) { - case PMIC_MPP_PULL_UP_OPEN: - arg = 0; - break; case PMIC_MPP_PULL_UP_0P6KOHM: arg = 600; break; @@ -366,13 +365,17 @@ static int pmic_mpp_config_get(struct pi } break; case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: - arg = !pad->is_enabled; + if (pad->is_enabled) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_POWER_SOURCE: arg = pad->power_source; break; case PIN_CONFIG_INPUT_ENABLE: - arg = pad->input_enabled; + if (!pad->input_enabled) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_OUTPUT: arg = pad->out_value; @@ -384,7 +387,9 @@ static int pmic_mpp_config_get(struct pi arg = pad->amux_input; break; case PMIC_MPP_CONF_PAIRED: - arg = pad->paired; + if (!pad->paired) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_DRIVE_STRENGTH: arg = pad->drive_strength;