diff options
author | Suman Anna <s-anna@ti.com> | 2012-01-17 19:55:53 +0100 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-03-13 11:20:25 +0800 |
commit | 92309fe4ca5999fd83fd690cb74a8ce5182e6da3 (patch) | |
tree | 4e1916c084a4f74dd575c6d5ae6a2ecb6d96e4d9 | |
parent | b92d3653f2cc2356797d6bac320c8a9a83e141fd (diff) |
rpmsg: resmgr: enable camera regulators for omap5
Camera requires an additional regulator on OMAP5. Added
the support for requesting this new regulator through rpmsg
resource manager.
The bound check for the regulator id has also been made
robust.
Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r-- | drivers/rpmsg/rpmsg_resmgr.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/rpmsg/rpmsg_resmgr.c b/drivers/rpmsg/rpmsg_resmgr.c index e5c026e43f3..87e57199f1b 100644 --- a/drivers/rpmsg/rpmsg_resmgr.c +++ b/drivers/rpmsg/rpmsg_resmgr.c @@ -40,8 +40,9 @@ #include <plat/i2c.h> #include <plat/omap_hwmod.h> +#define OMAP4_REGULATOR_MAX 1 +#define OMAP5_REGULATOR_MAX 2 #define NAME_SIZE 50 -#define REGULATOR_MAX 1 #define NUM_SRC_CLK 3 #define AUX_CLK_MIN 0 #define AUX_CLK_MAX 5 @@ -53,7 +54,10 @@ static struct dentry *rprm_dbg; #if defined(CONFIG_REGULATOR) static char *regulator_name[] = { - "cam2pwr" + "cam2pwr", +#if defined(CONFIG_ARCH_OMAP5) + "cam2csi" +#endif }; #endif @@ -284,8 +288,10 @@ int rprm_regulator_request(struct rprm_elem *e, struct rprm_regulator *obj) int ret; struct rprm_regulator_depot *rd; char *reg_name; + int max_regulators = (cpu_is_omap54xx() ? OMAP5_REGULATOR_MAX : \ + OMAP4_REGULATOR_MAX); - if (obj->id > REGULATOR_MAX) { + if (!obj->id || obj->id > max_regulators) { pr_err("Invalid regulator %d\n", obj->id); return -EINVAL; } @@ -306,10 +312,16 @@ int rprm_regulator_request(struct rprm_elem *e, struct rprm_regulator *obj) rd->orig_uv = regulator_get_voltage(rd->reg_p); - ret = regulator_set_voltage(rd->reg_p, obj->min_uv, obj->max_uv); - if (ret) { - pr_err("%s: error setting %s voltage\n", __func__, reg_name); - goto error_reg; + /* OMAP5 Regulators are fixed voltage regulators, so do not call the + * set_voltage api and ignore the arguments */ + if (cpu_is_omap44xx()) { + ret = regulator_set_voltage(rd->reg_p, obj->min_uv, + obj->max_uv); + if (ret) { + pr_err("%s: error setting %s voltage\n", __func__, + reg_name); + goto error_reg; + } } ret = regulator_enable(rd->reg_p); |