From patchwork Mon Jan 19 13:22:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5658871 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8C9A7C058D for ; Mon, 19 Jan 2015 13:31:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC88B20389 for ; Mon, 19 Jan 2015 13:31:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09C6F20383 for ; Mon, 19 Jan 2015 13:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbbASNbU (ORCPT ); Mon, 19 Jan 2015 08:31:20 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:44648 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbbASNbT (ORCPT ); Mon, 19 Jan 2015 08:31:19 -0500 Received: by mail-lb0-f172.google.com with SMTP id l4so15442828lbv.3 for ; Mon, 19 Jan 2015 05:31:18 -0800 (PST) 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=/vJJ/K4zl83ZBd0U3KnsxKyGTXMXJWXpGyk1YwSYssc=; b=N/bu7YaE2WkqY5IsDPX8hpLG+D+pMlLwr3jUmQcvKOq21OE+Wb4Q+wdOTgR7ciLQ7S 3s99OQmuXMGYzIEiHtuHThgdxOdXHDLdo8IOmxoo/BGG8Y5TY7uwyktfenmcylcKDSrU 1mDvLLVxt2bC9g3Cy8QMRTeHlxWjiSpFSlwWnE5Z3IiihpeSaBgonBuYw/3ZmsJU62EN gpNA5sKjPPR7maNvS4T/E4AgzT2UugurPbWN1618jsByl97pLfY7jw6xLLWp3ryJ3qZq FO2xCJ+FQSpuAV3UGFlFfb28Q+iq7DCs0jKQE4ORcpdOw13VW7+w91AH8f0tQRnm44oU a0uw== X-Gm-Message-State: ALoCoQknKd3wapdopRIcw82CuXlybRyZQtFKp+unSLwRqgH0GWq1dzsov05TRmMzjixyP9RMqByi X-Received: by 10.152.205.75 with SMTP id le11mr30889328lac.20.1421673784610; Mon, 19 Jan 2015 05:23:04 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id v4sm3080344lbz.12.2015.01.19.05.23.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jan 2015 05:23:03 -0800 (PST) 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, Kukjin Kim , Sylwester Nawrocki , Kyungmin Park , Ulf Hansson Subject: [PATCH V2 5/8] [media] exynos-gsc: Fixup clock management at ->remove() Date: Mon, 19 Jan 2015 14:22:37 +0100 Message-Id: <1421673760-2600-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421673760-2600-1-git-send-email-ulf.hansson@linaro.org> References: <1421673760-2600-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=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 To make sure the clock is fully gated in ->remove(), we first need to to bring the device into full power by invoking pm_runtime_get_sync(). Then, let's both unprepare and disable the clock. Signed-off-by: Ulf Hansson --- drivers/media/platform/exynos-gsc/gsc-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index e84bc35..5d3cfe8 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1104,12 +1104,15 @@ static int gsc_remove(struct platform_device *pdev) { struct gsc_dev *gsc = platform_get_drvdata(pdev); + pm_runtime_get_sync(&pdev->dev); + gsc_unregister_m2m_device(gsc); v4l2_device_unregister(&gsc->v4l2_dev); - vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx); + clk_disable_unprepare(gsc->clock); + pm_runtime_disable(&pdev->dev); - clk_unprepare(gsc->clock); + pm_runtime_put_noidle(&pdev->dev); dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0;