[COMMON] media: scaler: add the shutdown callback
authorWon Jung <w00.jung@samsung.com>
Wed, 21 Sep 2016 08:34:07 +0000 (17:34 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:16 +0000 (20:22 +0300)
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 <w00.jung@samsung.com>
drivers/media/platform/exynos/scaler/scaler-core.c

index 642a9691d3d7d35fcef6d21e593465b71b9fd6d8..a15cc81ad745f1de73db073ecb5136ec63bef332 100644 (file)
@@ -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,