All of lore.kernel.org
 help / color / mirror / Atom feed
From: Iskren Chernev <iskren.chernev@gmail.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Mark Brown <broonie@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Robert Marko <robimarko@gmail.com>,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	Iskren Chernev <iskren.chernev@gmail.com>
Subject: [PATCH v3 06/13] regulator: qcom_spmi: Add support for HFSMPS regulator type
Date: Mon,  1 Aug 2022 01:37:29 +0300	[thread overview]
Message-ID: <20220731223736.1036286-7-iskren.chernev@gmail.com> (raw)
In-Reply-To: <20220731223736.1036286-1-iskren.chernev@gmail.com>

This is preparation for supporing PM6125.

The HFSMPS is a BUCK type regulator with subtype 0x0a, same as the
existing HFS430 regulator.

Even though the HFSMPS and HFS430 share a register layout, the HFSMPS has
different mode values (BYPASS, RETENTION and LPM are one lower).

I'm expecting future regulators (higher revision) with the same type and
subtype to share mode values of HFSMPS, so revisions 4 (found on pm6125)
and up use the new ops.

The inspiration of this is taken from [1].

[1] https://source.codeaurora.org/quic/la/kernel/msm-5.4/commit/?h=kernel.lnx.5.4.r1-rel&id=d1220daeffaa440ffff0a8c47322eb0033bf54f5

Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
---
 drivers/regulator/qcom_spmi-regulator.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 50c8ee01e0ad..19af294a6972 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -101,6 +101,7 @@ enum spmi_regulator_logical_type {
 	SPMI_REGULATOR_LOGICAL_TYPE_HFS430,
 	SPMI_REGULATOR_LOGICAL_TYPE_FTSMPS3,
 	SPMI_REGULATOR_LOGICAL_TYPE_LDO_510,
+	SPMI_REGULATOR_LOGICAL_TYPE_HFSMPS,
 };
 
 enum spmi_regulator_type {
@@ -168,6 +169,7 @@ enum spmi_regulator_subtype {
 	SPMI_REGULATOR_SUBTYPE_HFS430		= 0x0a,
 	SPMI_REGULATOR_SUBTYPE_HT_P150		= 0x35,
 	SPMI_REGULATOR_SUBTYPE_HT_P600		= 0x3d,
+	SPMI_REGULATOR_SUBTYPE_HFSMPS_510	= 0x0a,
 	SPMI_REGULATOR_SUBTYPE_FTSMPS_510	= 0x0b,
 	SPMI_REGULATOR_SUBTYPE_LV_P150_510	= 0x71,
 	SPMI_REGULATOR_SUBTYPE_LV_P300_510	= 0x72,
@@ -1567,6 +1569,19 @@ static const struct regulator_ops spmi_ftsmps3_ops = {
 	.set_pull_down		= spmi_regulator_common_set_pull_down,
 };
 
+static const struct regulator_ops spmi_hfsmps_ops = {
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+	.set_voltage_sel	= spmi_regulator_ftsmps426_set_voltage,
+	.set_voltage_time_sel	= spmi_regulator_set_voltage_time_sel,
+	.get_voltage_sel	= spmi_regulator_ftsmps426_get_voltage,
+	.map_voltage		= spmi_regulator_single_map_voltage,
+	.list_voltage		= spmi_regulator_common_list_voltage,
+	.set_mode		= spmi_regulator_ftsmps3_set_mode,
+	.get_mode		= spmi_regulator_ftsmps3_get_mode,
+};
+
 /* Maximum possible digital major revision value */
 #define INF 0xFF
 
@@ -1575,7 +1590,8 @@ static const struct spmi_regulator_mapping supported_regulators[] = {
 	SPMI_VREG(LDO,   HT_P600,  0, INF, HFS430, hfs430, ht_p600, 10000),
 	SPMI_VREG(LDO,   HT_P150,  0, INF, HFS430, hfs430, ht_p150, 10000),
 	SPMI_VREG(BUCK,  GP_CTL,   0, INF, SMPS,   smps,   smps,   100000),
-	SPMI_VREG(BUCK,  HFS430,   0, INF, HFS430, hfs430, hfs430,  10000),
+	SPMI_VREG(BUCK,  HFS430,   0,   3, HFS430, hfs430, hfs430,  10000),
+	SPMI_VREG(BUCK,  HFSMPS_510, 4, INF, HFSMPS, hfsmps, hfs430, 100000),
 	SPMI_VREG(LDO,   N300,     0, INF, LDO,    ldo,    nldo1,   10000),
 	SPMI_VREG(LDO,   N600,     0,   0, LDO,    ldo,    nldo2,   10000),
 	SPMI_VREG(LDO,   N1200,    0,   0, LDO,    ldo,    nldo2,   10000),
-- 
2.37.1


  parent reply	other threads:[~2022-07-31 22:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 22:37 [PATCH v3 00/13] PM6125 regulator support Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 01/13] dt-bindings: regulator: qcom_spmi: Improve formatting of if-then blocks Iskren Chernev
2022-08-02 10:41   ` Krzysztof Kozlowski
2022-07-31 22:37 ` [PATCH v3 02/13] dt-bindings: regulator: qcom_spmi: Document PM6125 PMIC Iskren Chernev
2022-08-02 10:41   ` Krzysztof Kozlowski
2022-07-31 22:37 ` [PATCH v3 03/13] dt-bindings: regulator: qcom_smd: Sort compatibles alphabetically Iskren Chernev
2022-08-02 10:42   ` Krzysztof Kozlowski
2022-07-31 22:37 ` [PATCH v3 04/13] dt-bindings: regulator: qcom_smd: Document PM6125 PMIC Iskren Chernev
2022-08-02 10:42   ` Krzysztof Kozlowski
2022-07-31 22:37 ` [PATCH v3 05/13] regulator: qcom_spmi: Add support for new regulator types Iskren Chernev
2022-08-01  3:53   ` kernel test robot
2022-08-02 10:46   ` Krzysztof Kozlowski
2022-08-02 13:17     ` Mark Brown
2022-07-31 22:37 ` Iskren Chernev [this message]
2022-07-31 22:37 ` [PATCH v3 07/13] regulator: qcom_spmi: Sort pmics alphabetically (part 1) Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 08/13] regulator: qcom_spmi: Sort pmics alphabetically (part 2) Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 09/13] regulator: qcom_spmi: Add PM6125 PMIC support Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 10/13] regulator: qcom_smd: Sort pmics alphabetically (part 1) Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 11/13] regulator: qcom_smd: Sort pmics alphabetically (part 2) Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 12/13] regulator: qcom_smd: Sort pmics alphabetically (part 3) Iskren Chernev
2022-07-31 22:37 ` [PATCH v3 13/13] regulator: qcom_smd: Add PM6125 regulators support Iskren Chernev
2022-08-03  8:06 ` [PATCH v3 00/13] PM6125 regulator support Dmitry Baryshkov
2022-08-03  8:58   ` Iskren Chernev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220731223736.1036286-7-iskren.chernev@gmail.com \
    --to=iskren.chernev@gmail.com \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=robimarko@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.