--- zzzz-none-000/linux-3.10.107/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c 2021-02-04 17:41:59.000000000 +0000 @@ -13,14 +13,14 @@ #include #include #include -#ifdef CONFIG_PM_RUNTIME #include -#endif #include "s5p_mfc_common.h" #include "s5p_mfc_debug.h" #include "s5p_mfc_pm.h" #define MFC_GATE_CLK_NAME "mfc" +#define MFC_SCLK_NAME "sclk_mfc" +#define MFC_SCLK_RATE (200 * 1000000) #define CLK_DEBUG @@ -50,8 +50,22 @@ goto err_p_ip_clk; } + if (dev->variant->version != MFC_VERSION_V6) { + pm->clock = clk_get(&dev->plat_dev->dev, MFC_SCLK_NAME); + if (IS_ERR(pm->clock)) { + mfc_info("Failed to get MFC special clock control\n"); + } else { + clk_set_rate(pm->clock, MFC_SCLK_RATE); + ret = clk_prepare_enable(pm->clock); + if (ret) { + mfc_err("Failed to enable MFC special clock\n"); + goto err_s_clk; + } + } + } + atomic_set(&pm->power, 0); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM pm->device = &dev->plat_dev->dev; pm_runtime_enable(pm->device); #endif @@ -59,6 +73,9 @@ atomic_set(&clk_ref, 0); #endif return 0; + +err_s_clk: + clk_put(pm->clock); err_p_ip_clk: clk_put(pm->clock_gate); err_g_ip_clk: @@ -67,9 +84,14 @@ void s5p_mfc_final_pm(struct s5p_mfc_dev *dev) { + if (dev->variant->version != MFC_VERSION_V6 && + pm->clock) { + clk_disable_unprepare(pm->clock); + clk_put(pm->clock); + } clk_unprepare(pm->clock_gate); clk_put(pm->clock_gate); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM pm_runtime_disable(pm->device); #endif } @@ -96,7 +118,7 @@ int s5p_mfc_power_on(void) { -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM return pm_runtime_get_sync(pm->device); #else atomic_set(&pm->power, 1); @@ -106,7 +128,7 @@ int s5p_mfc_power_off(void) { -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM return pm_runtime_put_sync(pm->device); #else atomic_set(&pm->power, 0);