From patchwork Thu Jun 23 09:46:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 584250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361DDCCA481 for ; Thu, 23 Jun 2022 09:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbiFWJqp (ORCPT ); Thu, 23 Jun 2022 05:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231259AbiFWJqk (ORCPT ); Thu, 23 Jun 2022 05:46:40 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB10D4993C; Thu, 23 Jun 2022 02:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rnBbkQy2L0V7vBcp8pSKVvSDrlQ1RJzOEZhug24jamc=; b=LXPmSKlf9B7PYFcaWRrKfIVTUM bkhGQWsAHgBIl0xWK5DfmTsWjmXzUEgxXS59uwJwlDPPBBeNx1V3X9PUvCUHOnVbE5BXhcObGfpVB NAcu7z1JPxILcjItyLLCusivbbP2x+ppbL36dSfpYUqtxUawTaJeH0ycCUxtj6pTpCAxDp6wifEyD 6UJcW6cCH3wZjFMTn6WUIH+UHzVYMM4Mcuk/CFST1RXZmmAKbAHWpbuXYc76sntIxoYWPJmfUjqSC tAOEZHQak0OS3FA5yOLp44A0aRGFk2JqF+JFAPcwuQVH4kgp2uDcRyv7Ayw7kfI4/SXymTORNp+Gs cfXOIhMw==; Received: from [10.22.3.24] (helo=kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1o4JQ0-005qg2-7B; Thu, 23 Jun 2022 11:46:32 +0200 From: Stephan Gerhold To: Mark Brown Cc: Bjorn Andersson , Andy Gross , Liam Girdwood , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold Subject: [PATCH 1/3] regulator: qcom_smd: Fix pm8916_pldo range Date: Thu, 23 Jun 2022 11:46:12 +0200 Message-Id: <20220623094614.1410180-2-stephan.gerhold@kernkonzept.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> References: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The PM8916 device specification [1] documents a programmable range of 1.75V to 3.337V with 12.5mV steps for the PMOS LDOs in PM8916. This range is also used when controlling the regulator directly using the qcom_spmi-regulator driver ("ult_pldo" there). However, for some reason the qcom_smd-regulator driver allows a much larger range for the same hardware component. This could be simply a typo, since the start of the range is essentially just missing a '1'. In practice this does not cause any major problems, since the driver just sends the actual voltage to the RPM firmware instead of making use of the incorrect voltage selector. Still, having the wrong range there is confusing and prevents the regulator core from validating requests correctly. [1]: https://developer.qualcomm.com/download/sd410/pm8916pm8916-1-power-management-ic-device-specification.pdf Fixes: 57d6567680ed ("regulator: qcom-smd: Add PM8916 support") Signed-off-by: Stephan Gerhold --- drivers/regulator/qcom_smd-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 4051d5fa9df9..8b2d884cd693 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -358,10 +358,10 @@ static const struct regulator_desc pm8941_switch = { static const struct regulator_desc pm8916_pldo = { .linear_ranges = (struct linear_range[]) { - REGULATOR_LINEAR_RANGE(750000, 0, 208, 12500), + REGULATOR_LINEAR_RANGE(1750000, 0, 127, 12500), }, .n_linear_ranges = 1, - .n_voltages = 209, + .n_voltages = 128, .ops = &rpm_smps_ldo_ops, }; From patchwork Thu Jun 23 09:46:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 584951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC2FCCA480 for ; Thu, 23 Jun 2022 09:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiFWJqo (ORCPT ); Thu, 23 Jun 2022 05:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbiFWJqk (ORCPT ); Thu, 23 Jun 2022 05:46:40 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AAC49925; Thu, 23 Jun 2022 02:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IQ3Xf3SVicxiqe6CbASmgF2tTElLTO5CpJ3b3KI9gXU=; b=BwCRwbSbyOiTVsbPtSCZaY9U4k li8ptFTla2r30QfcCPT3WUjKPIGNoQDa4h1wlrppt6c65fc4ylV8hL3IVvLA8qErr2ltZTHyr7Jrl KQeB9Ij2aBJVGoqRGn+bH6kY6VnfYFjyVrbbLSGBzDxP5rBrpf4R1n3EjwSeiVntSC+yPk/wK6Ho5 OJeWisYaqVqhzMj7Rh3DyoRkKWjla8iDU+qZMYhhuTlWHH8qBLhTQG+PHhxETrhmJaSfJ8SILgjAT Qetkj2RmGglXPOkGd3PpOLg8e/HNFEjgya5PnyiQtW24u0fNLnR89abFHOXpaCc6l00TfeRiYb8om CqETklPQ==; Received: from [10.22.3.24] (helo=kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1o4JQ1-005qg2-M5; Thu, 23 Jun 2022 11:46:33 +0200 From: Stephan Gerhold To: Mark Brown Cc: Bjorn Andersson , Andy Gross , Liam Girdwood , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold Subject: [PATCH 2/3] regulator: dt-bindings: qcom,smd-rpm: Add PM8909 Date: Thu, 23 Jun 2022 11:46:13 +0200 Message-Id: <20220623094614.1410180-3-stephan.gerhold@kernkonzept.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> References: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document the "qcom,rpm-pm8909-regulators" compatible for describing the regulators available in the PM8909 PMIC (controlled via the RPM firmware). PM8909 is very similar to the existing PM8916 but lacks 3 of the regulators (s3, s4 and l16). Signed-off-by: Stephan Gerhold --- .../devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml index 6a9a7eed466f..c233461cc980 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml @@ -30,6 +30,9 @@ description: For pm8841, s1, s2, s3, s4, s5, s6, s7, s8 + For pm8909, s1, s2, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, + l14, l15, l17, l18 + For pm8916, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18 @@ -78,6 +81,7 @@ properties: - qcom,rpm-mp5496-regulators - qcom,rpm-pm8226-regulators - qcom,rpm-pm8841-regulators + - qcom,rpm-pm8909-regulators - qcom,rpm-pm8916-regulators - qcom,rpm-pm8941-regulators - qcom,rpm-pm8950-regulators From patchwork Thu Jun 23 09:46:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 584249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B25BCCA483 for ; Thu, 23 Jun 2022 09:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbiFWJqq (ORCPT ); Thu, 23 Jun 2022 05:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbiFWJqk (ORCPT ); Thu, 23 Jun 2022 05:46:40 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 928AF49B40; Thu, 23 Jun 2022 02:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WHVNOWKI6E4FR1UMwztSAeuKd9LQg2I0ttlKUhNAPeg=; b=qsHXnbhy3QNW19LAuOZaQS0pxp hCrtuLX6IuZ+Ne0SWUYA7xhYqipshJ6U+jSclsywEWnSweaIvbGDCTcvY3M/AGCXA8CkX2/KpMZmw wySHztja7GIlfTs53jEWFF0vcGprWGbUIqbmjafa4q7F067xRTzUG6zL0UqfLVloNg4RNTeillQfD LAtwNCq8hweGAzNmOPFkzVA7P2TeSXPVMvy9mLmutMv4+6ghAYuXVKc+X3toE8lgODWWMrVlaaqYf tP4eIKhphPsmu8OEBp103Suo5QRRPohGxA5N9MhVNfLtXJKEoklQqIO0RQzXtY+TDFBFGME4/AD4u 25g9p/3w==; Received: from [10.22.3.24] (helo=kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1o4JQ3-005qg2-3h; Thu, 23 Jun 2022 11:46:35 +0200 From: Stephan Gerhold To: Mark Brown Cc: Bjorn Andersson , Andy Gross , Liam Girdwood , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold Subject: [PATCH 3/3] regulator: qcom_smd: Add PM8909 RPM regulators Date: Thu, 23 Jun 2022 11:46:14 +0200 Message-Id: <20220623094614.1410180-4-stephan.gerhold@kernkonzept.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> References: <20220623094614.1410180-1-stephan.gerhold@kernkonzept.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The set of regulators available in the PM8909 PMIC is similar to PM8916 which is already supported by the driver. s3, s4 and l16 are missing. However, probing the SPMI hardware identification registers using the qcom_spmi-regulator driver reveals that the regulators in PM8909 are actually some kind of mixture between PM8916 and PM8226: - ult_lo_smps (= pm8916_buck_lvo_smps): s1 - ult_ho_smps (= pm8916_buck_hvo_smps): s2 - ult_nldo (= pm8916_nldo): l1, l2, l3, l10 - ult_pldo (= pm8916_pldo): l4, l8, l9, l12-l15, l17, l18 - pldo (= pm8226_pldo): l5, l6, l7, l11 Use this mapping to add the rpm_regulator_data for PM8909 by reusing the existing regulator definitions. Signed-off-by: Stephan Gerhold --- drivers/regulator/qcom_smd-regulator.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 8b2d884cd693..59024c639141 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -784,6 +784,29 @@ static const struct rpm_regulator_data rpm_pm8841_regulators[] = { {} }; +static const struct rpm_regulator_data rpm_pm8909_regulators[] = { + { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" }, + { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_hvo_smps, "vdd_s2" }, + { "l1", QCOM_SMD_RPM_LDOA, 1, &pm8916_nldo, "vdd_l1" }, + { "l2", QCOM_SMD_RPM_LDOA, 2, &pm8916_nldo, "vdd_l2_l5" }, + { "l3", QCOM_SMD_RPM_LDOA, 3, &pm8916_nldo, "vdd_l3_l6_l10" }, + { "l4", QCOM_SMD_RPM_LDOA, 4, &pm8916_pldo, "vdd_l4_l7" }, + { "l5", QCOM_SMD_RPM_LDOA, 5, &pm8226_pldo, "vdd_l2_l5" }, + { "l6", QCOM_SMD_RPM_LDOA, 6, &pm8226_pldo, "vdd_l3_l6_l10" }, + { "l7", QCOM_SMD_RPM_LDOA, 7, &pm8226_pldo, "vdd_l4_l7" }, + { "l8", QCOM_SMD_RPM_LDOA, 8, &pm8916_pldo, "vdd_l8_l11_l15_l18" }, + { "l9", QCOM_SMD_RPM_LDOA, 9, &pm8916_pldo, "vdd_l9_l12_l14_l17" }, + { "l10", QCOM_SMD_RPM_LDOA, 10, &pm8916_nldo, "vdd_l3_l6_l10" }, + { "l11", QCOM_SMD_RPM_LDOA, 11, &pm8226_pldo, "vdd_l8_l11_l15_l18" }, + { "l12", QCOM_SMD_RPM_LDOA, 12, &pm8916_pldo, "vdd_l9_l12_l14_l17" }, + { "l13", QCOM_SMD_RPM_LDOA, 13, &pm8916_pldo, "vdd_l13" }, + { "l14", QCOM_SMD_RPM_LDOA, 14, &pm8916_pldo, "vdd_l9_l12_l14_l17" }, + { "l15", QCOM_SMD_RPM_LDOA, 15, &pm8916_pldo, "vdd_l8_l11_l15_l18" }, + { "l17", QCOM_SMD_RPM_LDOA, 17, &pm8916_pldo, "vdd_l9_l12_l14_l17" }, + { "l18", QCOM_SMD_RPM_LDOA, 18, &pm8916_pldo, "vdd_l8_l11_l15_l18" }, + {} +}; + static const struct rpm_regulator_data rpm_pm8916_regulators[] = { { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" }, { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_lvo_smps, "vdd_s2" }, @@ -1222,6 +1245,7 @@ static const struct rpm_regulator_data rpm_pm2250_regulators[] = { static const struct of_device_id rpm_of_match[] = { { .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators }, { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators }, + { .compatible = "qcom,rpm-pm8909-regulators", .data = &rpm_pm8909_regulators }, { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators }, { .compatible = "qcom,rpm-pm8226-regulators", .data = &rpm_pm8226_regulators }, { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators },