From 0bf902d17bc96328824c81673fc31db402903077 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 26 Feb 2009 19:24:19 +0000 Subject: [PATCH] --- yaml --- r: 140251 b: refs/heads/master c: a308466c24b4f42bab6945026e938874d22cde50 h: refs/heads/master i: 140249: a1d579fde9dcfdcadbbe01daac37641ea1ed1cfb 140247: 67ca75de0246e6d71ae3e56b83a536aaf0c3c24c v: v3 --- [refs] | 2 +- trunk/drivers/regulator/core.c | 17 +++++++++++++++++ trunk/include/linux/regulator/machine.h | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index c433ef750121..11f1327f626d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fe203ddfa5451a13589b1c7da9edab80b7fc06d1 +refs/heads/master: a308466c24b4f42bab6945026e938874d22cde50 diff --git a/trunk/drivers/regulator/core.c b/trunk/drivers/regulator/core.c index d55a25a6fab2..75abcd85e51b 100644 --- a/trunk/drivers/regulator/core.c +++ b/trunk/drivers/regulator/core.c @@ -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 && diff --git a/trunk/include/linux/regulator/machine.h b/trunk/include/linux/regulator/machine.h index 5aa00ee36a3d..1eb861cf4b2c 100644 --- a/trunk/include/linux/regulator/machine.h +++ b/trunk/include/linux/regulator/machine.h @@ -83,6 +83,7 @@ struct regulator_state { * @state_standby: State for regulator when system is suspended in standby * mode. * @initial_state: Suspend state to set by default. + * @initial_mode: Mode to set at startup. */ struct regulation_constraints { @@ -111,6 +112,9 @@ struct regulation_constraints { struct regulator_state state_standby; suspend_state_t initial_state; /* suspend state to set at init */ + /* mode to set on startup */ + unsigned int initial_mode; + /* constriant flags */ unsigned always_on:1; /* regulator never off when system is on */ unsigned boot_on:1; /* bootloader/firmware enabled regulator */