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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to