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: 38689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6963C20549 for ; Tue, 14 Oct 2014 07:16:02 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e51sf4984716eek.3 for ; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=BgDPztiujAbbBfXyqzbnt3d1Hbmsc1RdNN1lhK1YzFo=; b=PsSN7M9Bfqb9DKMBrH/AO0M5rLutHTWx+4qc8SpGHCSTRViUp+NJvptytw+knXU6rJ O0qL3kVAgAiunldAlX2icCvo0Gr4Ygc6PPsUNUP2CjfVF4afll8zGVZpo9N1hA71RLO+ klBxYRRIok8/BiS7uh9bdHn/+vQJctbdRFDI4dVdVq23MywWvgBqAid6k0mD6CLMG51m 4hT9baEcLFZiHovy/vZTBOQavo6a0ERwJ28ZAtDPibs2dPHgq7JTYAK8AhDXYAWJ0Q5h DpwSPOZZfEuiDaUxcI5S4UWYEKT1so1bUVQy+9eZSpetarYuvgzvidhrIWmRWXTw8IU7 Rn2A== X-Gm-Message-State: ALoCoQlC40ucJNwXmOgi0Nv5Nkmgt1CF5neTYhPUeF9iHWrKeu1WXmXtkg6ykr1g2VEW5FFkzLPU X-Received: by 10.180.75.5 with SMTP id y5mr640592wiv.4.1413270961585; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.202 with SMTP id y10ls547164lad.51.gmail; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) X-Received: by 10.112.243.100 with SMTP id wx4mr3242751lbc.77.1413270961301; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id i3si25235888lae.59.2014.10.14.00.16.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 00:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so7646857lbv.10 for ; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr3301231lbc.23.1413270961188; Tue, 14 Oct 2014 00:16:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp345541lbz; Tue, 14 Oct 2014 00:16:00 -0700 (PDT) X-Received: by 10.152.205.103 with SMTP id lf7mr3501703lac.2.1413270959787; Tue, 14 Oct 2014 00:15:59 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id rp2si25153234lbb.100.2014.10.14.00.15.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 00:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id q1so7947854lam.32 for ; Tue, 14 Oct 2014 00:15:59 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; }