regulator: max77663: add support for VDD_RTC tracking to VDD_CORE
Johnny Qiu [Wed, 1 Feb 2012 05:46:01 +0000 (13:46 +0800)]
Bug 920845

Change-Id: Id84218efaeebcc834fdac6e0e5c30adc60a13ebc
Signed-off-by: Johnny Qiu <joqiu@nvidia.com>
Signed-off-by: Hao Tang <htang@nvidia.com>
Reviewed-on: http://git-master/r/83727
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>
Reviewed-by: Liangchuan Mi <lmi@nvidia.com>
Tested-by: Liangchuan Mi <lmi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

drivers/regulator/max77663-regulator.c
include/linux/regulator/max77663-regulator.h

index c961ab0..5604750 100644 (file)
@@ -2,8 +2,8 @@
  * drivers/regulator/max77663-regulator.c
  * Maxim LDO and Buck regulators driver
  *
- * Copyright 2011 Maxim Integrated Products, Inc.
- * Copyright (C) 2011 NVIDIA Corporation
+ * Copyright 2011-2012 Maxim Integrated Products, Inc.
+ * Copyright (C) 2011-2012 NVIDIA Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -64,6 +64,7 @@
 #define MAX77663_REG_LDO7_CFG2         0x32
 #define MAX77663_REG_LDO8_CFG          0x33
 #define MAX77663_REG_LDO8_CFG2         0x34
+#define MAX77663_REG_LDO_CFG3          0x35
 
 /* Power Mode */
 #define POWER_MODE_NORMAL              3
 #define SD_FSRADE_MASK                 0x01
 #define SD_FSRADE_SHIFT                0
 
+/* LDO Configuration 3 */
+#define TRACK4_MASK                    0x20
+#define TRACK4_SHIFT                   5
+
 /* Voltage */
 #define SDX_VOLT_MASK                  0xFF
 #define SD1_VOLT_MASK                  0x3F
@@ -730,6 +735,18 @@ skip_init_apply:
                }
        }
 
+       if ((reg->id == MAX77663_REGULATOR_ID_LDO4)
+                       && (pdata->flags & LDO4_EN_TRACKING)) {
+               val = TRACK4_MASK;
+               ret = max77663_write(_to_parent(reg), MAX77663_REG_LDO_CFG3, &val, 1, 0);
+               if (ret < 0) {
+                       dev_err(reg->dev, "preinit: "
+                               "Failed to set register 0x%x\n",
+                               MAX77663_REG_LDO_CFG3);
+                       return ret;
+               }
+       }
+
        return 0;
 }
 
index 49ffee2..d8ab389 100644 (file)
@@ -2,8 +2,8 @@
  * include/linux/regulator/max77663-regulator.h
  * Maxim LDO and Buck regulators driver
  *
- * Copyright 2011 Maxim Integrated Products, Inc.
- * Copyright (C) 2011 NVIDIA Corporation
+ * Copyright 2011-2012 Maxim Integrated Products, Inc.
+ * Copyright (C) 2011-2012 NVIDIA Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -104,6 +104,9 @@ enum max77663_regulator_fps_src {
 /* Group Low-Power Mode */
 #define GLPM_ENABLE            0x80
 
+/* Tracking for LDO4 */
+#define LDO4_EN_TRACKING       0x100
+
 struct max77663_regulator_fps_cfg {
        enum max77663_regulator_fps_src src;
        enum max77663_regulator_fps_en_src en_src;