fbdev: dpu20: power domain status check
authorChiHun Won <chihun.won@samsung.com>
Sat, 26 May 2018 00:35:15 +0000 (09:35 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:20 +0000 (20:22 +0300)
reviewed

Change-Id: Ic95e7c4a9b3b511a0feaa54cf2afaccc323af3e1
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
drivers/video/fbdev/exynos/dpu20/decon.h
drivers/video/fbdev/exynos/dpu20/decon_core.c
drivers/video/fbdev/exynos/dpu20/helper.c

index 15df9806b5ded9461e96aadc6e3dc8a10e00da77..d9ab75482fb30240c763ff19978e28d0d7b173e4 100644 (file)
@@ -31,6 +31,9 @@
 #if defined(CONFIG_EXYNOS_ITMON)
 #include <soc/samsung/exynos-itmon.h>
 #endif
+#if defined(CONFIG_EXYNOS_PD)
+#include <soc/samsung/exynos-pd.h>
+#endif
 #if defined(CONFIG_SUPPORT_LEGACY_ION)
 #include <linux/exynos_ion.h>
 #include <linux/ion.h>
@@ -683,6 +686,7 @@ struct decon_dt_info {
        int max_win;
        int dft_win;
        int dft_idma;
+       const char *pd_name;
 };
 
 struct decon_win {
@@ -897,6 +901,9 @@ struct decon_device {
 #if defined(CONFIG_EXYNOS_ITMON)
        struct notifier_block itmon_nb;
        bool notified;
+#endif
+#if defined(CONFIG_EXYNOS_PD)
+       struct exynos_pm_domain *pm_domain;
 #endif
        unsigned long prev_hdr_bits;
        struct exynos_hdr_static_info prev_hdr_info;
@@ -1257,7 +1264,9 @@ void dpu_init_cursor_mode(struct decon_device *decon);
 
 int dpu_sysmmu_fault_handler(struct iommu_domain *domain,
        struct device *dev, unsigned long iova, int flags, void *token);
-
+#if defined(CONFIG_EXYNOS_PD)
+int dpu_pm_domain_check_status(struct exynos_pm_domain *pm_domain);
+#endif
 int decon_set_out_sd_state(struct decon_device *decon, enum decon_state state);
 
 /* IOCTL commands */
index 54e327a536330520d93b5a6c08b553810824cf7e..a11d85235768ad7966d80ba069fd1fa3ffec734c 100644 (file)
@@ -777,6 +777,19 @@ static int _decon_disable(struct decon_device *decon, enum decon_state state)
        }
 
        decon->state = state;
+
+#if defined(CONFIG_EXYNOS_PD)
+       if (decon->pm_domain) {
+               if (dpu_pm_domain_check_status(decon->pm_domain)) {
+                       decon_info("decon%d %s still on\n", decon->id,
+                               decon->dt.pd_name);
+                       /* TODO : saimple dma/decon logging in cal code */
+               } else
+                       decon_info("decon%d %s off\n", decon->id,
+                               decon->dt.pd_name);
+       }
+#endif
+
 err:
        return ret;
 }
@@ -3378,6 +3391,15 @@ static void decon_parse_dt(struct decon_device *decon)
                                decon_info("Failed to get CAM0-STAT Reg\n");
                }
        }
+#if defined(CONFIG_EXYNOS_PD)
+       if (of_property_read_string(dev->of_node, "pd_name", &decon->dt.pd_name)) {
+               decon_info("no power domain\n");
+               decon->pm_domain = NULL;
+       } else {
+               decon_info("power domain: %s\n", decon->dt.pd_name);
+               decon->pm_domain = exynos_pd_lookup_name(decon->dt.pd_name);
+       }
+#endif
 }
 
 static int decon_init_resources(struct decon_device *decon,
index f7fe548899d88bf5ccdd3a7cbe116304db040612..3952c827b6e4481b5fe801fe5a293aa6921540e8 100644 (file)
@@ -694,3 +694,16 @@ int dpu_sysmmu_fault_handler(struct iommu_domain *domain,
 
        return 0;
 }
+
+#if defined(CONFIG_EXYNOS_PD)
+int dpu_pm_domain_check_status(struct exynos_pm_domain *pm_domain)
+{
+       if (!pm_domain || !pm_domain->check_status)
+               return 0;
+
+       if (pm_domain->check_status(pm_domain))
+               return 1;
+       else
+               return 0;
+}
+#endif