summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorTom Cherry <tcherry@nvidia.com>2010-12-28 18:30:31 -0800
committerBharat Nihalani <bnihalani@nvidia.com>2011-01-05 22:05:59 -0800
commit37e6f8f499816537eecbaf9cc305ac0add835062 (patch)
treee75c254758c745d3011f43e7feb68b703717f5da /drivers/regulator
parent4812e391e1e0fdae30b4140e77471ccf4ef6860c (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 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>
Diffstat (limited to 'drivers/regulator')
-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];