[RAMEN9610-10029][COMMON] media: mfc: add to check clock before register dump
authorSunyoung Kang <sy0816.kang@samsung.com>
Thu, 25 Oct 2018 06:32:10 +0000 (15:32 +0900)
committerhskang <hs1218.kang@samsung.com>
Fri, 28 Dec 2018 09:54:06 +0000 (18:54 +0900)
This adds to check the clock and power state before register dump.

Change-Id: I315b6346c6175232a87453f603292fe8a547ff83
Signed-off-by: Sunyoung Kang <sy0816.kang@samsung.com>
drivers/media/platform/exynos/mfc/mfc_watchdog.c

index 66b59109a2bc9b0391d9291d5023ef7f313eafa5..df445f258d45a4aae648b17bc689b73a774affc1 100644 (file)
@@ -57,6 +57,13 @@ static void __mfc_dump_regs(struct mfc_dev *dev)
        pr_err("-----------dumping MFC registers (SFR base = 0x%p, dev = 0x%p)\n",
                                dev->regs_base, dev);
 
+       if (!mfc_pm_get_pwr_ref_cnt(dev) || !mfc_pm_get_clk_ref_cnt(dev)) {
+               pr_err("Power(%d) or clock(%d) is not enabled\n",
+                               mfc_pm_get_pwr_ref_cnt(dev),
+                               mfc_pm_get_clk_ref_cnt(dev));
+               return;
+       }
+
        mfc_enable_all_clocks(dev);
 
        for (i = 0; i < MFC_SFR_AREA_COUNT; i++) {
@@ -367,6 +374,14 @@ static void __mfc_dump_info_without_regs(struct mfc_dev *dev)
 static void __mfc_dump_info(struct mfc_dev *dev)
 {
        __mfc_dump_info_without_regs(dev);
+
+       if (!mfc_pm_get_pwr_ref_cnt(dev) || !mfc_pm_get_clk_ref_cnt(dev)) {
+               pr_err("Power(%d) or clock(%d) is not enabled\n",
+                               mfc_pm_get_pwr_ref_cnt(dev),
+                               mfc_pm_get_clk_ref_cnt(dev));
+               return;
+       }
+
        __mfc_save_logging_sfr(dev);
        __mfc_dump_buffer_info(dev);
        __mfc_dump_regs(dev);