Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2020 13:45:21 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360462 - head/sys/arm64/rockchip
Message-ID:  <202004291345.03TDjLwQ019338@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Wed Apr 29 13:45:21 2020
New Revision: 360462
URL: https://svnweb.freebsd.org/changeset/base/360462

Log:
  Don't try to re-initialize already preseted regulator.
  
  Don't set initial voltage for regulators having their voltage already
  in allowed range. As side effect of this change, we don't try to set
  initial voltage for fixed voltage regulators - these don't have impemented
  voltage set  method so their initialization has always failed.
  
  MFC after:	3 weeks

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

Modified: head/sys/arm64/rockchip/rk805.c
==============================================================================
--- head/sys/arm64/rockchip/rk805.c	Wed Apr 29 13:43:15 2020	(r360461)
+++ head/sys/arm64/rockchip/rk805.c	Wed Apr 29 13:45:21 2020	(r360462)
@@ -105,6 +105,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[] = {
 	{
@@ -366,13 +367,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?202004291345.03TDjLwQ019338>