All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Klaassen <justin@tidylabs.net>
To: u-boot@lists.denx.de
Cc: Justin Klaassen <justin@tidylabs.net>,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Jonas Karlman <jonas@kwiboo.se>, Keerthy <j-keerthy@ti.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	William Wu <william.wu@rock-chips.com>
Subject: [PATCH v2 3/5] regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX
Date: Tue, 28 Jan 2025 21:37:35 +0000	[thread overview]
Message-ID: <20250128213852.465664-4-justin@tidylabs.net> (raw)
In-Reply-To: <20250128213852.465664-1-justin@tidylabs.net>

Allows use of the regulator functions of the RK8XX PMIC in SPL, which is
necessary to support the functionality of the Rockchip IO-domain driver
on relevant platforms.

Signed-off-by: Justin Klaassen <justin@tidylabs.net>
---

Changes in v2:
- Added separate patch for added CONFIG_SPL_REGULATOR_RK8XX Kconfig

 drivers/power/regulator/Kconfig | 9 +++++++++
 drivers/power/regulator/rk8xx.c | 8 ++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 958f337c7e7..9b50128f859 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -241,6 +241,15 @@ config REGULATOR_RK8XX
 	by the PMIC device. This driver is controlled by a device tree node
 	which includes voltage limits.
 
+config SPL_REGULATOR_RK8XX
+	bool "Enable driver for RK8XX regulators in SPL"
+	depends on SPL_DM_REGULATOR && SPL_PMIC_RK8XX
+	help
+	  Enable support for the regulator functions of the RK8XX PMIC in SPL. The
+	  driver implements get/set api for the various BUCKS and LDOs supported
+	  by the PMIC device. This driver is controlled by a device tree node
+	  which includes voltage limits.
+
 config DM_REGULATOR_S2MPS11
 	bool "Enable driver for S2MPS11 regulator"
 	depends on DM_REGULATOR && PMIC_S2MPS11
diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index 368675ebb9f..88453bb7bdb 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -16,10 +16,6 @@
 #include <power/pmic.h>
 #include <power/regulator.h>
 
-#ifndef CONFIG_XPL_BUILD
-#define ENABLE_DRIVER
-#endif
-
 /* Not used or exisit register and configure */
 #define NA			0xff
 
@@ -202,7 +198,7 @@ static const struct rk8xx_reg_info rk818_buck[] = {
 	{ 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, 0x00, 0x1f },
 };
 
-#ifdef ENABLE_DRIVER
+#if CONFIG_IS_ENABLED(REGULATOR_RK8XX)
 static const struct rk8xx_reg_info rk806_nldo[] = {
 	/* nldo 1 */
 	{  500000, 12500, RK806_NLDO_ON_VSEL(1), RK806_NLDO_SLP_VSEL(1), NA, RK806_NLDO_VSEL_MASK, 0x00, 0xe7},
@@ -454,7 +450,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)
 	return ret;
 }
 
-#ifdef ENABLE_DRIVER
+#if CONFIG_IS_ENABLED(REGULATOR_RK8XX)
 static int _buck_set_suspend_value(struct udevice *pmic, int buck, int uvolt)
 {
 	const struct rk8xx_reg_info *info = get_buck_reg(pmic, buck, uvolt);
-- 
2.45.3


  parent reply	other threads:[~2025-01-28 21:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 21:37 [PATCH v2 0/5] rockchip: rk3399: rk3399-nanopi-4: Fix SD power initialization in SPL Justin Klaassen
2025-01-28 21:37 ` [PATCH v2 1/5] rockchip: io-domain: Add debug logging for regulators during probe Justin Klaassen
2025-02-04 17:16   ` Quentin Schulz
2025-02-05 17:13     ` Justin Klaassen
2025-01-28 21:37 ` [PATCH v2 2/5] rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAIN Justin Klaassen
2025-02-04 17:20   ` Quentin Schulz
2025-02-05 17:14     ` Justin Klaassen
2025-01-28 21:37 ` Justin Klaassen [this message]
2025-02-04 17:30   ` [PATCH v2 3/5] regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XX Quentin Schulz
2025-02-04 17:30   ` Quentin Schulz
2025-02-05 17:23     ` Justin Klaassen
2025-01-28 21:37 ` [PATCH v2 4/5] rockchip: rk3399-nanopi-4: Allow MMC driver to control SD regulators Justin Klaassen
2025-01-28 21:37 ` [PATCH v2 5/5] rockchip: rk3399-nanopi-4: Enable IO-domain driver in SPL Justin Klaassen

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=20250128213852.465664-4-justin@tidylabs.net \
    --to=justin@tidylabs.net \
    --cc=caleb.connolly@linaro.org \
    --cc=j-keerthy@ti.com \
    --cc=jh80.chung@samsung.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=neil.armstrong@linaro.org \
    --cc=quentin.schulz@cherry.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=william.wu@rock-chips.com \
    /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.