Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Oct 2020 15:30:27 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r367211 - stable/12/sys/arm64/rockchip
Message-ID:  <202010311530.09VFURB3098651@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Sat Oct 31 15:30:27 2020
New Revision: 367211
URL: https://svnweb.freebsd.org/changeset/base/367211

Log:
  MFC r360462:
  
    Don't try to re-initialize already preseted regulator.

Modified:
  stable/12/sys/arm64/rockchip/rk805.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/rockchip/rk805.c
==============================================================================
--- stable/12/sys/arm64/rockchip/rk805.c	Sat Oct 31 15:28:21 2020	(r367210)
+++ stable/12/sys/arm64/rockchip/rk805.c	Sat Oct 31 15:30:27 2020	(r367211)
@@ -106,6 +106,7 @@ struct rk805_softc {
 static int rk805_regnode_status(struct regnode *regnode, int *status);
 static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
     int max_uvolt, int *udelay);
+static int rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt);
 
 static struct rk805_regdef rk805_regdefs[] = {
 	{
@@ -367,13 +368,21 @@ rk805_regnode_init(struct regnode *regnode)
 {
 	struct rk805_reg_sc *sc;
 	struct regnode_std_param *param;
-	int rv, udelay, status;
+	int rv, udelay, uvolt, status;
 
 	sc = regnode_get_softc(regnode);
+	dprintf(sc, "Regulator %s init called\n", sc->def->name);
 	param = regnode_get_stdparam(regnode);
 	if (param->min_uvolt == 0)
 		return (0);
 
+	/* Check that the regulator is preset to the correct voltage */
+	rv  = rk805_regnode_get_voltage(regnode, &uvolt);
+	if (rv != 0)
+		return(rv);
+
+	if (uvolt >= param->min_uvolt && uvolt <= param->max_uvolt)
+		return(0);
 	/* 
 	 * Set the regulator at the correct voltage if it is not enabled.
 	 * Do not enable it, this is will be done either by a



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