diff options
author | Iliyan Malchev <malchev@google.com> | 2011-09-29 10:12:43 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-09-29 12:13:43 -0700 |
commit | 7dd92cb9a8b9c6bb0f4b03afd26ea50ec90cfb73 (patch) | |
tree | 944a57abbea4e727e1f741c0cbd0180fffa0faec | |
parent | 3e00cedce6401c1d6c9507bbffd787cccafc0b7e (diff) | |
download | kernel_samsung_tuna-7dd92cb9a8b9c6bb0f4b03afd26ea50ec90cfb73.zip kernel_samsung_tuna-7dd92cb9a8b9c6bb0f4b03afd26ea50ec90cfb73.tar.gz kernel_samsung_tuna-7dd92cb9a8b9c6bb0f4b03afd26ea50ec90cfb73.tar.bz2 |
omap: rpmsg_resmgr: reserve i2c resources to a remoteproc
This patch locks out an I2C resource from the first time it is requested by a
remote processor. We do not undo the request, as the (temporary) assumption is
that the remote processor will not want to relinquish the resource.
Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r-- | drivers/rpmsg/rpmsg_resmgr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/rpmsg/rpmsg_resmgr.c b/drivers/rpmsg/rpmsg_resmgr.c index d785e89..aab668b 100644 --- a/drivers/rpmsg/rpmsg_resmgr.c +++ b/drivers/rpmsg/rpmsg_resmgr.c @@ -423,6 +423,7 @@ static void rprm_sdma_release(struct rprm_sdma *obj) static int rprm_i2c_request(struct rprm_elem *e, struct rprm_i2c *obj) { struct device *i2c_dev; + struct i2c_adapter *adapter; char i2c_name[NAME_SIZE]; int ret = -EINVAL; @@ -433,6 +434,14 @@ static int rprm_i2c_request(struct rprm_elem *e, struct rprm_i2c *obj) return ret; } + adapter = i2c_get_adapter(obj->id); + if (!adapter) { + pr_err("%s: could not get i2c%d adapter\n", __func__, obj->id); + return -EINVAL; + } + i2c_detect_ext_master(adapter); + i2c_put_adapter(adapter); + ret = pm_runtime_get_sync(i2c_dev); if (!ret) e->handle = i2c_dev; |