From patchwork Wed Nov 9 14:23:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9419443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2D1A601C2 for ; Wed, 9 Nov 2016 14:24:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5FBF29352 for ; Wed, 9 Nov 2016 14:24:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BABEB29356; Wed, 9 Nov 2016 14:24:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D97D29352 for ; Wed, 9 Nov 2016 14:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525AbcKIOYY (ORCPT ); Wed, 9 Nov 2016 09:24:24 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:10732 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbcKIOYO (ORCPT ); Wed, 9 Nov 2016 09:24:14 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGD0014CPCAB650@mailout2.w1.samsung.com>; Wed, 09 Nov 2016 14:24:10 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161109142409eucas1p1e01fde9e384b52f0e39eddf8f2513214~FZyJP4krq1383513835eucas1p1w; Wed, 9 Nov 2016 14:24:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 62.F7.23383.A8133285; Wed, 9 Nov 2016 14:24:10 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161109142409eucas1p1984158008caee2ed6645bfa3666e8900~FZyImjve71503015030eucas1p1y; Wed, 9 Nov 2016 14:24:09 +0000 (GMT) X-AuditID: cbfec7ef-f79e76d000005b57-03-5823318ae49d Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 84.AE.07726.98133285; Wed, 9 Nov 2016 14:24:09 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGD009LGPC36HB0@eusync2.samsung.com>; Wed, 09 Nov 2016 14:24:08 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Ulf Hansson , Bartlomiej Zolnierkiewicz , Javier Martinez Canillas Subject: [PATCH 05/12] exynos-gsc: Fixup clock management at ->remove() Date: Wed, 09 Nov 2016 15:23:54 +0100 Message-id: <1478701441-29107-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1478701441-29107-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsWy7djP87pdhsoRBhtvy1psnLGe1eLN2zVM FufPb2C36NmwldVixvl9TBZrj9xltzj8pp3V4vjacAcOj02rOtk87lzbw+axpf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NAuE08Qk8e7bVLAqNgFDia63XWC2iICTxMJZf9lBipgFZjFJTO5bwgKSEBZwl7h9 cxY7iM0ioCrx7fFGMJtXwENi9usPUOvkJE4em8wKYnMKeEqsOnITzBYCqtm6fBbjBEbeBYwM qxhFUkuLc9Nziw31ihNzi0vz0vWS83M3MQLDetuxn5t3MF7aGHyIUYCDUYmHt0NTOUKINbGs uDL3EKMEB7OSCO9MA6AQb0piZVVqUX58UWlOavEhRlOgoyYyS4km5wNjLq8k3tDE0NzS0MjY wsLcyEhJnLfkw5VwIYH0xJLU7NTUgtQimD4mDk6pBkavLseYRav2OGyRa9+XqGDUIXdUtf+J iYy90QP2X7ZKR3TVf+Wed73ZJt3xy3uPI3+G6IT+xyGWTTa3rbyyl6WJB30vVfu8MnCdvOaR QkNV7z8XT3ttTuy9euEe8/Ezl25MmfRxNa+36d7n9kVrFJuflIesT1nF1nb6+/KIHZsnPZ3I vKe8Zp4SS3FGoqEWc1FxIgByA+tHgQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161109142409eucas1p1984158008caee2ed6645bfa3666e8900 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161109142409eucas1p1984158008caee2ed6645bfa3666e8900 X-RootMTR: 20161109142409eucas1p1984158008caee2ed6645bfa3666e8900 References: <1478701441-29107-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ulf Hansson 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 [mszyprow: rebased onto v4.9-rc4] Signed-off-by: Marek Szyprowski --- 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 7e99fda..1d3bde3 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1082,12 +1082,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_clear_max_seg_size(&pdev->dev); - pm_runtime_disable(&pdev->dev); - clk_unprepare(gsc->clock); + clk_disable_unprepare(gsc->clock); + + pm_runtime_put_noidle(&pdev->dev); dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0;