From patchwork Thu Mar 30 14:16:23 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: 77207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1173398vqo; Thu, 30 Mar 2023 07:35:15 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/4SUMJCbgxx0dGHleqnlwl+iycfnDbjp01n32MfgKt6+g7qFo/7WoWNHWlk70AHjkpeAw X-Received: by 2002:aa7:d552:0:b0:4fb:ec6a:2357 with SMTP id u18-20020aa7d552000000b004fbec6a2357mr21924457edr.34.1680186915264; Thu, 30 Mar 2023 07:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680186915; cv=none; d=google.com; s=arc-20160816; b=J5Z01gEnthv+Sm+kVD1FQfZgD/mbupc7g3uJ+uhGoVi3iq+WQtvywU5XH0nmDWWYLK aKCCokeWTTrXVuY4fDggpf1+xKtZFlR60F+TWfJBAQMCSK2gso1i96oN0l9wQPnqNNkt Gvq/PkhdxNAJkkUwu6ux6K/SWhnWLdlie2zWiROAD/esvr4JoQlshEcg/zPdNXMn9jpS eh2vZO61huCA8yfRM2xzzeYCn8FT37wH9vwwN0CBHYg9MVRqOP3fL7IwpCDqh9O/JP9o WDr2/RLxkB7duLxynQWR3v6gUBX+itpKu3GHZuhK34nyVn5uuk72q8/KDxdrwulcm4dY 6eew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mVHWryi7FLI6xgM1V7O/CpgS+CHXop+pa1pZRj1UBLM=; b=0pLh6N/wTX1J7CTYXrn43a/7o9jgwEob3FQxWXAGzU+6j6rb1Zgi7z28qChoS3BOxC MhJ0cUkg8V1zk9W9EdbhuQBbpo9/nY3+WHPYK4mmNpfxqGoAugXeWEGCLIGri2llFSs6 bnVAaXKqvoZ4t4RynciYi+PbEY8rXevaUHc3SW34jeZLeXScDOucEx2VCzMbOdv/l9NA zvhFjw3c7yznkbDkPP6RFB9ES8YNMvX8BgjOazTMevPwns4UOUnAESsYQ85fDpvY1KUg hu5gwsE0CSOf3UTQB1pPTFGvm1DvQlvlcAcvgsbMfy99ml/g5ugN90e1tCJfwOF0rMX+ 2/vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="j/hJlZxO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v24-20020aa7d658000000b00501dd8e9f9dsi1084550edr.370.2023.03.30.07.34.49; Thu, 30 Mar 2023 07:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="j/hJlZxO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232399AbjC3OQy (ORCPT + 99 others); Thu, 30 Mar 2023 10:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232267AbjC3OQn (ORCPT ); Thu, 30 Mar 2023 10:16:43 -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 0534EAF32 for ; Thu, 30 Mar 2023 07:16:38 -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 2B96F660310D; Thu, 30 Mar 2023 15:16:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680185796; bh=aTfefQf7wUPldM8GfwxyIBQhpoEf1h/RP3aMOHoG5mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/hJlZxOEbaGyp+oaQoR1ff6jbmyH6VOaZJTv1qkCUr5ZN+0HOzujNwZvlNSON4Wm XoW+9USRjLmb7oA6Kc3IMqnzPhTlo882s0QEJs5JX/ZUsdunMcOkutO9RYERJSJAEc MP1cf6Xna9f/NN/2VVwr7aLZi0JfG1AQedugoImdSJ8eZKozW6kYU/L6pazR2AdpZf QP5uT5uRBpvtgi50o47j1vmpHdURXbCPGoGycob2nHfcY+VRMoDlWhZXmyCdgvlnOY E/VqX4LjIOJQhZ7E/qAC26gGrBzLhL0DXtnmpRarUfJiWXVEcRUWS3uOOVJlQSOmFm +HfruHQvhoLvQ== 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 v1 1/8] drm/mediatek: dp: Cache EDID for eDP panel Date: Thu, 30 Mar 2023 16:16:23 +0200 Message-Id: <20230330141631.190528-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330141631.190528-1-angelogioacchino.delregno@collabora.com> References: <20230330141631.190528-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761803674494497858?= X-GMAIL-MSGID: =?utf-8?q?1761803674494497858?= 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; }