aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg/rpmsg_resmgr.c
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2011-09-29 10:12:43 -0700
committerIliyan Malchev <malchev@google.com>2011-09-29 12:13:43 -0700
commit7dd92cb9a8b9c6bb0f4b03afd26ea50ec90cfb73 (patch)
tree944a57abbea4e727e1f741c0cbd0180fffa0faec /drivers/rpmsg/rpmsg_resmgr.c
parent3e00cedce6401c1d6c9507bbffd787cccafc0b7e (diff)
downloadkernel_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>
Diffstat (limited to 'drivers/rpmsg/rpmsg_resmgr.c')
-rw-r--r--drivers/rpmsg/rpmsg_resmgr.c9
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;