From nobody Sat Sep 21 11:37:25 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 991E4C4332F for ; Wed, 19 Oct 2022 12:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233365AbiJSMqK (ORCPT ); Wed, 19 Oct 2022 08:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbiJSMph (ORCPT ); Wed, 19 Oct 2022 08:45:37 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 778AD13FA5 for ; Wed, 19 Oct 2022 05:28:35 -0700 (PDT) X-UUID: 8c9473935dc9430d907323aa6a24e1ce-20221019 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=tqvtEtatRRl/UW0RZ3T+M3Rf2MvxTlfEeOLdRGB0yZQ=; b=m7CKB7i4ZrDKfnoc8ikWw1z90ggkqKEWFjKCsERsCi5Hsb6WBI+oSjsHz+vMHV6AJyA2Qavh0xyx8KKSOfLuI0j4+GCp5Ts8/O1KisXpe8SiMIZ0/67OqyuYCm1D1duqnz86QhAhFCODmf/TivHfxrSEMLFLkccmKMa8b5eYd6g=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:47c8463d-3e2c-4061-ba94-1a27a061ba67,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:62cd327,CLOUDID:7fd749a4-ebb2-41a8-a87c-97702aaf2e20,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 8c9473935dc9430d907323aa6a24e1ce-20221019 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 612091699; Wed, 19 Oct 2022 17:07:28 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 19 Oct 2022 17:07:26 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 19 Oct 2022 17:07:26 +0800 From: To: , , , , , CC: , , , , , Xinlei Lee Subject: [PATCH v3] drm: mediatek: Modify dpi power on/off sequence. Date: Wed, 19 Oct 2022 17:07:23 +0800 Message-ID: <1666170443-19301-1-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xinlei Lee Modify dpi power on/off sequence so that the first gpio operation will take= effect. Fixes: 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low to avoid l= eakage current") Signed-off-by: Xinlei Lee --- change note: v2: Remove the empty line between Fixes: and S-o-b. v1: Rebase on linus/master v6.1-rc1. Change nothing. Because dpi power_on/off is protected by dpi->refcount, the first time it cannot be powered on and off successfully, it will cause leakage. --- --- drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/= mtk_dpi.c index 508a6d994e83..f83cf64c2828 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -461,9 +461,6 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi) if (--dpi->refcount !=3D 0) return; =20 - if (dpi->pinctrl && dpi->pins_gpio) - pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio); - mtk_dpi_disable(dpi); clk_disable_unprepare(dpi->pixel_clk); clk_disable_unprepare(dpi->engine_clk); @@ -488,9 +485,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_pixel; } =20 - if (dpi->pinctrl && dpi->pins_dpi) - pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); - return 0; =20 err_pixel: @@ -720,6 +714,9 @@ static void mtk_dpi_bridge_disable(struct drm_bridge *b= ridge) { struct mtk_dpi *dpi =3D bridge_to_dpi(bridge); =20 + if (dpi->pinctrl && dpi->pins_gpio) + pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio); + mtk_dpi_power_off(dpi); } =20 @@ -727,6 +724,9 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *br= idge) { struct mtk_dpi *dpi =3D bridge_to_dpi(bridge); =20 + if (dpi->pinctrl && dpi->pins_dpi) + pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); + mtk_dpi_power_on(dpi); mtk_dpi_set_display_mode(dpi, &dpi->mode); mtk_dpi_enable(dpi); --=20 2.18.0