summaryrefslogtreecommitdiff
path: root/drivers/regulator/max8907c-regulator.c
diff options
context:
space:
mode:
authorTom Cherry <tcherry@nvidia.com>2010-12-28 18:30:31 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:43:09 -0800
commit23047b994c5e77caaa8ee8de0196c82afd2ed926 (patch)
tree730affd30a55c9681da8ac603a500ddda32631b9 /drivers/regulator/max8907c-regulator.c
parentb1ca0d16bd9fe99d993a04e7ccf4fbbb1e192f99 (diff)
max8907c regulator: fix unit error
The minimum, maximum, and step voltages for SD1 are different on max8907b and max8907c. This change reads the version register of the device and uses the proper values, defaulting to the max8907c values, unless the device is a max8907b. Bug 772688 Original-Change-Id: I2bc53e81c7784e47c50e4ff45c4f4d71d875e187 Reviewed-on: http://git-master/r/14503 Tested-by: Thomas Cherry <tcherry@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R52c46e5096b21f9b530cfe19cea2cef964d640e5
Diffstat (limited to 'drivers/regulator/max8907c-regulator.c')
-rw-r--r--drivers/regulator/max8907c-regulator.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/regulator/max8907c-regulator.c b/drivers/regulator/max8907c-regulator.c
index fc3087670164..9471b75d854f 100644
--- a/drivers/regulator/max8907c-regulator.c
+++ b/drivers/regulator/max8907c-regulator.c
@@ -17,6 +17,11 @@
#include <linux/mfd/max8907c.h>
#include <linux/regulator/max8907c-regulator.h>
+#define MAX8907C_II2RR_VERSION_MASK 0xF0
+#define MAX8907C_II2RR_VERSION_REV_A 0x00
+#define MAX8907C_II2RR_VERSION_REV_B 0x10
+#define MAX8907C_II2RR_VERSION_REV_C 0x30
+
#define MAX8907C_REGULATOR_CNT (ARRAY_SIZE(max8907c_regulators))
struct max8907c_regulator_info {
@@ -362,6 +367,15 @@ static int max8907c_regulator_probe(struct platform_device *pdev)
{
struct max8907c_regulator_info *info;
struct regulator_dev *rdev;
+ u8 version;
+
+ /* Backwards compatibility with max8907b, SD1 uses different voltages */
+ version = max8907c_reg_read(pdev->dev.parent, MAX8907C_REG_II2RR);
+ if ((version & MAX8907C_II2RR_VERSION_MASK) == MAX8907C_II2RR_VERSION_REV_B) {
+ max8907c_regulators[MAX8907C_SD1].min_uV = 637500;
+ max8907c_regulators[MAX8907C_SD1].max_uV = 1425000;
+ max8907c_regulators[MAX8907C_SD1].step_uV = 12500;
+ }
info = &max8907c_regulators[pdev->id];