From patchwork Tue Jan 10 12:57:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9507133 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 C26B0601E9 for ; Tue, 10 Jan 2017 12:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B42EE284F1 for ; Tue, 10 Jan 2017 12:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8A7628558; Tue, 10 Jan 2017 12:58:05 +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 4FD7B28547 for ; Tue, 10 Jan 2017 12:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937258AbdAJM6D (ORCPT ); Tue, 10 Jan 2017 07:58:03 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:14239 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933163AbdAJM6C (ORCPT ); Tue, 10 Jan 2017 07:58:02 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJK00M1CEOLR050@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 10 Jan 2017 12:57:57 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170110125757eucas1p1de3e2d10d89be184004e1e8eb47c1934~YamkrejBk0429404294eucas1p1t; Tue, 10 Jan 2017 12:57:57 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 87.AB.17477.45AD4785; Tue, 10 Jan 2017 12:57:56 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170110125756eucas1p1d9fe25f1ca7e0e982abaf2d71a607f0d~Yamj4lcrk0427104271eucas1p1c; Tue, 10 Jan 2017 12:57:56 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-41-5874da540afc Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id BA.F1.10233.C4AD4785; Tue, 10 Jan 2017 12:57:48 +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 <0OJK00FHHEOGTC40@eusync2.samsung.com>; Tue, 10 Jan 2017 12:57:56 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda Subject: [PATCH] drm: exynos: Add runtime PM support to MIC driver Date: Tue, 10 Jan 2017 13:57:47 +0100 Message-id: <1484053067-31665-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsWy7djP87oht0oiDKa8MLO4te4cq8WVr+/Z LCbdn8Bi8eLeRRaLGef3MVmsPXKX3WLG5JdsDuwe97uPM3n0bVnF6PF5k1wAcxSXTUpqTmZZ apG+XQJXxr4bcxgLH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rt7 GUFsXgEPiWMHJjFCbJOTOHlsMusERu4FjAyrGEVSS4tz03OLjfSKE3OLS/PS9ZLzczcxAsNw 27GfW3Ywdr0LPsQowMGoxMMbMaE4Qog1say4MvcQowQHs5IIL8/Vkggh3pTEyqrUovz4otKc 1OJDjKZAyycyS4km5wNjJK8k3tDE0NzS0MjYwsLcyEhJnHfqhyvhQgLpiSWp2ampBalFMH1M HJxSDYxmbt0x2//ENM6YctOao5BFe+4LG0fVv6yy5e0uPN/cGBU23ZicbxUtp3pG3zc8MSNm P9O0jEOf9Zz2J7a8Ckvc8nFGoKZSRsymjB9b/LzPPec73WTbYLSl71rWq4emKy+8btnT1SJz vq+b66/z/sWT7BXnHJTPqpAwTfeePT8x4t71Lo1pO5VYijMSDbWYi4oTAZLq611ZAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170110125756eucas1p1d9fe25f1ca7e0e982abaf2d71a607f0d X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 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: 20170110125756eucas1p1d9fe25f1ca7e0e982abaf2d71a607f0d X-RootMTR: 20170110125756eucas1p1d9fe25f1ca7e0e982abaf2d71a607f0d References: 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 This patch adds pm_runtime_get/put calls to notify device core when MIC device is really in use. This is needed to let power domain with this device to be turned off when display is turned off. Signed-off-by: Marek Szyprowski Reviewed-by: Chanwoo Choi --- drivers/gpu/drm/exynos/exynos_drm_mic.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c index a0def0be6d65..f643c380cb9a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -323,6 +324,7 @@ static void mic_post_disable(struct drm_bridge *bridge) for (i = NUM_CLKS - 1; i > -1; i--) clk_disable_unprepare(mic->clks[i]); + pm_runtime_put(mic->dev); mic->enabled = 0; already_disabled: @@ -338,6 +340,8 @@ static void mic_pre_enable(struct drm_bridge *bridge) if (mic->enabled) goto already_enabled; + pm_runtime_get_sync(mic->dev); + for (i = 0; i < NUM_CLKS; i++) { ret = clk_prepare_enable(mic->clks[i]); if (ret < 0) { @@ -473,8 +477,18 @@ static int exynos_mic_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mic); + pm_runtime_enable(dev); + + ret = component_add(dev, &exynos_mic_component_ops); + if (ret) + goto err_pm; + DRM_DEBUG_KMS("MIC has been probed\n"); - return component_add(dev, &exynos_mic_component_ops); + + return 0; + +err_pm: + pm_runtime_disable(dev); err: return ret; @@ -483,6 +497,7 @@ static int exynos_mic_probe(struct platform_device *pdev) static int exynos_mic_remove(struct platform_device *pdev) { component_del(&pdev->dev, &exynos_mic_component_ops); + pm_runtime_disable(&pdev->dev); return 0; }