summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSubramaniam Chanderashekarapuram <subramaniam.ca@ti.com>2012-07-20 14:22:38 -0500
committerAndy Green <andy.green@linaro.org>2012-09-07 13:06:46 +0800
commitb2b054a505840bca123dda46d86923bc97587c16 (patch)
tree3882d444f19c9b54636da17d821196b4da6f3fc2 /arch
parent93ce91e676f41a1f597ab7edd7f535e9efeb675d (diff)
omap: mailbox: fix api used by mailbox to hold a latency constraint
dev_pm_qos API are currently used to hold a latency constraint on mailbox, which is present in the core power domain. This effectively holds a constraint on the core power domain. However, the pm core uses pm_qos APIs to control the latency of the core domain and thus the C-states in OMAP. The two sets of interfaces (pm_qos and dev_pm_qos) are de-coupled and thus cannot be used at the same time to control latency values for core domain. The mailbox latency code has therefore been modified to use the pm_qos API for holding latency constraints, so that the pm core code has a consistent view of the constraints set on core power domain. Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com> Signed-off-by: Paul Hunt <hunt@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-omap/include/plat/mailbox.h2
-rw-r--r--arch/arm/plat-omap/mailbox.c57
2 files changed, 22 insertions, 37 deletions
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
index 4716d190c141..8e9a44c2a321 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -8,7 +8,6 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kfifo.h>
-#include <linux/pm_qos.h>
typedef u32 mbox_msg_t;
struct omap_mbox;
@@ -62,7 +61,6 @@ struct omap_mbox {
void *priv;
int use_count;
struct blocking_notifier_head notifier;
- struct dev_pm_qos_request qos_request;
unsigned int pm_constraint;
};
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 083ce46f38fe..7c616333070b 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -32,6 +32,7 @@
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/pm_qos.h>
#include <plat/mailbox.h>
@@ -39,6 +40,10 @@ static struct omap_mbox **mboxes;
static int mbox_configured;
static DEFINE_MUTEX(mbox_configured_lock);
+static struct pm_qos_request mbox_qos_request;
+
+#define SET_MPU_CORE_CONSTRAINT 10
+#define CLEAR_MPU_CORE_CONSTRAINT PM_QOS_DEFAULT_VALUE
static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
module_param(mbox_kfifo_size, uint, S_IRUGO);
@@ -294,23 +299,15 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
{
int ret = 0;
struct omap_mbox_queue *mq;
- int fail_constraint = 0;
mutex_lock(&mbox_configured_lock);
omap_mbox_enable(mbox);
if (!mbox_configured++) {
- if (mbox->pm_constraint) {
- ret = dev_pm_qos_update_request(&mbox->qos_request,
- mbox->pm_constraint);
- if (ret < 0) {
- fail_constraint = 1;
- dev_err(mbox->dev,
- "failed to update qos constraint\n");
- goto fail_startup;
- }
- }
+ if (mbox->pm_constraint)
+ pm_qos_update_request(&mbox_qos_request,
+ SET_MPU_CORE_CONSTRAINT);
if (likely(mbox->ops->startup)) {
ret = mbox->ops->startup(mbox);
if (unlikely(ret))
@@ -364,14 +361,9 @@ fail_alloc_txq:
mbox->ops->shutdown(mbox);
mbox->use_count--;
fail_startup:
- if (!--mbox_configured)
- if (mbox->pm_constraint && !fail_constraint) {
- if (dev_pm_qos_update_request(&mbox->qos_request,
- PM_QOS_DEFAULT_VALUE) < 0)
- dev_err(mbox->dev,
- "failed to relax qos constraint\n");
-
- }
+ if (!--mbox_configured && mbox->pm_constraint)
+ pm_qos_update_request(&mbox_qos_request,
+ CLEAR_MPU_CORE_CONSTRAINT);
mutex_unlock(&mbox_configured_lock);
return ret;
}
@@ -391,11 +383,9 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
if (likely(mbox->ops->shutdown)) {
if (!--mbox_configured) {
mbox->ops->shutdown(mbox);
- if (mbox->pm_constraint &&
- (dev_pm_qos_update_request(&mbox->qos_request,
- PM_QOS_DEFAULT_VALUE) < 0))
- dev_err(mbox->dev,
- "failed to relax qos constraint\n");
+ if (mbox->pm_constraint)
+ pm_qos_update_request(&mbox_qos_request,
+ CLEAR_MPU_CORE_CONSTRAINT);
}
}
@@ -473,11 +463,6 @@ int omap_mbox_register(struct device *parent, struct omap_mbox **list)
goto err_out;
}
- ret = dev_pm_qos_add_request(parent, &mbox->qos_request,
- PM_QOS_DEFAULT_VALUE);
- if (ret < 0)
- goto err_out;
-
BLOCKING_INIT_NOTIFIER_HEAD(&mbox->notifier);
}
@@ -486,10 +471,8 @@ int omap_mbox_register(struct device *parent, struct omap_mbox **list)
return 0;
err_out:
- while (i--) {
- dev_pm_qos_remove_request(&mboxes[i]->qos_request);
+ while (i--)
device_unregister(mboxes[i]->dev);
- }
return ret;
}
EXPORT_SYMBOL(omap_mbox_register);
@@ -501,10 +484,9 @@ int omap_mbox_unregister(struct device *parent)
if (!mboxes)
return -EINVAL;
- for (i = 0; mboxes[i]; i++) {
- dev_pm_qos_remove_request(&mboxes[i]->qos_request);
+ for (i = 0; mboxes[i]; i++)
device_unregister(mboxes[i]->dev);
- }
+
mboxes = NULL;
pm_runtime_disable(parent);
@@ -525,12 +507,17 @@ static int __init omap_mbox_init(void)
mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size,
sizeof(mbox_msg_t));
+
+ pm_qos_add_request(&mbox_qos_request, PM_QOS_CPU_DMA_LATENCY,
+ PM_QOS_DEFAULT_VALUE);
+
return 0;
}
subsys_initcall(omap_mbox_init);
static void __exit omap_mbox_exit(void)
{
+ pm_qos_remove_request(&mbox_qos_request);
class_unregister(&omap_mbox_class);
}
module_exit(omap_mbox_exit);