regulator: core: add support to set startup delay from platform
Laxman Dewangan [Wed, 7 Aug 2013 09:24:25 +0000 (14:24 +0530)]
The startup delay of rail depends on the PMIC design and the platform
design. The startup delay is provided based on PMIC datasheet through
regulator callback.

Add support to provide the platform specific startup delay during
regulator registration through regulator constraints.

The actual delay will be taken from constraints and if it is zero
then based on datasheet.

bug 1317941

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/259122
(cherry picked from commit 0a1b6e2ca9955cf07a2c08654151480ef0a6fac3)

bug 1348506

Change-Id: I3a0d439e6f52a963a32e191145a6cdd36bc5e01b
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: http://git-master/r/267822
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>

drivers/regulator/core.c
include/linux/regulator/machine.h

index ca0c802..7cc844f 100644 (file)
@@ -1306,6 +1306,8 @@ overflow_err:
 
 static int _regulator_get_enable_time(struct regulator_dev *rdev)
 {
+       if (rdev->constraints->startup_delay)
+               return rdev->constraints->startup_delay;
        if (!rdev->desc->ops->enable_time)
                return 0;
        return rdev->desc->ops->enable_time(rdev);
index 3f441cd..fb7cfb7 100644 (file)
@@ -95,6 +95,7 @@ struct regulator_state {
  * @initial_state: Suspend state to set by default.
  * @initial_mode: Mode to set at startup.
  * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
+ * @startup_delay: Time to settle down after rail enable (unit: us)
  */
 struct regulation_constraints {
 
@@ -133,6 +134,8 @@ struct regulation_constraints {
 
        unsigned int ramp_delay;
 
+       unsigned int startup_delay;
+
        /* constraint flags */
        unsigned always_on:1;   /* regulator never off when system is on */
        unsigned boot_on:1;     /* bootloader/firmware enabled regulator */