aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@sirena.org.uk>2013-04-27 21:13:37 -0400
committerMark Brown <broonie@sirena.org.uk>2013-04-27 21:13:37 -0400
commit1d60a4cf975a196d585149e667f58cbca1a574fc (patch)
tree208ae4c9539f349cd5fa87ac62b79cb6569c4d62 /drivers/regulator/core.c
parent0e340ce1ddcf41ca435ef695ef004a6f587c749e (diff)
parentea88b132acdf3270b812117f622b0df044e6b76f (diff)
Merge remote-tracking branch 'regulator/topic/enable-invert' into v3.9-rc8
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6437949849b0..2434e2e1afcc 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1803,7 +1803,10 @@ int regulator_is_enabled_regmap(struct regulator_dev *rdev)
1803 if (ret != 0) 1803 if (ret != 0)
1804 return ret; 1804 return ret;
1805 1805
1806 return (val & rdev->desc->enable_mask) != 0; 1806 if (rdev->desc->enable_is_inverted)
1807 return (val & rdev->desc->enable_mask) == 0;
1808 else
1809 return (val & rdev->desc->enable_mask) != 0;
1807} 1810}
1808EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap); 1811EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
1809 1812
@@ -1818,9 +1821,15 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
1818 */ 1821 */
1819int regulator_enable_regmap(struct regulator_dev *rdev) 1822int regulator_enable_regmap(struct regulator_dev *rdev)
1820{ 1823{
1824 unsigned int val;
1825
1826 if (rdev->desc->enable_is_inverted)
1827 val = 0;
1828 else
1829 val = rdev->desc->enable_mask;
1830
1821 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, 1831 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
1822 rdev->desc->enable_mask, 1832 rdev->desc->enable_mask, val);
1823 rdev->desc->enable_mask);
1824} 1833}
1825EXPORT_SYMBOL_GPL(regulator_enable_regmap); 1834EXPORT_SYMBOL_GPL(regulator_enable_regmap);
1826 1835
@@ -1835,8 +1844,15 @@ EXPORT_SYMBOL_GPL(regulator_enable_regmap);
1835 */ 1844 */
1836int regulator_disable_regmap(struct regulator_dev *rdev) 1845int regulator_disable_regmap(struct regulator_dev *rdev)
1837{ 1846{
1847 unsigned int val;
1848
1849 if (rdev->desc->enable_is_inverted)
1850 val = rdev->desc->enable_mask;
1851 else
1852 val = 0;
1853
1838 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, 1854 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
1839 rdev->desc->enable_mask, 0); 1855 rdev->desc->enable_mask, val);
1840} 1856}
1841EXPORT_SYMBOL_GPL(regulator_disable_regmap); 1857EXPORT_SYMBOL_GPL(regulator_disable_regmap);
1842 1858