From: Won Jung Date: Wed, 21 Sep 2016 08:34:07 +0000 (+0900) Subject: [COMMON] media: scaler: add the shutdown callback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4bf3a977d88cdc8a0f0cdb6eb92f2fe65d1153bf;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: scaler: add the shutdown callback if shutdown, scaler 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: I7a2367ff02faf7355d11b9ca23661bb6e3ec8629 Signed-off-by: Won Jung --- diff --git a/drivers/media/platform/exynos/scaler/scaler-core.c b/drivers/media/platform/exynos/scaler/scaler-core.c index 642a9691d3d7..a15cc81ad745 100644 --- a/drivers/media/platform/exynos/scaler/scaler-core.c +++ b/drivers/media/platform/exynos/scaler/scaler-core.c @@ -3647,6 +3647,21 @@ static int sc_remove(struct platform_device *pdev) return 0; } +static void sc_shutdown(struct platform_device *pdev) +{ + struct sc_dev *sc = platform_get_drvdata(pdev); + unsigned long flags; + + spin_lock_irqsave(&sc->slock, flags); + set_bit(DEV_SUSPEND, &sc->state); + spin_unlock_irqrestore(&sc->slock, flags); + + wait_event(sc->wait, + !test_bit(DEV_RUN, &sc->state)); + + iovmm_deactivate(sc->dev); +} + static const struct of_device_id exynos_sc_match[] = { { .compatible = "samsung,exynos5-scaler", @@ -3658,6 +3673,7 @@ MODULE_DEVICE_TABLE(of, exynos_sc_match); static struct platform_driver sc_driver = { .probe = sc_probe, .remove = sc_remove, + .shutdown = sc_shutdown, .driver = { .name = MODULE_NAME, .owner = THIS_MODULE,