From: Mark Brown Date: Fri, 13 May 2016 13:23:27 +0000 (+0100) Subject: Merge remote-tracking branches 'regulator/topic/can-change', 'regulator/topic/constra... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=78d5501cf41d25a2a78dd571d91fee3e1e271d3f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Merge remote-tracking branches 'regulator/topic/can-change', 'regulator/topic/constrain', 'regulator/topic/debugfs' and 'regulator/topic/doc' into regulator-next --- 78d5501cf41d25a2a78dd571d91fee3e1e271d3f diff --cc drivers/regulator/core.c index af88762b2fc8,e0b764284773,bca9167d8c43,73381752ff78,e0b764284773..ec8184d53f13 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@@@@@ -913,32 -914,15 -890,34 -914,15 -914,15 +888,34 @@@@@@ static int machine_constraints_voltage( current_uV); return current_uV; } - -- if (current_uV < rdev->constraints->min_uV || - -- current_uV > rdev->constraints->max_uV) { + ++ + ++ /* + ++ * If we're below the minimum voltage move up to the + ++ * minimum voltage, if we're above the maximum voltage + ++ * then move down to the maximum. + ++ */ + ++ target_min = current_uV; + ++ target_max = current_uV; + ++ + ++ if (current_uV < rdev->constraints->min_uV) { + ++ target_min = rdev->constraints->min_uV; + ++ target_max = rdev->constraints->min_uV; + ++ } + ++ + ++ if (current_uV > rdev->constraints->max_uV) { + ++ target_min = rdev->constraints->max_uV; + ++ target_max = rdev->constraints->max_uV; + ++ } + ++ + ++ if (target_min != current_uV || target_max != current_uV) { ++ ++ rdev_info(rdev, "Bringing %duV into %d-%duV\n", ++ ++ current_uV, target_min, target_max); ret = _regulator_do_set_voltage( - -- rdev, rdev->constraints->min_uV, - -- rdev->constraints->max_uV); + ++ rdev, target_min, target_max); if (ret < 0) { rdev_err(rdev, - -- "failed to apply %duV constraint(%d)\n", - -- rdev->constraints->min_uV, ret); + ++ "failed to apply %d-%duV constraint(%d)\n", + ++ target_min, target_max, ret); return ret; } } @@@@@@ -4019,21 -3983,11 -3973,11 -4035,11 -3983,11 +4043,21 @@@@@@ regulator_register(const struct regulat goto unset_supplies; } } ++++ mutex_unlock(®ulator_list_mutex); + + } + + ++++ ret = device_register(&rdev->dev); ++++ if (ret != 0) { ++++ put_device(&rdev->dev); ++++ goto unset_supplies; ++ } ++ ++++ dev_set_drvdata(&rdev->dev, rdev); rdev_init_debugfs(rdev); ----out: ---- mutex_unlock(®ulator_list_mutex); ++++ ++++ /* try to resolve regulators supply since a new one was registered */ ++++ class_for_each_device(®ulator_class, NULL, NULL, ++++ regulator_register_resolve_supply); kfree(config); return rdev;