Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jan 2020 19:56:50 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356893 - head/sys/arm64/rockchip
Message-ID:  <202001191956.00JJuoTb008583@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sun Jan 19 19:56:50 2020
New Revision: 356893
URL: https://svnweb.freebsd.org/changeset/base/356893

Log:
  rk805: Add a regnode_init method
  
  This method will set the desired voltaged based on values in the DTS.
  It will not enable the regulator, this is the job of either a consumer
  or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.
  
  Reviewed by:	mmel
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D23216

Modified:
  head/sys/arm64/rockchip/rk805.c

Modified: head/sys/arm64/rockchip/rk805.c
==============================================================================
--- head/sys/arm64/rockchip/rk805.c	Sun Jan 19 19:56:05 2020	(r356892)
+++ head/sys/arm64/rockchip/rk805.c	Sun Jan 19 19:56:50 2020	(r356893)
@@ -97,6 +97,9 @@ struct rk805_softc {
 	int			nregs;
 };
 
+static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
+    int max_uvolt, int *udelay);
+
 static struct rk805_regdef rk805_regdefs[] = {
 	{
 		.id = RK805_DCDC1,
@@ -354,7 +357,26 @@ rk805_write(device_t dev, uint8_t reg, uint8_t data)
 static int
 rk805_regnode_init(struct regnode *regnode)
 {
-	return (0);
+	struct rk805_reg_sc *sc;
+	struct regnode_std_param *param;
+	int rv, udelay;
+
+	sc = regnode_get_softc(regnode);
+	param = regnode_get_stdparam(regnode);
+	if (param->min_uvolt == 0)
+		return (0);
+
+	/* 
+	 * Set the regulator at the correct voltage
+	 * Do not enable it, this is will be done either by a
+	 * consumer or by regnode_set_constraint if boot_on is true
+	 */
+	rv = rk805_regnode_set_voltage(regnode, param->min_uvolt,
+	    param->max_uvolt, &udelay);
+	if (rv != 0)
+		DELAY(udelay);
+
+	return (rv);
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001191956.00JJuoTb008583>