regulator: max77663: Active-discharge mode for SDx
Harry Hong [Thu, 1 Sep 2011 11:22:11 +0000 (20:22 +0900)]
Adding Active-discharge option for SDx rails.

bug 859415

Original-Change-Id: Ia4d3933b9dbf4a0ec646c586f99a7411d2a93371
Reviewed-on: http://git-master/r/50281
Tested-by: Harry Hong <hhong@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: Rac11236a7f0f305f0e821c5a8f911e5751bd2c82

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

index c7d4e4f..1d57153 100644 (file)
 #define SD_FPWM_MASK                   0x04
 #define SD_FPWM_SHIFT                  2
 
+/* SD Failling slew rate Active-Discharge Mode */
+#define SD_FSRADE_MASK                 0x01
+#define SD_FSRADE_SHIFT                0
+
 /* Voltage */
 #define SDX_VOLT_MASK                  0xFF
 #define SD1_VOLT_MASK                  0x3F
@@ -552,6 +556,16 @@ skip_init_apply:
                        }
                }
 
+               if (pdata->flags & SD_FSRADE_DISABLE) {
+                       ret = max77663_set_bits(parent, reg->cfg_reg,
+                                               SD_FSRADE_MASK, SD_FSRADE_MASK, 0);
+                       if (ret < 0) {
+                               dev_err(reg->dev, "preinit: "
+                                       "Failed to set falling slew-rate discharge mode\n");
+                               return ret;
+                       }
+               }
+
                if ((reg->id == MAX77663_REGULATOR_ID_SD0)
                                && (pdata->flags & EN2_CTRL_SD0)) {
                        val = POWER_MODE_DISABLE;
index 470248d..093ca42 100644 (file)
@@ -98,6 +98,9 @@ enum max77663_regulator_fps_src {
 /* SD Forced PWM Mode */
 #define SD_FORCED_PWM_MODE     0x20
 
+/* SD Failling Slew Rate Active-Discharge Mode */
+#define SD_FSRADE_DISABLE      0x40
+
 struct max77663_regulator_fps_cfg {
        enum max77663_regulator_fps_src src;
        enum max77663_regulator_fps_en_src en_src;