aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-03-17 08:24:52 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-03-26 10:15:06 -0400
commit88cd222b259d62148ab8c82398498b1a01314476 (patch)
treed7a5f1561ef8617d42536ff84310eb191d0f0115 /drivers/regulator
parent77af1b2641faf45788a0d480db94082ebee931dc (diff)
regulator: provide consumer interface for fall/rise time
This exposes the functionality for rise/fall fime when setting voltage to the consumers. Cc: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e7e4460dcb92..3ffc6979d164 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1765,6 +1765,51 @@ out:
1765EXPORT_SYMBOL_GPL(regulator_set_voltage); 1765EXPORT_SYMBOL_GPL(regulator_set_voltage);
1766 1766
1767/** 1767/**
1768 * regulator_set_voltage_time - get raise/fall time
1769 * @regulator: regulator source
1770 * @old_uV: starting voltage in microvolts
1771 * @new_uV: target voltage in microvolts
1772 *
1773 * Provided with the starting and ending voltage, this function attempts to
1774 * calculate the time in microseconds required to rise or fall to this new
1775 * voltage.
1776 */
1777int regulator_set_voltage_time(struct regulator *regulator,
1778 int old_uV, int new_uV)
1779{
1780 struct regulator_dev *rdev = regulator->rdev;
1781 struct regulator_ops *ops = rdev->desc->ops;
1782 int old_sel = -1;
1783 int new_sel = -1;
1784 int voltage;
1785 int i;
1786
1787 /* Currently requires operations to do this */
1788 if (!ops->list_voltage || !ops->set_voltage_time_sel
1789 || !rdev->desc->n_voltages)
1790 return -EINVAL;
1791
1792 for (i = 0; i < rdev->desc->n_voltages; i++) {
1793 /* We only look for exact voltage matches here */
1794 voltage = regulator_list_voltage(regulator, i);
1795 if (voltage < 0)
1796 return -EINVAL;
1797 if (voltage == 0)
1798 continue;
1799 if (voltage == old_uV)
1800 old_sel = i;
1801 if (voltage == new_uV)
1802 new_sel = i;
1803 }
1804
1805 if (old_sel < 0 || new_sel < 0)
1806 return -EINVAL;
1807
1808 return ops->set_voltage_time_sel(rdev, old_sel, new_sel);
1809}
1810EXPORT_SYMBOL_GPL(regulator_set_voltage_time);
1811
1812/**
1768 * regulator_sync_voltage - re-apply last regulator output voltage 1813 * regulator_sync_voltage - re-apply last regulator output voltage
1769 * @regulator: regulator source 1814 * @regulator: regulator source
1770 * 1815 *