msm: pil: Add module parameter to override proxy vote timeouts
For debugging purposes, it's sometimes useful to disable or adjust
proxy vote timeouts. Add a module parameter for this purpose.
If proxy_timeout is set to 0, proxy votes will remain asserted until
the peripheral is shutdown. If it's set to a positive value, the value
will be interpreted as override (in ms) for all proxy timeouts. The
default value (-1) will cause the timeout specified in the individual
PIL drivers to be used.
Change-Id: I74a111b8e4e62a15e01c4e2480b7127e84b9f467
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 0aafa35e3ee6c37c41d67d9e9e2b1eda69a17333)
diff --git a/arch/arm/mach-msm/peripheral-loader.c b/arch/arm/mach-msm/peripheral-loader.c
index 540ffbb..4ff34bf 100644
--- a/arch/arm/mach-msm/peripheral-loader.c
+++ b/arch/arm/mach-msm/peripheral-loader.c
@@ -34,6 +34,15 @@
#include "peripheral-loader.h"
+/**
+ * proxy_timeout - Override for proxy vote timeouts
+ * -1: Use driver-specified timeout
+ * 0: Hold proxy votes until shutdown
+ * >0: Specify a custom timeout in ms
+ */
+static int proxy_timeout_ms = -1;
+module_param(proxy_timeout_ms, int, S_IRUGO | S_IWUSR);
+
enum pil_state {
PIL_OFFLINE,
PIL_ONLINE,
@@ -127,7 +136,10 @@
static void pil_proxy_unvote(struct pil_device *pil, unsigned long timeout)
{
- if (pil->desc->ops->proxy_unvote)
+ if (proxy_timeout_ms >= 0)
+ timeout = proxy_timeout_ms;
+
+ if (timeout && pil->desc->ops->proxy_unvote)
schedule_delayed_work(&pil->proxy, msecs_to_jiffies(timeout));
}
@@ -393,7 +405,11 @@
static void pil_shutdown(struct pil_device *pil)
{
pil->desc->ops->shutdown(pil->desc);
- flush_delayed_work(&pil->proxy);
+ if (proxy_timeout_ms == 0 && pil->desc->ops->proxy_unvote)
+ pil->desc->ops->proxy_unvote(pil->desc);
+ else
+ flush_delayed_work(&pil->proxy);
+
pil_set_state(pil, PIL_OFFLINE);
}