From patchwork Fri Aug 9 07:36:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 170894 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9635450ile; Fri, 9 Aug 2019 00:38:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdfL/2kVZ/xLiOgQ+C86kEd2aqv+hYgn+bELodn2DOUqEYPiiX0y4AitcKvWmYb4xzn+r/ X-Received: by 2002:a63:6a81:: with SMTP id f123mr16538877pgc.348.1565336287743; Fri, 09 Aug 2019 00:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565336287; cv=none; d=google.com; s=arc-20160816; b=mdjlM6R2ZxvocC94+M7FyZ3wxovs/RPWj32yLRk9DaZAc4DvyaYOPbzy6s0AGZMODW kUBlc4OHXX9iiaPeB3c2ctiDXK9pG0+7/mhxmalmI0clPKnesP0Ii/dBpsL93CCTKYfx hHLVBy7w4pD9icpHwTkkTcQZ8ctfUT9qvyt+U26SXtW5KDmKYdUv5a69Ot3lA1cRvtjU /geANdFxQzXFLSVervSlDtB0ovTelIdfqx1dKQRCacwl4Kj/28gW8z8e9lHq5E6OTj5s uYzFKk1AuV5NXDuKhNY9pFjTLqKN2/itmo85NkxNsIEMZ7zvOpUHUGy8JWAq5/BcIX6Q 9dNQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fyF4gnX3NRaR+xyVfVVDVUlh4I78sZ2Zg6UdYHrwaD4=; b=r5AOvioB2TExjekmk7l6EUpsCjvWz7a5cO+cHlmJyoguOaCz/aNcBlxy6RQTaEli6g QnRK+3S4/uXuVeB4/qd1GrgrkaBKpFdu9WBM0ntDLiZDszqwCLTHcwWS8/l3uXFjrydi pw23m9WOTZ/vStuAGEdUPnVuCsK5YeHpzn2hKg9o1KE9KUT3nOy4rjTlJ+YYkc59I6t3 1d4yW68/kJDwvoLuwYW8sMOizA3N2KzHNRRa0eMsBXjytZyABYWDEk4l0Chc/WJdm7OB Hvviq6o2j9tzSKIV1Vq6oM31xjNkP6BA1thFJkEzYvyh9fWR4ODJj+HwUoGCdnALRB/D SVhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tQtyusUq; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si3933295pjw.89.2019.08.09.00.38.07; Fri, 09 Aug 2019 00:38:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=tQtyusUq; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405939AbfHIHiG (ORCPT + 16 others); Fri, 9 Aug 2019 03:38:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725980AbfHIHiF (ORCPT ); Fri, 9 Aug 2019 03:38:05 -0400 Received: from localhost.localdomain (unknown [122.167.65.92]) (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 DD3872173E; Fri, 9 Aug 2019 07:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565336285; bh=O7WQ1zBAJzEuaFnALgFxwTwuUZjx7Kjinzu8wn2fR2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQtyusUqYs3H27n+cSP6KJnTH7/204WF+EfBeR87/9hMXkRLUzXVaPUmHltzakOzZ 6etglwvvDqJ1AbqcTlpP7C9V2gAuybgl27VVStRdMG19LxbTuJp1yjSW8TXxZcbkKP TWGt6ceWMNNGs3BH/LNUuIpVq2coyd4SXLkt35Gs= From: Vinod Koul To: Mark Brown Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , Andy Gross , Liam Girdwood , Rob Herring , Mark Rutland , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 4/4] regulator: qcom-rpmh: Update PMIC modes for PMIC5 Date: Fri, 9 Aug 2019 13:06:16 +0530 Message-Id: <20190809073616.1235-4-vkoul@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190809073616.1235-1-vkoul@kernel.org> References: <20190809073616.1235-1-vkoul@kernel.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add the PMIC5 modes and use them pmic5 ldo and smps Signed-off-by: Vinod Koul --- drivers/regulator/qcom-rpmh-regulator.c | 52 +++++++++++++++++++++---- 1 file changed, 45 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c index 391ed844a251..db6c085da65e 100644 --- a/drivers/regulator/qcom-rpmh-regulator.c +++ b/drivers/regulator/qcom-rpmh-regulator.c @@ -50,6 +50,20 @@ enum rpmh_regulator_type { #define PMIC4_BOB_MODE_AUTO 2 #define PMIC4_BOB_MODE_PWM 3 +#define PMIC5_LDO_MODE_RETENTION 3 +#define PMIC5_LDO_MODE_LPM 4 +#define PMIC5_LDO_MODE_HPM 7 + +#define PMIC5_SMPS_MODE_RETENTION 3 +#define PMIC5_SMPS_MODE_PFM 4 +#define PMIC5_SMPS_MODE_AUTO 6 +#define PMIC5_SMPS_MODE_PWM 7 + +#define PMIC5_BOB_MODE_PASS 2 +#define PMIC5_BOB_MODE_PFM 4 +#define PMIC5_BOB_MODE_AUTO 6 +#define PMIC5_BOB_MODE_PWM 7 + /** * struct rpmh_vreg_hw_data - RPMh regulator hardware configurations * @regulator_type: RPMh accelerator type used to manage this @@ -488,6 +502,14 @@ static const int pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] = { [REGULATOR_MODE_FAST] = -EINVAL, }; +static const int pmic_mode_map_pmic5_ldo[REGULATOR_MODE_STANDBY + 1] = { + [REGULATOR_MODE_INVALID] = -EINVAL, + [REGULATOR_MODE_STANDBY] = PMIC5_LDO_MODE_RETENTION, + [REGULATOR_MODE_IDLE] = PMIC5_LDO_MODE_LPM, + [REGULATOR_MODE_NORMAL] = PMIC5_LDO_MODE_HPM, + [REGULATOR_MODE_FAST] = -EINVAL, +}; + static unsigned int rpmh_regulator_pmic4_ldo_of_map_mode(unsigned int rpmh_mode) { unsigned int mode; @@ -518,6 +540,14 @@ static const int pmic_mode_map_pmic4_smps[REGULATOR_MODE_STANDBY + 1] = { [REGULATOR_MODE_FAST] = PMIC4_SMPS_MODE_PWM, }; +static const int pmic_mode_map_pmic5_smps[REGULATOR_MODE_STANDBY + 1] = { + [REGULATOR_MODE_INVALID] = -EINVAL, + [REGULATOR_MODE_STANDBY] = PMIC5_SMPS_MODE_RETENTION, + [REGULATOR_MODE_IDLE] = PMIC5_SMPS_MODE_PFM, + [REGULATOR_MODE_NORMAL] = PMIC5_SMPS_MODE_AUTO, + [REGULATOR_MODE_FAST] = PMIC5_SMPS_MODE_PWM, +}; + static unsigned int rpmh_regulator_pmic4_smps_of_map_mode(unsigned int rpmh_mode) { @@ -552,6 +582,14 @@ static const int pmic_mode_map_pmic4_bob[REGULATOR_MODE_STANDBY + 1] = { [REGULATOR_MODE_FAST] = PMIC4_BOB_MODE_PWM, }; +static const int pmic_mode_map_pmic5_bob[REGULATOR_MODE_STANDBY + 1] = { + [REGULATOR_MODE_INVALID] = -EINVAL, + [REGULATOR_MODE_STANDBY] = -EINVAL, + [REGULATOR_MODE_IDLE] = PMIC5_BOB_MODE_PFM, + [REGULATOR_MODE_NORMAL] = PMIC5_BOB_MODE_AUTO, + [REGULATOR_MODE_FAST] = PMIC5_BOB_MODE_PWM, +}; + static unsigned int rpmh_regulator_pmic4_bob_of_map_mode(unsigned int rpmh_mode) { unsigned int mode; @@ -643,7 +681,7 @@ static const struct rpmh_vreg_hw_data pmic5_pldo = { .voltage_range = REGULATOR_LINEAR_RANGE(1504000, 0, 255, 8000), .n_voltages = 256, .hpm_min_load_uA = 10000, - .pmic_mode_map = pmic_mode_map_pmic4_ldo, + .pmic_mode_map = pmic_mode_map_pmic5_ldo, .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, }; @@ -653,7 +691,7 @@ static const struct rpmh_vreg_hw_data pmic5_pldo_lv = { .voltage_range = REGULATOR_LINEAR_RANGE(1504000, 0, 62, 8000), .n_voltages = 63, .hpm_min_load_uA = 10000, - .pmic_mode_map = pmic_mode_map_pmic4_ldo, + .pmic_mode_map = pmic_mode_map_pmic5_ldo, .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, }; @@ -663,7 +701,7 @@ static const struct rpmh_vreg_hw_data pmic5_nldo = { .voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 123, 8000), .n_voltages = 124, .hpm_min_load_uA = 30000, - .pmic_mode_map = pmic_mode_map_pmic4_ldo, + .pmic_mode_map = pmic_mode_map_pmic5_ldo, .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, }; @@ -672,7 +710,7 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps510 = { .ops = &rpmh_regulator_vrm_ops, .voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 215, 8000), .n_voltages = 216, - .pmic_mode_map = pmic_mode_map_pmic4_smps, + .pmic_mode_map = pmic_mode_map_pmic5_smps, .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, }; @@ -681,7 +719,7 @@ static const struct rpmh_vreg_hw_data pmic5_ftsmps510 = { .ops = &rpmh_regulator_vrm_ops, .voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 263, 4000), .n_voltages = 264, - .pmic_mode_map = pmic_mode_map_pmic4_smps, + .pmic_mode_map = pmic_mode_map_pmic5_smps, .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, }; @@ -690,7 +728,7 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { .ops = &rpmh_regulator_vrm_ops, .voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 1600), .n_voltages = 5, - .pmic_mode_map = pmic_mode_map_pmic4_smps, + .pmic_mode_map = pmic_mode_map_pmic5_smps, .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, }; @@ -699,7 +737,7 @@ static const struct rpmh_vreg_hw_data pmic5_bob = { .ops = &rpmh_regulator_vrm_bypass_ops, .voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 135, 32000), .n_voltages = 136, - .pmic_mode_map = pmic_mode_map_pmic4_bob, + .pmic_mode_map = pmic_mode_map_pmic5_bob, .of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode, };