Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5000135img; Tue, 26 Mar 2019 23:21:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjo6iOchk019hAUPr7bSyLCu/8PAqLDs1lk4pHjsLLtFni3+ZpD5s6kX67Q2XmLbdusJXO X-Received: by 2002:a62:1795:: with SMTP id 143mr29753933pfx.104.1553667713616; Tue, 26 Mar 2019 23:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667713; cv=none; d=google.com; s=arc-20160816; b=IfgrOwk9MtZtQcJMvuJyd/k0qBtoYlQDpluIjrj8gdn1DMZwBo54BTPDuUYbjL3+R/ 8ZDKGAUANhbkU2t2MmO5DYm8Rj+xeYheUxPDcjQUc4FssYM9gQM3ZGd0KnhmcazD2L6O 3GBPuCL8GyOQe2UuBfSEP6rO6JaAlSaTSJTXBja3tcTOCNROtkJ6jMw3Dw42VzJKH8qm wEF0LIpQN5XNbFBEdVU5g5vCvFYbFTQeO7ZdhCVWnsIb8p9LA+HcCV+oicvdX47xO8Sa vseah/9pjcQlChu++HwofzlfgTm10cPklHFtPS7YCLHpa0Q6P91ckEeAqlWvLXB7HI6y gaFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=lgqf6TiuGnT4uNuYylfHf7maN12elIaaEOBFs6jKyPU=; b=MiB6etDptwWO3//AUDzzKQzu7lRaYcjeyh8TIQT5W5SM/JoONAVL8k7dgAO4ksoSz0 NAfWqOk9HiSGjBeG8rfD0iFS/oTkh39i79RwnICOQcr1P8S1EE/jnFZrpv89GgmUODyq Y3ZPJzEJ7SM6sQfbxDAPzYm3Bug6dThTxvTs9S6WRB7bpApDLSPYgwTjEwFiMwXsb8X5 372SURU3xxeOoYYyjvjUcsG4hMGMQ/gpTwt5Fw8+hDLh4eOEa3NB2vcy6HTC5lYw98lw /VZnPbQ+BVPUM10LXRnbDYSePUFMEIAmLYVu9sopiTMsik1qXF2MTIZ4j9qN7+Xq/A+h FYJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg12si10010998plb.295.2019.03.26.23.21.38; Tue, 26 Mar 2019 23:21:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387541AbfC0GUC (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:02 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15146 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1733002AbfC0GUA (ORCPT ); Wed, 27 Mar 2019 02:20:00 -0400 X-UUID: e8263a9b186b4106a3e0026ac831c0e0-20190327 X-UUID: e8263a9b186b4106a3e0026ac831c0e0-20190327 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 611644549; Wed, 27 Mar 2019 14:19:57 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:55 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:54 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 22/25] drm/mediatek: adjust ddp clock control flow Date: Wed, 27 Mar 2019 14:19:18 +0800 Message-ID: <1553667561-25447-23-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 322DC7B72FE93A02D912BF6759AA6BC253FB85AE38FACFDBA65666D83B3F98E82000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu display hardware clock will not unprepare when crtc is disable, until crtc is destroyed. with this patch, hard clock will disable and unprepare at the same time. Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 0f97ee3..606c6e2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -195,7 +195,7 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_drm_crtc *mtk_crtc) DRM_DEBUG_DRIVER("%s\n", __func__); for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { - ret = clk_enable(mtk_crtc->ddp_comp[i]->clk); + ret = clk_prepare_enable(mtk_crtc->ddp_comp[i]->clk); if (ret) { DRM_ERROR("Failed to enable clock %d: %d\n", i, ret); goto err; @@ -205,7 +205,7 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_drm_crtc *mtk_crtc) return 0; err: while (--i >= 0) - clk_disable(mtk_crtc->ddp_comp[i]->clk); + clk_disable_unprepare(mtk_crtc->ddp_comp[i]->clk); return ret; } @@ -215,7 +215,7 @@ static void mtk_crtc_ddp_clk_disable(struct mtk_drm_crtc *mtk_crtc) DRM_DEBUG_DRIVER("%s\n", __func__); for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) - clk_disable(mtk_crtc->ddp_comp[i]->clk); + clk_disable_unprepare(mtk_crtc->ddp_comp[i]->clk); } static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) @@ -615,15 +615,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, if (!comp) { dev_err(dev, "Component %pOF not initialized\n", node); ret = -ENODEV; - goto unprepare; - } - - ret = clk_prepare(comp->clk); - if (ret) { - dev_err(dev, - "Failed to prepare clock for component %pOF: %d\n", - node, ret); - goto unprepare; + return ret; } mtk_crtc->ddp_comp[i] = comp; @@ -649,23 +641,17 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, ret = mtk_plane_init(drm_dev, &mtk_crtc->planes[zpos], BIT(pipe), type); if (ret) - goto unprepare; + return ret; } ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0], mtk_crtc->layer_nr > 1 ? &mtk_crtc->planes[1] : NULL, pipe); if (ret < 0) - goto unprepare; + return ret; drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE); drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, MTK_LUT_SIZE); priv->num_pipes++; return 0; - -unprepare: - while (--i >= 0) - clk_unprepare(mtk_crtc->ddp_comp[i]->clk); - - return ret; } -- 1.8.1.1.dirty