mfd: Allow WM8994 LDO enable pulls to be disabled
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 22 Aug 2011 13:43:55 +0000 (15:43 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 24 Oct 2011 12:09:10 +0000 (14:09 +0200)
In systems where the LDO enables are always driven (for example, being
connected to an always on supply rail or a GPIO which is driven by the
CPU even in suspend) then we can disable the pull downs on the LDO for
a small power savings.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm8994-core.c
include/linux/mfd/wm8994/core.h
include/linux/mfd/wm8994/pdata.h

index 96479c9b1728918e8672a6aa9d03847365594263..1f15743460a0ddfc70c0faa5ecb676a81660dcf4 100644 (file)
@@ -281,6 +281,13 @@ static int wm8994_suspend(struct device *dev)
                return 0;
        }
 
+       /* Disable LDO pulldowns while the device is suspended if we
+        * don't know that something will be driving them. */
+       if (!wm8994->ldo_ena_always_driven)
+               wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
+                               WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
+                               WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD);
+
        /* GPIO configuration state is saved here since we may be configuring
         * the GPIO alternate functions even if we're not using the gpiolib
         * driver for them.
@@ -350,6 +357,11 @@ static int wm8994_resume(struct device *dev)
        if (ret < 0)
                dev_err(dev, "Failed to restore GPIO registers: %d\n", ret);
 
+       /* Disable LDO pulldowns while the device is active */
+       wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
+                       WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
+                       0);
+
        wm8994->suspended = false;
 
        return 0;
@@ -513,8 +525,15 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
                                                pdata->gpio_defaults[i]);
                        }
                }
+
+               wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven;
        }
 
+       /* Disable LDO pulldowns while the device is active */
+       wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
+                       WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
+                       0);
+
        /* In some system designs where the regulators are not in use,
         * we can achieve a small reduction in leakage currents by
         * floating LDO outputs.  This bit makes no difference if the
index f0b69cdae41cc94f24c995d9812301d9eb711451..5ab71bd76f9c77a5c178f93945f7185fb2d368da 100644 (file)
@@ -63,6 +63,8 @@ struct wm8994 {
 
        void *control_data;
 
+       bool ldo_ena_always_driven;
+
        int gpio_base;
        int irq_base;
 
index 97cf4f27d6470120a389bb8a2e1217871b8e3411..ea32f306dca6963c312fe4f4b4e3968233f68393 100644 (file)
@@ -167,6 +167,13 @@ struct wm8994_pdata {
 
        /* WM8958 microphone bias configuration */
        int micbias[2];
+
+       /* Disable the internal pull downs on the LDOs if they are
+        * always driven (eg, connected to an always on supply or
+        * GPIO that always drives an output.  If they float power
+        * consumption will rise.
+        */
+       bool ldo_ena_always_driven;
 };
 
 #endif