Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3485966imu; Sun, 11 Nov 2018 16:10:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dyx7zMRe1bDf1CSiFSJO7cjU645C7o/uvRW/kpQcizF5nMQ92L+p5zrQlAYpeoEECSCHDL X-Received: by 2002:a17:902:9b83:: with SMTP id y3-v6mr17473045plp.113.1541981454634; Sun, 11 Nov 2018 16:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981454; cv=none; d=google.com; s=arc-20160816; b=jKE+PoBUD/00AFABnx+NRsROHxs7OF4nTorT2XKHNw8jhEox0v2/Jz2/b1oX5Rmb9K k+m/+PjrNVugXC9udQdm9fNSVxhFqQO+RoOcJccPZPa1tYscwMr61/uHJfK8cVs1e0eu +r5RGqsolF6SdkQsjWi6IMOC1EgC52FJ6oDQcBXsqAcxRkK2gibhYIx3g1j7MP4SDn9r bzlpyTJnuPA6ApYmNwRI4ZNq06ejB9dhYsl+q0jGYiGI+7kgB/2F20XzyHcA/fXn7Far acYWVCutGEE1JnitjLLOINcSY3ofDBXuCpNHSvgK+jXTMDkxr5M9yVrgyUW4Nl02W6EK EPZw== 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=SSXIDFWs54YBdQ1lMWuy5Mkhe8TChq3XTcG0onyZiJE=; b=zua4cxTgA/RQkz1KmIEtX5Z08lH20Z+PzCKooIU0YHLW72MMyoTL7zv7gAaUtkZ7EO 6wqztjRk850BDORga4C06NvkM62tGI9IgjnwELsKPGobDTC07WsDl9lcxsoJpzvwMSan g0UphWGbx5drMUdbm5n9eMFpJ1n/oEUuTXSgeOrk66vyIcLUPlMjKsyA0JFSSmL3FoM/ aODeywBCTjK4uTUKYSfAK5Jmp5IYYcGUpErOFdQ/PZt4fDFCy7Z57eACuepdNczbb2Pk ZXgVjYYmxqANh7l5m444w0YPfKXPsp7woD3PKvb+TY8VCYG0NrEKQWKe/X+vA9NYO1Hl 5SWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JUO8midi; 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 h3si15152663pgi.391.2018.11.11.16.10.39; Sun, 11 Nov 2018 16:10:54 -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=JUO8midi; 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 S1730905AbeKLIR0 (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:60776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730853AbeKLIRZ (ORCPT ); Mon, 12 Nov 2018 03:17:25 -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 C2A67223D1; Sun, 11 Nov 2018 22:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975249; bh=ySV5hknkJoihsIZ1rPQ1oSqwy8vOt4AxqOBGC1ktzmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUO8midi+B/4Fe7Fo30Lox6lxh33c86OTTmakHr+7sEfS82hF1i6iSrNautWMA4pg jo6U030AkHp7KXdOvd9HvIToXPWqXALZSw3WkMacLxpEItjLHJCdqAdyxVGQnbqFHR zE7zUrvZ0Kje1KxJEs7yR5a/VUNGBPQHItwQwlyk= 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.19 112/361] pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant Date: Sun, 11 Nov 2018 14:17:39 -0800 Message-Id: <20181111221635.508820618@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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;