From patchwork Fri Jun 24 09:18:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 640100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wm0-x23b.google.com (mail-wm0-x23b.google.com [IPv6:2a00:1450:400c:c09::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rbXn923KLz9t1N for ; Fri, 24 Jun 2016 19:18:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=ihteA395; dkim-atps=neutral Received: by mail-wm0-x23b.google.com with SMTP id a66sf4657120wme.0 for ; Fri, 24 Jun 2016 02:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=XcKUeENhJt4ggJNMuDsqwuNKZI9a+bedDgmfDbA0plo=; b=ihteA3956bJQvBLSE23ybuZcWcTvlgn4x/7W8RVJmeXYd8LgsBiby45pfFoWmI2MqY gK+lZnFpiZ3OuQLlE4qychJuOtZZWRoX7wwEmPnIMF4ZWo1OwsRpU0Jd/hNiGav+fRS4 6tcoOY4ouyNEdtGdAoRddIY0dRUON6ZXnN1YOOH5unt6uqfEQyZ8v0pCrmCn7q94edle LXtz9s7Uak9DgIh5/JKt75wmfVGDzVE3VjOp6jCSkU1hjxzQL73SCIoLWY0vjQLSirUP 1fNrckr7WLyFg5ZTvMrdrBUp7YLbfNRyqmtsGGk5NtdwpERcyByDDLynjI4kRYtkv8w2 K4FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=XcKUeENhJt4ggJNMuDsqwuNKZI9a+bedDgmfDbA0plo=; b=cnIunB8G2G7vDvmlWRFk1/pZU2M9NXJbQcmAMzdD8ctblYzlbVabkP22uZw+YNAzA/ alH9v++CUlQt/HxD8D3fTz8SJz7i5NORDjbg/awPtYJ/bBzeUa1gutuaD29PbTcvT69q DjECQCVfpGvL978XZiyl651nYerKNT0TLXgvlgpAh0nvNE4cd0zDvnfmUbb9+g81Q0k3 7zpmlBDeV7j62WWPWUWkjKDkXDTC2yS1jLqgUEgBvTgDtUvKqWvVtSjOnIKh1GuSn2C6 BF99x8gwMxZAnXuLsPu18vAr0i9h8AqXK+OhaWkAXspeoDJjN1STfiAKOK67+YVO7IN/ SF/g== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: ALyK8tJY+70kacdpNpfGx3KeDga3ACcwKNmDy2O1L8JkAPufP2s1ZRuv2bSWazAJ6OawYw== X-Received: by 10.25.91.198 with SMTP id p189mr14255lfb.4.1466759899054; Fri, 24 Jun 2016 02:18:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.46.71.79 with SMTP id u76ls488933lja.22.gmail; Fri, 24 Jun 2016 02:18:18 -0700 (PDT) X-Received: by 10.25.86.130 with SMTP id k124mr553191lfb.6.1466759898695; Fri, 24 Jun 2016 02:18:18 -0700 (PDT) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com. [2a00:1450:400c:c09::232]) by gmr-mx.google.com with ESMTPS id f138si95464wmf.3.2016.06.24.02.18.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 02:18:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning narmstrong@baylibre.com does not designate 2a00:1450:400c:c09::232 as permitted sender) client-ip=2a00:1450:400c:c09::232; Received: by mail-wm0-x232.google.com with SMTP id r201so16677956wme.1 for ; Fri, 24 Jun 2016 02:18:18 -0700 (PDT) X-Received: by 10.28.60.5 with SMTP id j5mr5117961wma.26.1466759898407; Fri, 24 Jun 2016 02:18:18 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id i74sm2145466wmg.21.2016.06.24.02.18.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Jun 2016 02:18:17 -0700 (PDT) From: Neil Armstrong To: dmitry.torokhov@gmail.com, andy.gross@linaro.org, david.brown@linaro.org, lee.jones@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, a.zummo@towertech.it, alexandre.belloni@free-electrons.com Cc: Neil Armstrong , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH v2 5/5] regulator: qcom_rpm-regulator: Add support for pm8018 rpm regulator Date: Fri, 24 Jun 2016 11:18:07 +0200 Message-Id: <1466759887-25394-6-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466759887-25394-1-git-send-email-narmstrong@baylibre.com> References: <1466759887-25394-1-git-send-email-narmstrong@baylibre.com> X-Original-Sender: narmstrong@baylibre.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com; spf=softfail (google.com: domain of transitioning narmstrong@baylibre.com does not designate 2a00:1450:400c:c09::232 as permitted sender) smtp.mailfrom=narmstrong@baylibre.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , In order to support eh Qualcomm MDM9615 SoC, add support for the PM8018 RPM regulator in the qcom_rpm-regulator driver. Signed-off-by: Neil Armstrong Acked-by: Mark Brown --- Documentation/devicetree/bindings/mfd/qcom-rpm.txt | 14 +++ drivers/regulator/qcom_rpm-regulator.c | 100 +++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/qcom-rpm.txt b/Documentation/devicetree/bindings/mfd/qcom-rpm.txt index 72d68d4..485bc59 100644 --- a/Documentation/devicetree/bindings/mfd/qcom-rpm.txt +++ b/Documentation/devicetree/bindings/mfd/qcom-rpm.txt @@ -60,6 +60,7 @@ Regulator nodes are identified by their compatible: "qcom,rpm-pm8058-regulators" "qcom,rpm-pm8901-regulators" "qcom,rpm-pm8921-regulators" + "qcom,rpm-pm8018-regulators" - vdd_l0_l1_lvs-supply: - vdd_l2_l11_l12-supply: @@ -138,6 +139,15 @@ Regulator nodes are identified by their compatible: Definition: reference to regulator supplying the input pin, as described in the data sheet +- vin_lvs1-supply: +- vdd_l7-supply: +- vdd_l8-supply: +- vdd_l9_l10_l11_l12-supply: + Usage: optional (pm8018 only) + Value type: + Definition: reference to regulator supplying the input pin, as + described in the data sheet + The regulator node houses sub-nodes for each regulator within the device. Each sub-node is identified using the node's name, with valid values listed for each of the pmics below. @@ -157,6 +167,10 @@ pm8921: l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch, ncp +pm8018: + s1, s2, s3, s4, s5, , l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, + l12, l14, lvs1 + The content of each sub-node is defined by the standard binding for regulators - see regulator.txt - with additional custom properties described below: diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c index e254272..0734a5f 100644 --- a/drivers/regulator/qcom_rpm-regulator.c +++ b/drivers/regulator/qcom_rpm-regulator.c @@ -70,6 +70,40 @@ struct qcom_rpm_reg { bool supports_force_mode_bypass; }; +static struct rpm_reg_parts rpm8018_ldo_parts = { + .request_len = 2, + .uV = { 0, 0x007FFFFF, 0}, + .pd = { 0, 0x00800000, 23}, + .pc = { 0, 0x0F000000, 24}, + .pf = { 0, 0xF0000000, 28}, + .ip = { 1, 0x000003FF, 0}, + .ia = { 1, 0x000FFC00, 10}, + .fm = { 1, 0x00700000, 20}, +}; + +static struct rpm_reg_parts rpm8018_smps_parts = { + .request_len = 2, + .uV = { 0, 0x007FFFFF, 0}, + .pd = { 0, 0x00800000, 23}, + .pc = { 0, 0x0F000000, 24}, + .pf = { 0, 0xF0000000, 28}, + .ip = { 1, 0x000003FF, 0}, + .ia = { 1, 0x000FFC00, 10}, + .fm = { 1, 0x00700000, 20}, + .pm = { 1, 0x00800000, 23}, + .freq = { 1, 0x1F000000, 24}, + .freq_clk_src = { 1, 0x60000000, 29}, +}; + +static struct rpm_reg_parts rpm8018_switch_parts = { + .request_len = 1, + .enable_state = { 0, 0x00000001, 0}, + .pd = { 0, 0x00000002, 1}, + .pc = { 0, 0x0000003C, 2}, + .pf = { 0, 0x000003C0, 6}, + .hpm = { 0, 0x00000C00, 10}, +}; + static const struct rpm_reg_parts rpm8660_ldo_parts = { .request_len = 2, .mV = { 0, 0x00000FFF, 0 }, @@ -448,6 +482,44 @@ static struct regulator_ops switch_ops = { }; /* + * PM8018 regulators + */ +static const struct qcom_rpm_reg pm8018_pldo = { + .desc.linear_ranges = pldo_ranges, + .desc.n_linear_ranges = ARRAY_SIZE(pldo_ranges), + .desc.n_voltages = 161, + .desc.ops = &uV_ops, + .parts = &rpm8018_ldo_parts, + .supports_force_mode_auto = false, + .supports_force_mode_bypass = false, +}; + +static const struct qcom_rpm_reg pm8018_nldo = { + .desc.linear_ranges = nldo_ranges, + .desc.n_linear_ranges = ARRAY_SIZE(nldo_ranges), + .desc.n_voltages = 64, + .desc.ops = &uV_ops, + .parts = &rpm8018_ldo_parts, + .supports_force_mode_auto = false, + .supports_force_mode_bypass = false, +}; + +static const struct qcom_rpm_reg pm8018_smps = { + .desc.linear_ranges = smps_ranges, + .desc.n_linear_ranges = ARRAY_SIZE(smps_ranges), + .desc.n_voltages = 154, + .desc.ops = &uV_ops, + .parts = &rpm8018_smps_parts, + .supports_force_mode_auto = false, + .supports_force_mode_bypass = false, +}; + +static const struct qcom_rpm_reg pm8018_switch = { + .desc.ops = &switch_ops, + .parts = &rpm8018_switch_parts, +}; + +/* * PM8058 regulators */ static const struct qcom_rpm_reg pm8058_pldo = { @@ -755,6 +827,32 @@ struct rpm_regulator_data { const char *supply; }; +static const struct rpm_regulator_data rpm_pm8018_regulators[] = { + { "s1", QCOM_RPM_PM8018_SMPS1, &pm8018_smps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8018_SMPS2, &pm8018_smps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8018_SMPS3, &pm8018_smps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8018_SMPS4, &pm8018_smps, "vdd_s4" }, + { "s5", QCOM_RPM_PM8018_SMPS5, &pm8018_smps, "vdd_s5" }, + + { "l2", QCOM_RPM_PM8018_LDO2, &pm8018_pldo, "vdd_l2" }, + { "l3", QCOM_RPM_PM8018_LDO3, &pm8018_pldo, "vdd_l3" }, + { "l4", QCOM_RPM_PM8018_LDO4, &pm8018_pldo, "vdd_l4" }, + { "l5", QCOM_RPM_PM8018_LDO5, &pm8018_pldo, "vdd_l5" }, + { "l6", QCOM_RPM_PM8018_LDO6, &pm8018_pldo, "vdd_l7" }, + { "l7", QCOM_RPM_PM8018_LDO7, &pm8018_pldo, "vdd_l7" }, + { "l8", QCOM_RPM_PM8018_LDO8, &pm8018_nldo, "vdd_l8" }, + { "l9", QCOM_RPM_PM8018_LDO9, &pm8921_nldo1200, + "vdd_l9_l10_l11_l12" }, + { "l10", QCOM_RPM_PM8018_LDO10, &pm8018_nldo, "vdd_l9_l10_l11_l12" }, + { "l11", QCOM_RPM_PM8018_LDO11, &pm8018_nldo, "vdd_l9_l10_l11_l12" }, + { "l12", QCOM_RPM_PM8018_LDO12, &pm8018_nldo, "vdd_l9_l10_l11_l12" }, + { "l14", QCOM_RPM_PM8018_LDO14, &pm8018_pldo, "vdd_l14" }, + + { "lvs1", QCOM_RPM_PM8018_LVS1, &pm8018_switch, "lvs1_in" }, + + { } +}; + static const struct rpm_regulator_data rpm_pm8058_regulators[] = { { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, @@ -870,6 +968,8 @@ static const struct rpm_regulator_data rpm_pm8921_regulators[] = { }; static const struct of_device_id rpm_of_match[] = { + { .compatible = "qcom,rpm-pm8018-regulators", + .data = &rpm_pm8018_regulators }, { .compatible = "qcom,rpm-pm8058-regulators", .data = &rpm_pm8058_regulators }, { .compatible = "qcom,rpm-pm8901-regulators", .data = &rpm_pm8901_regulators }, { .compatible = "qcom,rpm-pm8921-regulators", .data = &rpm_pm8921_regulators },