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: 5078441 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 C5816C11AC for ; Tue, 14 Oct 2014 07:16:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0E0220148 for ; Tue, 14 Oct 2014 07:16:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 150BA20142 for ; Tue, 14 Oct 2014 07:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754375AbaJNHQD (ORCPT ); Tue, 14 Oct 2014 03:16:03 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:62470 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915AbaJNHQB (ORCPT ); Tue, 14 Oct 2014 03:16:01 -0400 Received: by mail-la0-f54.google.com with SMTP id gm9so7752529lab.41 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=Pr3UHWyiA4jesAg2woNLhOAkfPJ7dV3gW3X8RR7FZivPDHM4J4ZwxWcQpIIKPsqn4e UVEwGbuAveeLSxAIE3iklwlVdOSBAp0G6FTtBM4kGEpeQmLSa+zc7X4fwSzEQdEOAgWW BRx2YutTi4mxwQAA0Cyt+BAO1eIIsLdTD3tIwNFSqHkfexde0DesLm1zvD2ICZQnMvAc CNn5Q5BieyyjWgYhatf4x3p7pfYl55BYk249IfPBsCUl8ZjwaML8nvlOCs0vmvrxA+GH kx1KrivBwQUsoKbckG0Z/I6RbhL5/YZMgq9VWjKBn+e/6uHg/fQBhrg1O525pt81Glk7 1jtQ== X-Gm-Message-State: ALoCoQn9n1F55cVq3fc0vFavcnf9tY4FJa5OHD4WzvAdi1u3sZTqp4ZVMCv90L1bQs3FjhZvihrj 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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=ham 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; }