]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/regulator/core.c
regulator: Allow regulators to set the initial operating mode
[linux-2.6-omap-h63xx.git] / drivers / regulator / core.c
index d55a25a6fab27afc8b448f15456e9450e0d6a83d..75abcd85e51bdfa72d5e4a53f3b0bfa4dd4c747c 100644 (file)
@@ -724,6 +724,23 @@ static int set_machine_constraints(struct regulator_dev *rdev,
                }
        }
 
+       if (constraints->initial_mode) {
+               if (!ops->set_mode) {
+                       printk(KERN_ERR "%s: no set_mode operation for %s\n",
+                              __func__, name);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               ret = ops->set_mode(rdev, constraints->initial_mode);
+               if (ret < 0) {
+                       printk(KERN_ERR
+                              "%s: failed to set initial mode for %s: %d\n",
+                              __func__, name, ret);
+                       goto out;
+               }
+       }
+
        /* if always_on is set then turn the regulator on if it's not
         * already on. */
        if (constraints->always_on && ops->enable &&