From patchwork Thu Mar 30 14:20:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13194257 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 667EAC761A6 for ; Thu, 30 Mar 2023 14:20:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 242E410EE7F; Thu, 30 Mar 2023 14:20:48 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60D3B10EE76 for ; Thu, 30 Mar 2023 14:20:42 +0000 (UTC) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7587D6603182; Thu, 30 Mar 2023 15:20:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680186041; bh=aTfefQf7wUPldM8GfwxyIBQhpoEf1h/RP3aMOHoG5mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPKMaUB9pcKRhv67iSyOx+sUENsvJDupMI3jonnm9Rm8BPcttpu+7x3p4EEQsiW9C yz6VK78dYKCALS6f4jauo7bR8O/uLpxVSENMCprMBm9+fYlG0nz2tzq5AYz4owxxX7 Pp8RicYGQGWQea6wDJ+Qky/Y4617oEjcXcSl2m4KgpTEwhk3i4sAYAtcKVoMlD/rh3 DXXWsQPAxnj4eXifnCESevLdl9IoUAbJhpPr0gHV5xwdZizK517iTFTDpseamSiYNe bj+Z4bQAc5kwvIcmIbH/S2UinzEC+t8iOLv9x20s7RG7wA+wkYliZQv0CSLXX6rw98 K1iPrA0Y0Vk+w== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Subject: [PATCH v2 1/8] drm/mediatek: dp: Cache EDID for eDP panel Date: Thu, 30 Mar 2023 16:20:28 +0200 Message-Id: <20230330142035.191399-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330142035.191399-1-angelogioacchino.delregno@collabora.com> References: <20230330142035.191399-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, wenst@chromium.org, matthias.bgg@gmail.com, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Since eDP panels are not removable it is safe to cache the EDID: this will avoid a relatively long read transaction at every PM resume that is unnecessary only in the "special" case of eDP, hence speeding it up a little, as from now on, as resume operation, we will perform only link training. Signed-off-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_dp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 1f94fcc144d3..84f82cc68672 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -118,6 +118,7 @@ struct mtk_dp { const struct mtk_dp_data *data; struct mtk_dp_info info; struct mtk_dp_train_info train_info; + struct edid *edid; struct platform_device *phy_dev; struct phy *phy; @@ -1993,7 +1994,11 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, usleep_range(2000, 5000); } - new_edid = drm_get_edid(connector, &mtk_dp->aux.ddc); + /* eDP panels aren't removable, so we can return a cached EDID. */ + if (mtk_dp->edid && mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP) + new_edid = drm_edid_duplicate(mtk_dp->edid); + else + new_edid = drm_get_edid(connector, &mtk_dp->aux.ddc); /* * Parse capability here to let atomic_get_input_bus_fmts and @@ -2022,6 +2027,10 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, drm_atomic_bridge_chain_post_disable(bridge, connector->state->state); } + /* If this is an eDP panel and the read EDID is good, cache it for later */ + if (mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP && !mtk_dp->edid && new_edid) + mtk_dp->edid = drm_edid_duplicate(new_edid); + return new_edid; }