From ae2bc11e05152a9aa6158e408186c07e81ae4340 Mon Sep 17 00:00:00 2001 From: Won Jung Date: Thu, 22 Sep 2016 16:48:03 +0900 Subject: [PATCH] [COMMON] media: smfc: add the shutdown callback if shutdown, smfc driver should wait to finish the H/W operation to avoid the access the power domain/ clk after the detach of pm_domain Change-Id: I7328be4c4c4ef15ba578c5c44e3ba5396592fcce Signed-off-by: Won Jung --- drivers/media/platform/exynos/smfc/smfc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/exynos/smfc/smfc.c b/drivers/media/platform/exynos/smfc/smfc.c index 39d2f7bab80b..628953027d9d 100644 --- a/drivers/media/platform/exynos/smfc/smfc.c +++ b/drivers/media/platform/exynos/smfc/smfc.c @@ -993,6 +993,19 @@ static int smfc_runtime_suspend(struct device *dev) } #endif +static void exynos_smfc_shutdown(struct platform_device *pdev) +{ + DECLARE_WAIT_QUEUE_HEAD_ONSTACK(smfc_suspend_wq); + struct smfc_dev *smfc = platform_get_drvdata(pdev); + unsigned long flags; + + spin_lock_irqsave(&smfc->flag_lock, flags); + if (!!(smfc->flags & SMFC_DEV_RUNNING)) + smfc->flags |= SMFC_DEV_SUSPENDING; + spin_unlock_irqrestore(&smfc->flag_lock, flags); + wait_event(smfc_suspend_wq, !(smfc->flags & SMFC_DEV_SUSPENDING)); +} + static const struct dev_pm_ops exynos_smfc_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(smfc_suspend, smfc_resume) SET_RUNTIME_PM_OPS(NULL, smfc_runtime_resume, smfc_runtime_suspend) @@ -1001,6 +1014,7 @@ static const struct dev_pm_ops exynos_smfc_pm_ops = { static struct platform_driver exynos_smfc_driver = { .probe = exynos_smfc_probe, .remove = exynos_smfc_remove, + .shutdown = exynos_smfc_shutdown, .driver = { .name = MODULE_NAME, .owner = THIS_MODULE, -- 2.20.1