From patchwork Tue Oct 14 07:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5078511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4B7E39F349 for ; Tue, 14 Oct 2014 07:16:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 461B12016C for ; Tue, 14 Oct 2014 07:16:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70B6B20166 for ; Tue, 14 Oct 2014 07:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754161AbaJNHQN (ORCPT ); Tue, 14 Oct 2014 03:16:13 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:39348 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754316AbaJNHQB (ORCPT ); Tue, 14 Oct 2014 03:16:01 -0400 Received: by mail-la0-f49.google.com with SMTP id q1so7982352lam.36 for ; Tue, 14 Oct 2014 00:15:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BgDPztiujAbbBfXyqzbnt3d1Hbmsc1RdNN1lhK1YzFo=; b=he+ReaVhMsiSLNWeFklDqL4TvArqIyWOhMJLvxGUEjQuQHI8Ea6vdVsOpx63/B1XcW vrgCcgAjTC76hysBU5ffxUnd6PxO7i6MFK4zIIOJL+JveZIP5oK0yg0ZfUcDo98df0s+ 5LXdC9UGu690+hAnqNBXWL1rQyEmXcbH25gmzc5FheIRiHVC/GhjlC8akAlhX+YunEzz DKqtmrEjVPTOjz5FzgCZ1UrI84c3ZS4QmF4ZCSeyW2ZT0QvFwU+BZbtg0H86bTT/d3XT aT10FaRdOqIDCCiBbLGeHGv3LR42Uz+MJTeeueHEB+jO3exnPKfxIDC75zPTNVkC3H4p Bpcw== X-Gm-Message-State: ALoCoQkOrCL5sb6D+/Jee2IiYe2UxUUYcJZBQNhILtArVia9H2X4NYrgMTuXgmTC/qfE1GtPGe8M X-Received: by 10.112.144.228 with SMTP id sp4mr3352704lbb.58.1413270959674; Tue, 14 Oct 2014 00:15:59 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id a2sm5279497lbs.21.2014.10.14.00.15.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 00:15:58 -0700 (PDT) From: Ulf Hansson To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Tomasz Figa , Kukjin Kim , Philipp Zabel , Sylwester Nawrocki , "Rafael J. Wysocki" , Pavel Machek , Ulf Hansson Subject: [PATCH 3/7] [media] exynos-gsc: Make driver functional without CONFIG_PM_RUNTIME Date: Tue, 14 Oct 2014 09:15:36 +0200 Message-Id: <1413270940-4378-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413270940-4378-1-git-send-email-ulf.hansson@linaro.org> References: <1413270940-4378-1-git-send-email-ulf.hansson@linaro.org> 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 driver depended on CONFIG_PM_RUNTIME to be functional, which isn't necessary. The solution to the above is to enable all runtime PM resourses during probe and update the device's runtime PM status to active. Since driver core invokes pm_request_idle() after ->probe(), unused gsc devices will be runtime PM suspended and thus we will still benefit from using CONFIG_PM_RUNTIME. Signed-off-by: Ulf Hansson --- drivers/media/platform/exynos-gsc/gsc-core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 13d0226..c3a050e 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1085,7 +1085,7 @@ static int gsc_probe(struct platform_device *pdev) return PTR_ERR(gsc->clock); } - ret = clk_prepare(gsc->clock); + ret = clk_prepare_enable(gsc->clock); if (ret) { dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n", GSC_CLOCK_GATE_NAME); @@ -1108,30 +1108,30 @@ static int gsc_probe(struct platform_device *pdev) goto err_v4l2; platform_set_drvdata(pdev, gsc); - pm_runtime_enable(dev); - ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - goto err_m2m; + + gsc_hw_set_sw_reset(gsc); + gsc_wait_reset(gsc); + gsc_m2m_resume(gsc); /* Initialize continious memory allocator */ gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev); if (IS_ERR(gsc->alloc_ctx)) { ret = PTR_ERR(gsc->alloc_ctx); - goto err_pm; + goto err_m2m; } dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id); - pm_runtime_put(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return 0; -err_pm: - pm_runtime_put(dev); err_m2m: gsc_unregister_m2m_device(gsc); err_v4l2: v4l2_device_unregister(&gsc->v4l2_dev); err_clk: - clk_unprepare(gsc->clock); + clk_disable_unprepare(gsc->clock); return ret; }