From patchwork Fri Dec 20 22:23:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 3392191 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 1DB74C0D4A for ; Fri, 20 Dec 2013 22:24:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4861D20686 for ; Fri, 20 Dec 2013 22:24:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A96C20647 for ; Fri, 20 Dec 2013 22:24:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754317Ab3LTWY2 (ORCPT ); Fri, 20 Dec 2013 17:24:28 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:53960 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797Ab3LTWYX (ORCPT ); Fri, 20 Dec 2013 17:24:23 -0500 Received: by mail-wi0-f179.google.com with SMTP id z2so4316266wiv.6 for ; Fri, 20 Dec 2013 14:24:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PhsFVFXwguWHkgza8cRXtLKpS5HOAjIxEwIU3zAXWsQ=; b=ncw0WhQr8dMSymUH5wneA13B53DnBC/O/fQRQLZgZJ97h1xS1NF6pN74AeygWR+Wan a990ryHWsTcIVM/bppFXSk/DSdBqXaYGttSoVoLUvy6HI6Dth8h3UbjZh+rrKmQ6J+M2 EiJi4We3TQLLmNO98P98ksWn6o6EkdUshkV1yjHGcMvp8DKNit95iUXO/BHP8YCrVQDM 7H3R80fvPzI4W6kpehbAeSelC/4oSk/3HY7XLTdBBi+w9QWInjpMfid3t2ezmMQqMGFe hP7NGiw3hC3445NeakKkyhMxCdoJ2TwFC9UTfixhSOM6SR4XI1j+3a6YIskbEKYfd+UR xj5g== X-Received: by 10.194.61.211 with SMTP id s19mr34235wjr.73.1387578262316; Fri, 20 Dec 2013 14:24:22 -0800 (PST) Received: from localhost.localdomain (093105185086.warszawa.vectranet.pl. [93.105.185.86]) by mx.google.com with ESMTPSA id xl18sm19612162wib.9.2013.12.20.14.24.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Dec 2013 14:24:21 -0800 (PST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH 5/6] exynos4-is: Enable fimc-is clocks in probe() if runtime PM is disabled Date: Fri, 20 Dec 2013 23:23:26 +0100 Message-Id: <1387578207-17625-6-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1387578207-17625-1-git-send-email-s.nawrocki@samsung.com> References: <1387578207-17625-1-git-send-email-s.nawrocki@samsung.com> 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.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Ensure the device works also when runtime PM is disabled. This will allow to drop an incorrect dependency on PM_RUNTIME. Signed-off-by: Sylwester Nawrocki --- drivers/media/platform/exynos4-is/fimc-is.c | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 8cb70c2..13a4228 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -781,6 +781,9 @@ static int fimc_is_debugfs_create(struct fimc_is *is) return is->debugfs_entry == NULL ? -EIO : 0; } +static int fimc_is_runtime_resume(struct device *dev); +static int fimc_is_runtime_suspend(struct device *dev); + static int fimc_is_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -835,14 +838,20 @@ static int fimc_is_probe(struct platform_device *pdev) } pm_runtime_enable(dev); + if (!pm_runtime_enabled(dev)) { + ret = fimc_is_runtime_resume(dev); + if (ret < 0) + goto err_irq; + } + ret = pm_runtime_get_sync(dev); if (ret < 0) - goto err_irq; + goto err_pm; is->alloc_ctx = vb2_dma_contig_init_ctx(dev); if (IS_ERR(is->alloc_ctx)) { ret = PTR_ERR(is->alloc_ctx); - goto err_irq; + goto err_pm; } /* * Register FIMC-IS V4L2 subdevs to this driver. The video nodes @@ -871,6 +880,9 @@ err_sd: fimc_is_unregister_subdevs(is); err_vb: vb2_dma_contig_cleanup_ctx(is->alloc_ctx); +err_pm: + if (!pm_runtime_enabled(dev)) + fimc_is_runtime_suspend(dev); err_irq: free_irq(is->irq, is); err_clk: @@ -919,10 +931,13 @@ static int fimc_is_suspend(struct device *dev) static int fimc_is_remove(struct platform_device *pdev) { - struct fimc_is *is = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + struct fimc_is *is = dev_get_drvdata(dev); - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + if (!pm_runtime_status_suspended(dev)) + fimc_is_runtime_suspend(dev); free_irq(is->irq, is); fimc_is_unregister_subdevs(is); vb2_dma_contig_cleanup_ctx(is->alloc_ctx);