mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alina Yu <alina_yu@richtek.com>
To: <lgirdwood@gmail.com>, <broonie@kernel.org>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<alina_yu@richtek.com>, <johnny_lai@richtek.com>,
	<cy_huang@richtek.com>
Subject: [PATCH v3 3/6] regulator: rtq2208: Fix LDO discharge register
Date: Fri, 10 May 2024 20:06:22 +0800	[thread overview]
Message-ID: <a1248141d114fbaf0ce7b1ffe37d3fe023b1478b.1715340537.git.alina_yu@richtek.com> (raw)
In-Reply-To: <cover.1715340537.git.alina_yu@richtek.com>

Since the discharge register has been moved to another position,
the modification is to fit the new register setting.

Signed-off-by: Alina Yu <alina_yu@richtek.com>
---
v3
- Seperate LDO vsel and discharge change to seperate patches
---
 drivers/regulator/rtq2208-regulator.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2208-regulator.c
index 00da787..cea8e77 100644
--- a/drivers/regulator/rtq2208-regulator.c
+++ b/drivers/regulator/rtq2208-regulator.c
@@ -41,7 +41,9 @@
 #define RTQ2208_EN_DIS_MASK			BIT(0)
 #define RTQ2208_BUCK_RAMP_SEL_MASK		GENMASK(2, 0)
 #define RTQ2208_HD_INT_MASK			BIT(0)
+#define RTQ2208_LDO1_DISCHG_EN_MASK		BIT(4)
 #define RTQ2208_LDO1_VOSEL_SD_MASK		BIT(5)
+#define RTQ2208_LDO2_DISCHG_EN_MASK		BIT(6)
 #define RTQ2208_LDO2_VOSEL_SD_MASK		BIT(7)
 
 /* Size */
@@ -339,11 +341,12 @@ static irqreturn_t rtq2208_irq_handler(int irqno, void *devid)
 	.name = _name,							\
 	.base = RTQ2208_REG_LDO##_id##_CFG,				\
 	.enable_reg = RTQ2208_REG_LDO##_id##_CFG,			\
+	.dis_mask = RTQ2208_LDO##_id##_DISCHG_EN_MASK,			\
+	.dis_on = RTQ2208_LDO##_id##_DISCHG_EN_MASK,			\
 	.vsel_mask = RTQ2208_LDO##_id##_VOSEL_SD_MASK,			\
 }
 
 #define BUCK_RG_SHIFT(_base, _shift)	(_base + _shift)
-#define LDO_RG_SHIFT(_base, _shift)	(_base + _shift)
 #define	VSEL_SHIFT(_sel)	(_sel ? 3 : 1)
 #define MTP_SEL_MASK(_sel)	RTQ2208_BUCK_EN_NR_MTP_SEL##_sel##_MASK
 
@@ -422,9 +425,7 @@ static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, in
 	desc->owner = THIS_MODULE;
 	desc->type = REGULATOR_VOLTAGE;
 	desc->enable_mask = mtp_sel ? MTP_SEL_MASK(1) : MTP_SEL_MASK(0);
-	desc->active_discharge_on = RTQ2208_EN_DIS_MASK;
 	desc->active_discharge_off = 0;
-	desc->active_discharge_mask = RTQ2208_EN_DIS_MASK;
 	desc->enable_reg = curr_info->enable_reg;
 
 	rdesc->mode_mask = RTQ2208_BUCK_NRMODE_MASK;
@@ -438,8 +439,10 @@ static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, in
 		desc->linear_ranges = rtq2208_vout_range;
 		desc->n_linear_ranges = ARRAY_SIZE(rtq2208_vout_range);
 		desc->ramp_reg = BUCK_RG_SHIFT(curr_info->base, 5);
-		desc->active_discharge_reg = curr_info->base;
 		desc->of_map_mode = rtq2208_of_map_mode;
+		desc->active_discharge_reg = curr_info->dis_reg;
+		desc->active_discharge_on = RTQ2208_EN_DIS_MASK;
+		desc->active_discharge_mask = RTQ2208_EN_DIS_MASK;
 
 		rdesc->mode_reg = BUCK_RG_SHIFT(curr_info->base, 2);
 		rdesc->suspend_config_reg = BUCK_RG_SHIFT(curr_info->base, 4);
@@ -447,9 +450,11 @@ static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, in
 		rdesc->suspend_mode_mask = RTQ2208_BUCK_STRMODE_MASK;
 	} else {
 		/* init ldo desc */
-		desc->active_discharge_reg = LDO_RG_SHIFT(curr_info->base, 2);
 		desc->vsel_reg = RTQ2208_REG_LDO_DVS_CTRL;
 		desc->vsel_mask = curr_info->vsel_mask;
+		desc->active_discharge_reg = RTQ2208_REG_LDO_DVS_CTRL;
+		desc->active_discharge_on = curr_info->dis_on;
+		desc->active_discharge_mask = curr_info->dis_mask;
 
 		rdesc->suspend_config_reg = curr_info->base;
 		rdesc->suspend_enable_mask = RTQ2208_LDO_EN_STR_MASK;
-- 
2.7.4


  parent reply	other threads:[~2024-05-10 12:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 12:06 [PATCH v3 0/6] Fix rtq2208 BUCK ramp_delay and LDO dvs setting Alina Yu
2024-05-10 12:06 ` [PATCH v3 1/6] regulator: rtq2208: Fix invalid memory access when devm_of_regulator_put_matches is called Alina Yu
2024-05-15 15:47   ` Mark Brown
2024-05-27  9:31     ` Alina Yu
2024-05-10 12:06 ` [PATCH v3 2/6] regulator: rtq2208: Fix LDO vsel setting Alina Yu
2024-05-10 12:06 ` Alina Yu [this message]
2024-05-10 12:06 ` [PATCH v3 4/6] regulator: rtq2208: Fix the BUCK ramp_delay range to maximum of 16mVstep/us Alina Yu
2024-05-10 12:06 ` [PATCH v3 5/6] regulator: rtq2208: Fix LDO to be compatible with both fixed and adjustable vout Alina Yu
2024-05-10 12:06 ` [PATCH v3 6/6] regulator: dt-bindings: rtq2208: Add property to get ldo of RTQ2208 is adjustable or not Alina Yu
2024-05-13 16:22   ` Conor Dooley
2024-05-14 10:34     ` Mark Brown
2024-05-14 18:01       ` Conor Dooley
2024-05-15  7:38         ` Alina Yu
2024-05-15  8:06           ` Conor Dooley
2024-05-15  9:02             ` Alina Yu
2024-05-15 15:51               ` Conor Dooley
2024-05-15 16:04                 ` Mark Brown
2024-05-15 16:16                   ` Conor Dooley
2024-05-15 12:10         ` Mark Brown
2024-05-15 15:48           ` Conor Dooley
2024-05-29 11:21 ` (subset) [PATCH v3 0/6] Fix rtq2208 BUCK ramp_delay and LDO dvs setting Mark Brown

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=a1248141d114fbaf0ce7b1ffe37d3fe023b1478b.1715340537.git.alina_yu@richtek.com \
    --to=alina_yu@richtek.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cy_huang@richtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=johnny_lai@richtek.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®