diff options
author | Dima Zavin <dima@android.com> | 2011-10-10 15:24:34 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:39:14 -0800 |
commit | b326fb875d174b8ec9dd0fdd47049f36b0da1583 (patch) | |
tree | 92c27a2276f1aab15ad5f12f0121de0484a62e1e /arch/arm/common | |
parent | 18127e16cfa980182fccdf6f3ea407b3ddf34e83 (diff) |
ARM: common: fiq_debugger: add suspend/resume handlers
Change-Id: If6eb75059fdf4867eb9a974d60b9d50e5e3350d4
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/fiq_debugger.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/arch/arm/common/fiq_debugger.c b/arch/arm/common/fiq_debugger.c index 6804b25f0810..7b037beb66d2 100644 --- a/arch/arm/common/fiq_debugger.c +++ b/arch/arm/common/fiq_debugger.c @@ -932,6 +932,26 @@ err: } #endif +static int fiq_debugger_dev_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct fiq_debugger_state *state = platform_get_drvdata(pdev); + + if (state->pdata->uart_dev_suspend) + return state->pdata->uart_dev_suspend(pdev); + return 0; +} + +static int fiq_debugger_dev_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct fiq_debugger_state *state = platform_get_drvdata(pdev); + + if (state->pdata->uart_dev_resume) + return state->pdata->uart_dev_resume(pdev); + return 0; +} + static int fiq_debugger_probe(struct platform_device *pdev) { int ret; @@ -970,6 +990,8 @@ static int fiq_debugger_probe(struct platform_device *pdev) state->signal_irq = platform_get_irq_byname(pdev, "signal"); state->wakeup_irq = platform_get_irq_byname(pdev, "wakeup"); + platform_set_drvdata(pdev, state); + if (state->wakeup_irq < 0 && debug_have_fiq(state)) state->no_sleep = true; state->ignore_next_wakeup_irq = !state->no_sleep; @@ -1068,13 +1090,22 @@ err_uart_init: if (state->clk) clk_put(state->clk); wake_lock_destroy(&state->debugger_wake_lock); + platform_set_drvdata(pdev, NULL); kfree(state); return ret; } +static const struct dev_pm_ops fiq_debugger_dev_pm_ops = { + .suspend = fiq_debugger_dev_suspend, + .resume = fiq_debugger_dev_resume, +}; + static struct platform_driver fiq_debugger_driver = { - .probe = fiq_debugger_probe, - .driver.name = "fiq_debugger", + .probe = fiq_debugger_probe, + .driver = { + .name = "fiq_debugger", + .pm = &fiq_debugger_dev_pm_ops, + }, }; static int __init fiq_debugger_init(void) |