summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2010-08-30 10:22:01 -0500
committerRicardo Perez Olivares <x0081762@ti.com>2010-09-09 18:22:32 -0500
commit2b921ffa3dfd74daf5284021c25f002da2813e3f (patch)
treeb2d98c8c7fcab8c44ff536da3758ebba3796a721
parent7ead9a8aabfd8a1a8ab019693a0d80fc69713962 (diff)
omap:remoteproc - resource cleanup to call stop
This patch adds resource cleanup to call stop to the remote processor in the case where all the references to the remote proc are released, leaving the rproc in running state. This is so that the system can recover. Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--arch/arm/mach-omap2/remoteproc44xx.c2
-rw-r--r--arch/arm/plat-omap/include/plat/remoteproc.h6
-rw-r--r--arch/arm/plat-omap/remoteproc.c5
3 files changed, 12 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/remoteproc44xx.c b/arch/arm/mach-omap2/remoteproc44xx.c
index 373cd03f6c38..e752380e531c 100644
--- a/arch/arm/mach-omap2/remoteproc44xx.c
+++ b/arch/arm/mach-omap2/remoteproc44xx.c
@@ -54,6 +54,7 @@ static inline int proc44x_start(struct device *dev, u32 start_addr)
if (ret)
goto err_start;
+ obj->state = OMAP_RPROC_RUNNING;
return 0;
err_start:
@@ -79,6 +80,7 @@ static inline int proc44x_stop(struct device *dev)
OMAP4_CM1_ABE_TIMER5_CLKCTRL_OFFSET);
}
+ obj->state = OMAP_RPROC_STOPPED;
return ret;
}
diff --git a/arch/arm/plat-omap/include/plat/remoteproc.h b/arch/arm/plat-omap/include/plat/remoteproc.h
index 2047d4316cbc..a49c0ff3c043 100644
--- a/arch/arm/plat-omap/include/plat/remoteproc.h
+++ b/arch/arm/plat-omap/include/plat/remoteproc.h
@@ -56,6 +56,12 @@ enum {
OMAP_RPROC_STOP,
};
+/* RPROC states. */
+enum {
+ OMAP_RPROC_STOPPED,
+ OMAP_RPROC_RUNNING,
+};
+
struct omap_rproc_platform_data {
struct omap_rproc_ops *ops;
char *name;
diff --git a/arch/arm/plat-omap/remoteproc.c b/arch/arm/plat-omap/remoteproc.c
index edabdc6766a8..c69e5d023016 100644
--- a/arch/arm/plat-omap/remoteproc.c
+++ b/arch/arm/plat-omap/remoteproc.c
@@ -163,6 +163,7 @@ static int omap_rproc_open(struct inode *inode, struct file *filp)
static int omap_rproc_release(struct inode *inode, struct file *filp)
{
+ unsigned int count;
struct omap_rproc_platform_data *pdata;
struct omap_rproc *rproc = filp->private_data;
if (!rproc || !rproc->dev)
@@ -170,7 +171,9 @@ static int omap_rproc_release(struct inode *inode, struct file *filp)
pdata = rproc->dev->platform_data;
- atomic_dec(&rproc->count);
+ count = atomic_dec_return(&rproc->count);
+ if (!count && (rproc->state == OMAP_RPROC_RUNNING))
+ rproc_stop(rproc);
return 0;
}