Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3729748rdb; Sun, 10 Dec 2023 19:17:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtjnfeZEpHkI16ePItUOceGC3BD86BSpG2InfB2BExkV3rZwUeL4N0lg4QLnhZRDkIz2+0 X-Received: by 2002:a17:902:7d8a:b0:1d0:9471:808d with SMTP id a10-20020a1709027d8a00b001d09471808dmr3344380plm.93.1702264653727; Sun, 10 Dec 2023 19:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702264653; cv=none; d=google.com; s=arc-20160816; b=DuJjSZ3QsKzC+acBbNY/Z3ZyY4ZP5+FMlgjC8fGjE1IoDTsH0Wa6//u1t0mZOhlEzR afKiAVtYfnQouPu6RKAmUbfO49cDJDucCOtqRtTWTlr/74WDM0ZB7ct9WLf6dZBEtbC6 79Ym/av2nzbQ3wOtfkBCnMZlu8iHL4i5d6tjqPkRdygK5+AcMgDBjNnKUJYp67/pCGMW lj0Ap2i1BYSQdRCapPJPKfRbNU7zqGA3gV2sa6LuJXx2Zrh+41t9nIY9CKbEt+3z7pWP 7lYvTyvbSyupFoceR2jvD4vgqRC4S8/HBsqvlI1wFL7MyCxrTKS8r2y4p0KpOEL6+6sL qfwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vZLGfAw9Q8+l7uuaNjc5rkuoFAI2E6K2q8yhGuxPIkk=; fh=P0nxIYE7qiWRpeKkh+F20t3JafkXsGziba7IyZgrNzQ=; b=D9krtulPdNS0FCJ9xA6wcCfJW1GsKniLJulYIy4JFwE741CvS0Ojaucn0ipvYkyVx2 SC1bwNCFQh1PKara1is9x1W+bvAyeDJk5HYjk5cT5VZVqdraNwApWRaYB/2prBJgF1jj O6C1KlUcpFlHlQk+wB6ga1INAWLBqhT+aERFqQEAUWLIMC2qpnFeIW9gpa5H5c5Y6w7j n4m3mtOvCR+Sj3cU976imIciPSZVyE1COlcsc3D3jw6wkWQNYxS4+oscBFWJZQ+LIQk0 uSIGepCt0XfJYVdPoRgoDgaq8Pomg4YH6aKRW0ewmwRcZZ346XHDpN6d9NaV1Mj+Miev nhxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S8i7hKcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q7-20020a17090311c700b001d0c783e5a3si5565828plh.244.2023.12.10.19.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 19:17:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S8i7hKcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DAEDF806532E; Sun, 10 Dec 2023 19:17:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjLKDRG (ORCPT + 99 others); Sun, 10 Dec 2023 22:17:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjLKDRB (ORCPT ); Sun, 10 Dec 2023 22:17:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C694EA for ; Sun, 10 Dec 2023 19:17:07 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPS id E8139C433CB; Mon, 11 Dec 2023 03:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702264627; bh=MGwXCzH2RHGPxDED7tHuvHkaVfH+MHC3vQcwY53cAf4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=S8i7hKcSL6r0sMDnwmVeGJJt3cBQ0x/q+SSRE75ZkJ6IQNWffxVTXYhifvPaZSjha OkLu2doCfmnt0Y69CckTRQlRuf+zhZbd33cLP59qVUJcA64e+uiyRCK5FHONuNMe5I YMUOOk3GpjiZMIWMDPMKo1nXoSOaQSxr6LpE/J/g3HFTkSQw7ksjuCyAFNBYd8W1uE W+K/RCN8tEpU0HPh+eNHPtTMKRK8pk8kPMC3PA2Tud6w/qDbuEXcW7XFnIARcE/fke X0CYMJjAWYMJReATL4caUCf8lJxTXeKUwU2dWNRALFE1K5rNcOBeeVdxywDU1eVqD6 0eQ6+7ntFxaAg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF99AC10F14; Mon, 11 Dec 2023 03:17:06 +0000 (UTC) From: Fenglin Wu via B4 Relay Date: Mon, 11 Dec 2023 11:17:01 +0800 Subject: [PATCH 3/4] regulator: qcom-rpmh: add support for pm8010 regulators MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231211-pm8010-regulator-v1-3-571e05fb4ecc@quicinc.com> References: <20231211-pm8010-regulator-v1-0-571e05fb4ecc@quicinc.com> In-Reply-To: <20231211-pm8010-regulator-v1-0-571e05fb4ecc@quicinc.com> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , kernel@quicinc.com Cc: Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, quic_collinsd@quicinc.com, quic_subbaram@quicinc.com, quic_jprakash@quicinc.com, Fenglin Wu X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1702264625; l=4356; i=quic_fenglinw@quicinc.com; s=20230725; h=from:subject:message-id; bh=CIBQUcV2PQFotayl85S+sWp0kC0MvoYRJhVIDSpSmgM=; b=ukDGYL2p6+wll0Soq4NY6TwRgy2+qI721wuoeZ2L2BWeqa+7JnwJxt8oYeFmbHAyENITw4Mxp WHOZzydtg0OCFm3F/mFX4WDKq8RzIy6ko8SxbyVCqLnoCMd5PmDQnSx X-Developer-Key: i=quic_fenglinw@quicinc.com; a=ed25519; pk=hleIDz3Unk1zeiwwOnZUjoQVMMelRancDFXg927lNjI= X-Endpoint-Received: by B4 Relay for quic_fenglinw@quicinc.com/20230725 with auth_id=68 X-Original-From: Fenglin Wu Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 10 Dec 2023 19:17:29 -0800 (PST) From: Fenglin Wu Add RPMH regulators exposed by Qualcomm Technologies, Inc. PM8010 PMIC. It has 7 LDOs with 3 different types, LDO1 - LDO2 are L502 NMOS LDOs, LDO5 and LDO7 are L502 PMOS LDOs, LDO3/LDO4/LDO6 are L502 PMOS LDO for low noise applications. Also, LDO3 - LDO7 don't support LPM. Suggested-by: David Collins Signed-off-by: Fenglin Wu --- drivers/regulator/qcom-rpmh-regulator.c | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c index 43b45feb02e6..80e304711345 100644 --- a/drivers/regulator/qcom-rpmh-regulator.c +++ b/drivers/regulator/qcom-rpmh-regulator.c @@ -511,6 +511,14 @@ static const int pmic_mode_map_pmic5_ldo[REGULATOR_MODE_STANDBY + 1] = { [REGULATOR_MODE_FAST] = -EINVAL, }; +static const int pmic_mode_map_pmic5_ldo_hpm[REGULATOR_MODE_STANDBY + 1] = { + [REGULATOR_MODE_INVALID] = -EINVAL, + [REGULATOR_MODE_STANDBY] = -EINVAL, + [REGULATOR_MODE_IDLE] = -EINVAL, + [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; @@ -733,6 +741,33 @@ static const struct rpmh_vreg_hw_data pmic5_pldo515_mv = { .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, }; +static const struct rpmh_vreg_hw_data pmic5_pldo502 = { + .regulator_type = VRM, + .ops = &rpmh_regulator_vrm_ops, + .voltage_ranges = (struct linear_range[]) { + REGULATOR_LINEAR_RANGE(1504000, 0, 255, 8000), + }, + .n_linear_ranges = 1, + .n_voltages = 256, + .pmic_mode_map = pmic_mode_map_pmic5_ldo_hpm, + .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, +}; + +static const struct rpmh_vreg_hw_data pmic5_pldo502ln = { + .regulator_type = VRM, + .ops = &rpmh_regulator_vrm_ops, + .voltage_ranges = (struct linear_range[]) { + REGULATOR_LINEAR_RANGE(1800000, 0, 2, 200000), + REGULATOR_LINEAR_RANGE(2608000, 3, 28, 16000), + REGULATOR_LINEAR_RANGE(3104000, 29, 30, 96000), + REGULATOR_LINEAR_RANGE(3312000, 31, 31, 0), + }, + .n_linear_ranges = 4, + .n_voltages = 32, + .pmic_mode_map = pmic_mode_map_pmic5_ldo_hpm, + .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, +}; + static const struct rpmh_vreg_hw_data pmic5_nldo = { .regulator_type = VRM, .ops = &rpmh_regulator_vrm_drms_ops, @@ -759,6 +794,19 @@ static const struct rpmh_vreg_hw_data pmic5_nldo515 = { .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, }; +static const struct rpmh_vreg_hw_data pmic5_nldo502 = { + .regulator_type = VRM, + .ops = &rpmh_regulator_vrm_drms_ops, + .voltage_ranges = (struct linear_range[]) { + REGULATOR_LINEAR_RANGE(528000, 0, 127, 8000), + }, + .n_linear_ranges = 1, + .n_voltages = 128, + .hpm_min_load_uA = 30000, + .pmic_mode_map = pmic_mode_map_pmic5_ldo, + .of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode, +}; + static const struct rpmh_vreg_hw_data pmic5_hfsmps510 = { .regulator_type = VRM, .ops = &rpmh_regulator_vrm_ops, @@ -1210,6 +1258,16 @@ static const struct rpmh_vreg_init_data pm8009_1_vreg_data[] = { {} }; +static const struct rpmh_vreg_init_data pm8010_vreg_data[] = { + RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo502, "vdd-l1-l2"), + RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo502, "vdd-l1-l2"), + RPMH_VREG("ldo3", "ldo%s3", &pmic5_pldo502ln, "vdd-l3-l4"), + RPMH_VREG("ldo4", "ldo%s4", &pmic5_pldo502ln, "vdd-l3-l4"), + RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo502, "vdd-l5"), + RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo502ln, "vdd-l6"), + RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo502, "vdd-l7"), +}; + static const struct rpmh_vreg_init_data pm6150_vreg_data[] = { RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, "vdd-s1"), RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps510, "vdd-s2"), @@ -1525,6 +1583,10 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = { .compatible = "qcom,pm8009-1-rpmh-regulators", .data = pm8009_1_vreg_data, }, + { + .compatible = "qcom,pm8010-rpmh-regulators", + .data = pm8010_vreg_data, + }, { .compatible = "qcom,pm8150-rpmh-regulators", .data = pm8150_vreg_data, -- 2.25.1