From nobody Thu Nov 14 06:31:34 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 BCD79C761AF for ; Tue, 4 Apr 2023 10:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234559AbjDDKsR (ORCPT ); Tue, 4 Apr 2023 06:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234526AbjDDKsL (ORCPT ); Tue, 4 Apr 2023 06:48:11 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5A0199C for ; Tue, 4 Apr 2023 03:48:09 -0700 (PDT) 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 2C69A660314D; Tue, 4 Apr 2023 11:48:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680605286; bh=aTfefQf7wUPldM8GfwxyIBQhpoEf1h/RP3aMOHoG5mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kWfqTIxKcDdyeFg0DuDrmjBHofBlnVH8+mggL2nm6pPo3GMHiqcATAJRE/eU6dzOH 3+rdxbDZ0Xvla3h4ldRGLQqF3TX9/US1lXUBG5GgY3HMsDhcsyS71IrTFdeV5/CRsP 6TqKWiAomBXeW+FBFbA0RkYreM6xM8wGfGQCXA/jofm+D+2uQvsHm9NEHgDaJ9PcJz nlAh4El7NDHGRAhSsIpV1d/LK9H4B3HOqGB+gfwZf7hHvzR8Q9ElFd9h8ahLJbStZI eIBOjEaOMUTJ03A34oQA/QWSKXlAA48mLtlaIYd3z971cmmTbneceyiyu2hb+GzJd/ 0wZtvdnFDljhQ== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, wenst@chromium.org Subject: [PATCH v3 1/9] drm/mediatek: dp: Cache EDID for eDP panel Date: Tue, 4 Apr 2023 12:47:52 +0200 Message-Id: <20230404104800.301150-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230404104800.301150-1-angelogioacchino.delregno@collabora.com> References: <20230404104800.301150-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Matthias Brugger --- 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/m= tk_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; =20 struct platform_device *phy_dev; struct phy *phy; @@ -1993,7 +1994,11 @@ static struct edid *mtk_dp_get_edid(struct drm_bridg= e *bridge, usleep_range(2000, 5000); } =20 - new_edid =3D 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 =3D=3D DRM_MODE_CONNECTOR_eDP) + new_edid =3D drm_edid_duplicate(mtk_dp->edid); + else + new_edid =3D drm_get_edid(connector, &mtk_dp->aux.ddc); =20 /* * Parse capability here to let atomic_get_input_bus_fmts and @@ -2022,6 +2027,10 @@ static struct edid *mtk_dp_get_edid(struct drm_bridg= e *bridge, drm_atomic_bridge_chain_post_disable(bridge, connector->state->state); } =20 + /* If this is an eDP panel and the read EDID is good, cache it for later = */ + if (mtk_dp->bridge.type =3D=3D DRM_MODE_CONNECTOR_eDP && !mtk_dp->edid &&= new_edid) + mtk_dp->edid =3D drm_edid_duplicate(new_edid); + return new_edid; } =20 --=20 2.40.0