From patchwork Thu Jul 10 09:00:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 4522301 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D5EA4BEEAA for ; Thu, 10 Jul 2014 09:00:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07834202B4 for ; Thu, 10 Jul 2014 09:00:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E39802024C for ; Thu, 10 Jul 2014 09:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbaGJJAv (ORCPT ); Thu, 10 Jul 2014 05:00:51 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:31857 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752055AbaGJJAs (ORCPT ); Thu, 10 Jul 2014 05:00:48 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8H00ACQNPB2Z40@mailout1.samsung.com> for linux-media@vger.kernel.org; Thu, 10 Jul 2014 18:00:47 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-f1-53be563e2bfc Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 5D.86.04943.E365EB35; Thu, 10 Jul 2014 18:00:47 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8H00J2JNP4CC80@mmp1.samsung.com>; Thu, 10 Jul 2014 18:00:46 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: arun.kk@samsung.com, k.debski@samsung.com, jtp.park@samsung.com, b.zolnierkie@samsung.com, kyungmin.park@samsung.com, sw0312.kim@samsung.com, Jacek Anaszewski Subject: [PATCH v2 1/3] s5p-mfc: Fix selective sclk_mfc init Date: Thu, 10 Jul 2014 11:00:39 +0200 Message-id: <1404982839-23577-1-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIJMWRmVeSWpSXmKPExsVy+t9jAV37sH3BBuvns1l8PHWb1WLjjPWs Fr1XnzNaHFl7lcnix+sLbBZnm96wW/Rs2MpqMWPySzYHDo++LasYPT5vkgtgiuKySUnNySxL LdK3S+DK2P5lOVPBA+GKXQ9fsjUwrhfoYuTkkBAwkdj0dzcLhC0mceHeerYuRi4OIYFFjBK3 WleyQzjtTBJTvvexg1SxCRhK/HzxmgnEFhGQl3jSewOsg1ngIKPE1gn/wUYJC9hIdN5/BWaz CKhK9D5/w9rFyMHBK+Ah8fIhM4gpIaAgMWeSzQRG7gWMDKsYRVMLkguKk9JzDfWKE3OLS/PS 9ZLzczcxggPimdQOxpUNFocYBTgYlXh4G3r2BguxJpYVV+YeYpTgYFYS4d1mty9YiDclsbIq tSg/vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwTB6dUA6N12AIZo6LnXM0aTv1b 4iYLXft8aLHeoe/cldszlYJtrsn131wqy3Y+96DBNfP3XztyThl/K5eLf7bk7p1NjgWzJfZf +nteQ5h35gGF/TWCGg1PL7DuNymRnL3P4PpH196j/n/jnmfWCvqnn9yx4/qOFTf6K2f39PFO d/XoneLP/NCzeE18o5gSS3FGoqEWc1FxIgBBlKLaBAIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Seung-Woo Kim Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 11d5f1d..b6a8be9 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 @@ #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,6 +52,20 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) 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 pm->device = &dev->plat_dev->dev; @@ -59,6 +75,9 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) 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,6 +86,11 @@ err_g_ip_clk: 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