Index: sys/dev/extres/regulator/regulator.c =================================================================== --- sys/dev/extres/regulator/regulator.c +++ sys/dev/extres/regulator/regulator.c @@ -828,9 +828,6 @@ return (rv); } - if (status == REGULATOR_STATUS_ENABLED) - return (0); - rv = regnode_get_voltage(regnode, &uvolt); if (rv != 0) { if (bootverbose) @@ -842,20 +839,27 @@ if (uvolt < regnode->std_param.min_uvolt || uvolt > regnode->std_param.max_uvolt) { if (bootverbose) - printf("Regulator %s current voltage %d is not in the" - " acceptable range : %d<->%d\n", + printf("Regulator %s current voltage %d is not in the " + "acceptable range : %d<->%d, " + "changing it\n", regnode_get_name(regnode), uvolt, regnode->std_param.min_uvolt, regnode->std_param.max_uvolt); - return (ERANGE); + rv = regnode_set_voltage(regnode, + regnode->std_param.min_uvolt, + regnode->std_param.max_uvolt); + if (rv != 0) + return (rv); } - rv = regnode_enable(regnode); - if (rv != 0) { - if (bootverbose) - printf("Cannot enable regulator %s\n", - regnode_get_name(regnode)); - return (rv); + if (status != REGULATOR_STATUS_ENABLED) { + rv = regnode_enable(regnode); + if (rv != 0) { + if (bootverbose) + printf("Cannot enable regulator %s\n", + regnode_get_name(regnode)); + return (rv); + } } return (0);