aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2013-01-23 03:05:21 -0800
committerZiyan <jaraidaniel@gmail.com>2016-04-03 14:56:11 +0200
commite1c6fce23182b44f8d9e27e6fba09cb64519d15e (patch)
tree99019d66ca3b4fba9ccf47ea84723e51d7fc25d4 /drivers/watchdog
parent51bcade11201207a7cf1ccc7aedae03c6ec20d37 (diff)
downloadkernel_samsung_tuna-e1c6fce23182b44f8d9e27e6fba09cb64519d15e.zip
kernel_samsung_tuna-e1c6fce23182b44f8d9e27e6fba09cb64519d15e.tar.gz
kernel_samsung_tuna-e1c6fce23182b44f8d9e27e6fba09cb64519d15e.tar.bz2
Watchdog: OMAP: Fix the runtime pm code to avoid module getting stuck intransition state.
OMAP watchdog driver is adapted to runtime PM like a general device driver but it is not appropriate. It is causing couple of functional issues. 1. On OMAP4 SYSCLK can't be gated, because of issue with WDTIMER2 module, which constantly stays in "in transition" state. Value of register CM_WKUP_WDTIMER2_CLKCTRL is always 0x00010000 in this case. Issue occurs immediately after first idle, when hwmod framework tries to disable WDTIMER2 functional clock - "wd_timer2_fck". After this module falls to "in transition" state, and SYSCLK gating is blocked. 2. Due to runtime PM, watchdog timer may be completely disabled. In current code base watchdog timer is not disabled only because of issue 1. Otherwise state of WDTIMER2 module will be "Disabled", and there will be no interrupts from omap_wdt. In other words watchdog will not work at all. Watchdong is a special IP and it should not be disabled otherwise purpose of it itself is defeated. Watchdog functional clock should never be disabled. This patch updates the runtime PM handling in driver so that runtime PM is limited only during probe/shutdown and suspend/resume. The patch fixes issue 1 and 2 Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> [steven@steven676.net: backport to p-android-omap3-3.0]
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/omap_wdt.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index d8d2e85..6f554ab 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -134,8 +134,6 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
u32 delay_period = GET_WLDR_VAL(timer_margin / 2);
void __iomem *base = wdev->base;
- pm_runtime_get_sync(wdev->dev);
-
/* just count up at 32 KHz */
while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x04)
cpu_relax();
@@ -148,8 +146,6 @@ static void omap_wdt_set_timeout(struct omap_wdt_dev *wdev)
while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 1 << 5)
cpu_relax();
__raw_writel(delay_period, base + OMAP_WATCHDOG_WDLY);
-
- pm_runtime_put_sync(wdev->dev);
}
@@ -159,11 +155,9 @@ static irqreturn_t omap_wdt_interrupt(int irq, void *dev_id)
void __iomem *base = wdev->base;
u32 i;
- pm_runtime_get_sync(wdev->dev);
omap_wdt_ping(wdev);
i = __raw_readl(base + OMAP_WATCHDOG_WIRQSTAT);
__raw_writel(i, base + OMAP_WATCHDOG_WIRQSTAT);
- pm_runtime_put_sync_suspend(wdev->dev);
return IRQ_HANDLED;
}
@@ -194,7 +188,6 @@ static int omap_wdt_setup(struct omap_wdt_dev *wdev)
omap_wdt_enable(wdev);
- pm_runtime_put_sync(wdev->dev);
return 0;
}
@@ -224,8 +217,6 @@ static int omap_wdt_release(struct inode *inode, struct file *file)
* Shut off the timer unless NOWAYOUT is defined.
*/
#ifndef CONFIG_WATCHDOG_NOWAYOUT
- pm_runtime_get_sync(wdev->dev);
-
omap_wdt_disable(wdev);
/* Disable delay interrupt */
@@ -248,11 +239,9 @@ static ssize_t omap_wdt_write(struct file *file, const char __user *data,
/* Refresh LOAD_TIME. */
if (len) {
- pm_runtime_get_sync(wdev->dev);
spin_lock(&wdt_lock);
omap_wdt_ping(wdev);
spin_unlock(&wdt_lock);
- pm_runtime_put_sync(wdev->dev);
}
return len;
}
@@ -284,18 +273,15 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
return put_user(omap_prcm_get_reset_sources(),
(int __user *)arg);
case WDIOC_KEEPALIVE:
- pm_runtime_get_sync(wdev->dev);
spin_lock(&wdt_lock);
omap_wdt_ping(wdev);
spin_unlock(&wdt_lock);
- pm_runtime_put_sync(wdev->dev);
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int __user *)arg))
return -EFAULT;
omap_wdt_adjust_timeout(new_margin);
- pm_runtime_get_sync(wdev->dev);
spin_lock(&wdt_lock);
omap_wdt_disable(wdev);
omap_wdt_set_timeout(wdev);
@@ -303,7 +289,6 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
omap_wdt_ping(wdev);
spin_unlock(&wdt_lock);
- pm_runtime_put_sync(wdev->dev);
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timer_margin, (int __user *)arg);
@@ -325,9 +310,7 @@ static int omap_wdt_nb_func(struct notifier_block *nb, unsigned long val,
void *v)
{
struct omap_wdt_dev *wdev = container_of(nb, struct omap_wdt_dev, nb);
- pm_runtime_get_sync(wdev->dev);
omap_wdt_ping(wdev);
- pm_runtime_put_sync_suspend(wdev->dev);
return NOTIFY_OK;
}
@@ -446,7 +429,6 @@ static void omap_wdt_shutdown(struct platform_device *pdev)
struct omap_wdt_dev *wdev = platform_get_drvdata(pdev);
if (wdev->omap_wdt_users) {
- pm_runtime_get_sync(wdev->dev);
omap_wdt_ping(wdev);
pm_runtime_put_sync(wdev->dev);
}
@@ -493,7 +475,6 @@ static int omap_wdt_suspend(struct device *dev)
struct omap_wdt_dev *wdev = platform_get_drvdata(pdev);
if (wdev->omap_wdt_users) {
- pm_runtime_get_sync(wdev->dev);
omap_wdt_disable(wdev);
pm_runtime_put_sync_suspend(wdev->dev);
}
@@ -510,7 +491,6 @@ static int omap_wdt_resume(struct device *dev)
pm_runtime_get_sync(wdev->dev);
omap_wdt_enable(wdev);
omap_wdt_ping(wdev);
- pm_runtime_put_sync_suspend(wdev->dev);
}
return 0;