aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2014-07-10 05:00:39 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-21 14:35:15 -0400
commitd19f405a5a8d2ed942b40f8cf7929a5a50d0cc59 (patch)
tree3b894f992f93397200629fe6a63efeb0640c84b4
parent69b9fe22b19b31d9de96d4a181f7206fd29ab743 (diff)
[media] s5p-mfc: Fix selective sclk_mfc init
fc906b6d "Remove special clock usage in driver" removed initialization of MFC special clock, arguing that there's no need to do it explicitly, since it's one of MFC gate clock's dependencies and gets enabled along with it. However, there's no promise of keeping this hierarchy across Exynos SoC releases, therefore this approach fails to provide a stable, portable solution. Out of all MFC versions, only v6 doesn't use special clock at all. For other versions log a message only in case clk_get fails, as not all the devices with the same MFC version require initializing the clock explicitly. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_pm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
index 11d5f1dada32..b6a8be97a96c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
@@ -21,6 +21,8 @@
21#include "s5p_mfc_pm.h" 21#include "s5p_mfc_pm.h"
22 22
23#define MFC_GATE_CLK_NAME "mfc" 23#define MFC_GATE_CLK_NAME "mfc"
24#define MFC_SCLK_NAME "sclk-mfc"
25#define MFC_SCLK_RATE (200 * 1000000)
24 26
25#define CLK_DEBUG 27#define CLK_DEBUG
26 28
@@ -50,6 +52,20 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
50 goto err_p_ip_clk; 52 goto err_p_ip_clk;
51 } 53 }
52 54
55 if (dev->variant->version != MFC_VERSION_V6) {
56 pm->clock = clk_get(&dev->plat_dev->dev, MFC_SCLK_NAME);
57 if (IS_ERR(pm->clock)) {
58 mfc_info("Failed to get MFC special clock control\n");
59 } else {
60 clk_set_rate(pm->clock, MFC_SCLK_RATE);
61 ret = clk_prepare_enable(pm->clock);
62 if (ret) {
63 mfc_err("Failed to enable MFC special clock\n");
64 goto err_s_clk;
65 }
66 }
67 }
68
53 atomic_set(&pm->power, 0); 69 atomic_set(&pm->power, 0);
54#ifdef CONFIG_PM_RUNTIME 70#ifdef CONFIG_PM_RUNTIME
55 pm->device = &dev->plat_dev->dev; 71 pm->device = &dev->plat_dev->dev;
@@ -59,6 +75,9 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
59 atomic_set(&clk_ref, 0); 75 atomic_set(&clk_ref, 0);
60#endif 76#endif
61 return 0; 77 return 0;
78
79err_s_clk:
80 clk_put(pm->clock);
62err_p_ip_clk: 81err_p_ip_clk:
63 clk_put(pm->clock_gate); 82 clk_put(pm->clock_gate);
64err_g_ip_clk: 83err_g_ip_clk:
@@ -67,6 +86,11 @@ err_g_ip_clk:
67 86
68void s5p_mfc_final_pm(struct s5p_mfc_dev *dev) 87void s5p_mfc_final_pm(struct s5p_mfc_dev *dev)
69{ 88{
89 if (dev->variant->version != MFC_VERSION_V6 &&
90 pm->clock) {
91 clk_disable_unprepare(pm->clock);
92 clk_put(pm->clock);
93 }
70 clk_unprepare(pm->clock_gate); 94 clk_unprepare(pm->clock_gate);
71 clk_put(pm->clock_gate); 95 clk_put(pm->clock_gate);
72#ifdef CONFIG_PM_RUNTIME 96#ifdef CONFIG_PM_RUNTIME