Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

opp: core: add regulators enable and disable

Add enable regulators to dev_pm_opp_set_regulators() and disable
regulators to dev_pm_opp_put_regulators(). Even if bootloader
leaves regulators enabled, they should be enabled in kernel in
order to increase the reference count.

Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

k.konieczny@partner.samsung.com and committed by
Viresh Kumar
7f93ff73 11e1a164

+13 -3
+13 -3
drivers/opp/core.c
··· 1626 1626 goto free_regulators; 1627 1627 } 1628 1628 1629 + ret = regulator_enable(reg); 1630 + if (ret < 0) { 1631 + regulator_put(reg); 1632 + goto free_regulators; 1633 + } 1634 + 1629 1635 opp_table->regulators[i] = reg; 1630 1636 } 1631 1637 ··· 1645 1639 return opp_table; 1646 1640 1647 1641 free_regulators: 1648 - while (i != 0) 1649 - regulator_put(opp_table->regulators[--i]); 1642 + while (i--) { 1643 + regulator_disable(opp_table->regulators[i]); 1644 + regulator_put(opp_table->regulators[i]); 1645 + } 1650 1646 1651 1647 kfree(opp_table->regulators); 1652 1648 opp_table->regulators = NULL; ··· 1674 1666 /* Make sure there are no concurrent readers while updating opp_table */ 1675 1667 WARN_ON(!list_empty(&opp_table->opp_list)); 1676 1668 1677 - for (i = opp_table->regulator_count - 1; i >= 0; i--) 1669 + for (i = opp_table->regulator_count - 1; i >= 0; i--) { 1670 + regulator_disable(opp_table->regulators[i]); 1678 1671 regulator_put(opp_table->regulators[i]); 1672 + } 1679 1673 1680 1674 _free_set_opp_data(opp_table); 1681 1675