From patchwork Fri Jun 14 18:04:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2722861 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 AB92EC0AB1 for ; Fri, 14 Jun 2013 18:05:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D20C20379 for ; Fri, 14 Jun 2013 18:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0C8F20369 for ; Fri, 14 Jun 2013 18:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752784Ab3FNSFI (ORCPT ); Fri, 14 Jun 2013 14:05:08 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:39554 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752579Ab3FNSFH (ORCPT ); Fri, 14 Jun 2013 14:05:07 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOE00GZZA8G0A40@mailout3.samsung.com>; Sat, 15 Jun 2013 03:05:04 +0900 (KST) X-AuditID: cbfee61b-b7f8e6d00000524c-aa-51bb5b500a4c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id BF.D4.21068.05B5BB15; Sat, 15 Jun 2013 03:05:04 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOE00LTXA7Q0O60@mmp2.samsung.com>; Sat, 15 Jun 2013 03:05:04 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, kyungmin.park@samsung.com, Sylwester Nawrocki Subject: [PATCH] exynos4-is: Fix FIMC-IS clocks initialization Date: Fri, 14 Jun 2013 20:04:28 +0200 Message-id: <1371233068-4165-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNJMWRmVeSWpSXmKPExsVy+t9jQd2A6N2BBi8PmVicbXrDbtGzYSur xYzz+5gsDr9pZ3Vg8ejbsorR4/MmuQCmKC6blNSczLLUIn27BK6Maz9usRbcE6/ofhLfwHhA uIuRk0NCwETi4dp+NghbTOLCvfVgtpDAdEaJ65/Yuxi5gOwOJolDk04xgSTYBAwleo/2MYLY IgLyEk96b4A1MAvkS2yauZMFxBYWsJO4tuYUO4jNIqAqsXPDa7BeXgFXibnXlwH1cgAtU5CY M8lmAiP3AkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjBXn4mvYNxVYPFIUYBDkYlHt4J arsDhVgTy4orcw8xSnAwK4nw3lUFCvGmJFZWpRblxxeV5qQWH2KU5mBREuc92GodKCSQnliS mp2aWpBaBJNl4uCUamDk4zzo+CeYsZa19NmK7Ip2McctFWtX3nVVe9B15UtqaIDnquqHd42i jJjaLNxnC/y2r7o1I7MyK8m78p/Ky5+cGxgNNO7ruPSH7hLOnRrIs/yV3EHJW4c92/yMkwI8 Nng8ZGvt6lj8/c0rlU65/3vV8rXWz311butEj6AE919bHlyRTVWw6VZiKc5INNRiLipOBADQ eyL47gEAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 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 The ISP clock register content is not preserved over the ISP power domain off/on cycle. Instead of setting the clock frequencies once at probe time the clock rates set up is moved to the runtime_resume handler, which is invoked after the related power domain is already enabled, ensuring the clocks are properly when the device is actively used. This fixes the FIMC-IS malfunctions and STREAM ON timeout errors accuring on some boards: [ 59.860000] fimc_is_general_irq_handler:583 ISR_NDONE: 5: 0x800003e8, IS_ERROR_UNKNOWN [ 59.860000] fimc_is_general_irq_handler:586 IS_ERROR_TIME_OUT Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park clk_init = true; - is->alloc_ctx = vb2_dma_contig_init_ctx(dev); if (IS_ERR(is->alloc_ctx)) { ret = PTR_ERR(is->alloc_ctx); @@ -875,6 +863,8 @@ static int fimc_is_probe(struct platform_device *pdev) if (ret < 0) goto err_dfs; + pm_runtime_put_sync(dev); + dev_dbg(dev, "FIMC-IS registered successfully\n"); return 0; @@ -894,9 +884,11 @@ err_clk: static int fimc_is_runtime_resume(struct device *dev) { struct fimc_is *is = dev_get_drvdata(dev); + int ret; - if (!is->clk_init) - return 0; + ret = fimc_is_setup_clocks(is); + if (ret) + return ret; return fimc_is_enable_clocks(is); } @@ -905,9 +897,7 @@ static int fimc_is_runtime_suspend(struct device *dev) { struct fimc_is *is = dev_get_drvdata(dev); - if (is->clk_init) - fimc_is_disable_clocks(is); - + fimc_is_disable_clocks(is); return 0; } diff --git a/drivers/media/platform/exynos4-is/fimc-is.h b/drivers/media/platform/exynos4-is/fimc-is.h index 04b4564..c5ce6a2 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.h +++ b/drivers/media/platform/exynos4-is/fimc-is.h @@ -264,7 +264,6 @@ struct fimc_is { spinlock_t slock; struct clk *clocks[ISS_CLKS_MAX]; - bool clk_init; void __iomem *regs; void __iomem *pmu_regs; int irq;