From a76301934dfcd2db2a425c75367a8f818c364d68 Mon Sep 17 00:00:00 2001 From: ChiHun Won Date: Sat, 26 May 2018 09:35:15 +0900 Subject: [PATCH] fbdev: dpu20: power domain status check reviewed Change-Id: Ic95e7c4a9b3b511a0feaa54cf2afaccc323af3e1 Signed-off-by: ChiHun Won --- drivers/video/fbdev/exynos/dpu20/decon.h | 11 +++++++++- drivers/video/fbdev/exynos/dpu20/decon_core.c | 22 +++++++++++++++++++ drivers/video/fbdev/exynos/dpu20/helper.c | 13 +++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/exynos/dpu20/decon.h b/drivers/video/fbdev/exynos/dpu20/decon.h index 15df9806b5de..d9ab75482fb3 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon.h +++ b/drivers/video/fbdev/exynos/dpu20/decon.h @@ -31,6 +31,9 @@ #if defined(CONFIG_EXYNOS_ITMON) #include #endif +#if defined(CONFIG_EXYNOS_PD) +#include +#endif #if defined(CONFIG_SUPPORT_LEGACY_ION) #include #include @@ -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 */ diff --git a/drivers/video/fbdev/exynos/dpu20/decon_core.c b/drivers/video/fbdev/exynos/dpu20/decon_core.c index 54e327a53633..a11d85235768 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon_core.c +++ b/drivers/video/fbdev/exynos/dpu20/decon_core.c @@ -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, diff --git a/drivers/video/fbdev/exynos/dpu20/helper.c b/drivers/video/fbdev/exynos/dpu20/helper.c index f7fe548899d8..3952c827b6e4 100644 --- a/drivers/video/fbdev/exynos/dpu20/helper.c +++ b/drivers/video/fbdev/exynos/dpu20/helper.c @@ -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 -- 2.20.1