From patchwork Tue Dec 7 22:29:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 521624 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp16703imb; Tue, 7 Dec 2021 14:29:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzd66SsePsAhh/t5UHzPHrJsIpn1u8h5gLaxNU/VfkK+1jjFWbWGgiD6mZuG6xKkn5Yplif X-Received: by 2002:a17:90b:314d:: with SMTP id ip13mr2322660pjb.228.1638916165068; Tue, 07 Dec 2021 14:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638916165; cv=none; d=google.com; s=arc-20160816; b=axEfKbl2N7xllv9fyatLqQUrqgKxaY6l2Vr8J96EoHYMPn/GXPxeOccyhTpha8l3jP /MOwIRcy8ZHMxfZICVYjrObWhjAS9W+u72wF1l0kKm7hCVnv7/Shxfj1aSbP3jLkSGfx SCaFHkiMuFXu3LNSKnfAY7CJtJsf2NOqyUQQIsEzKv7jXD/MMD6LPQtYRZXwqH4lA1xa 3/anxUJMW4KX9qruj1shROM5EB0qHcuFuLa+TOcwjRutOQGLgm88ZzUf5KsTkAYHbYym BfCLyhf4iT4l8oEdRQX/+Vo0ozlIOwSIS3fbGqDtRuUiW/cODf5SW9pDc09vlRbGghsa gjHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=KQyhi8Tuxu4/knDgfSprik7qylpNwng9tPAXIuAarNU=; b=IjOG4gBieKMmrYpnpjwgMKJm3jXQ70aj5fJSgPxnl7qu6LA9gxkdMBmPcuQ0be/GsJ b2MhUW/5JURuT5cqU5DAkbXsbqiUGFjxy+0flzuv72atRBTPmhcyKz1K+3I02cCGDVQH 3hxuCZQO82v5V+CCNOaTTOUwxT/NdDa313AWbjHy5fMAUYjsk0gHwMCGlzXNJZEFhoTC YK7DrXc9rIm8gxElCGHRfjzat4MArdercclCRgqez3ISOeoGxR0xmYAJ9CrMJ4S5WzwC OORTxvVWPWD6st3mtnMtp9jmgSw3R38cDZfg1ywoq/+/LV6Ha1lPhg+hRQ6hTHRRgVw0 onyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="k/AvE5IQ"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v29si1252416pga.804.2021.12.07.14.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:29:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="k/AvE5IQ"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08A4C6E5AE; Tue, 7 Dec 2021 22:29:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 898B36E0F6 for ; Tue, 7 Dec 2021 22:29:14 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id u22so783561lju.7 for ; Tue, 07 Dec 2021 14:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KQyhi8Tuxu4/knDgfSprik7qylpNwng9tPAXIuAarNU=; b=k/AvE5IQ4Q/PFTfvJMJ0uSLl5kcm6XNcaI9lVQ45leWD0miLV5lZHTzOeEpb+pLhNQ +D0v7qQ8+l8B7LPLkr99/0D7TAgq6FVa6URdy0Oeb3qVg5g5KDlckKPR3JAbRQxKpeCg Kkrb2tytTbO7EmZiQHMGCiReqcoQYWGDKPMtg89Q45EF8gE0j1P11v/LKWuP2tv1Kgr6 PwjVlQtyds1IMXskORj8WGpCRNMb/fivMQ7a84WjJMo7pmFTW1SjALjeL2sIc8RAt+U9 DSq2+XQ5xC/PfBIbnZRKM9AzkaVdNnq2UhdDKgilj+0PjYh73M0SGZXO1w43bnvynu27 K1CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KQyhi8Tuxu4/knDgfSprik7qylpNwng9tPAXIuAarNU=; b=5Zl7UYzYJEn5oizPsdU3ExHLd5ZaQ12htxZHuhNZcDB0OW/+5R0aGOjr39a82uXJ87 JjIdeiM64+V2LNnCs5kcZA7lyOvEe0LpO3NcPM8WXS5e+JtNYf/58xlRDp6U1PuwdpZK kH2U9oWqa49hEegGCXrrjDkS5jwZ1X0tKyhGi95WiiH4QZck/WmdZP2pCm6g5RFd2qkU g7FHCkk249+l1VE+d3J5tFrA7iYF5GgoJUamPfBlyLtvWfOmlxS0/crcnKuj/PUN/b38 puYY+rmqIvDYcax7mvi84LBxbs+IjOb6GP14jRrUQzfm4+R/ld3bb8YJqwVTai/VPTNe 16Qg== X-Gm-Message-State: AOAM531T7AZX1dd08NNqBEB7RR12FWPLl7aH7bqL5x7bXaZNQsF3OeDZ IKcSIedkatjavp2bzsjqy4RZyw== X-Received: by 2002:a2e:a54d:: with SMTP id e13mr43939891ljn.319.1638916152710; Tue, 07 Dec 2021 14:29:12 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p22sm79423lfe.257.2021.12.07.14.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:29:12 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH 1/2] drm/msm/dsi: move DSI host powerup to modeset time Date: Wed, 8 Dec 2021 01:29:00 +0300 Message-Id: <20211207222901.988484-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211207222901.988484-1-dmitry.baryshkov@linaro.org> References: <20211207222901.988484-1-dmitry.baryshkov@linaro.org> 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: Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, David Airlie , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The DSI subsystem does not fully fall into the pre-enable/enable system of callbacks, since typically DSI device bridge drivers expect to be able to communicate with DSI devices at the pre-enable() callback. The reason is that for some DSI hosts enabling the video stream would prevent other drivers from sending DSI commands. For example see the panel-bridge driver, which does drm_panel_prepare() from the pre_enable() callback (which would be called before our pre_enable() callback, resulting in panel preparation failures as the link is not yet ready). Therewere several attempts to solve this issue, but currently the best approach is to power up the DSI link from the mode_set() callback, allowing next bridge/panel to use DSI transfers in the pre_enable() time. Follow this approach. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 43 +++++++++++++++++++-------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 681ca74fe410..497719efb9e9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -336,13 +336,12 @@ dsi_mgr_connector_best_encoder(struct drm_connector *connector) return msm_dsi_get_encoder(msm_dsi); } -static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) +static void dsi_mgr_bridge_power_on(struct drm_bridge *bridge) { int id = dsi_mgr_bridge_get_id(bridge); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1); struct mipi_dsi_host *host = msm_dsi->host; - struct drm_panel *panel = msm_dsi->panel; struct msm_dsi_phy_shared_timings phy_shared_timings[DSI_MAX]; bool is_bonded_dsi = IS_BONDED_DSI(); int ret; @@ -383,6 +382,34 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) if (is_bonded_dsi && msm_dsi1) msm_dsi_host_enable_irq(msm_dsi1->host); + return; + +host1_on_fail: + msm_dsi_host_power_off(host); +host_on_fail: + dsi_mgr_phy_disable(id); +phy_en_fail: + return; +} + +static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1); + struct mipi_dsi_host *host = msm_dsi->host; + struct drm_panel *panel = msm_dsi->panel; + bool is_bonded_dsi = IS_BONDED_DSI(); + int ret; + + DBG("id=%d", id); + if (!msm_dsi_device_connected(msm_dsi)) + return; + + /* Do nothing with the host if it is slave-DSI in case of bonded DSI */ + if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) + return; + /* Always call panel functions once, because even for dual panels, * there is only one drm_panel instance. */ @@ -417,17 +444,7 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) if (panel) drm_panel_unprepare(panel); panel_prep_fail: - msm_dsi_host_disable_irq(host); - if (is_bonded_dsi && msm_dsi1) - msm_dsi_host_disable_irq(msm_dsi1->host); - if (is_bonded_dsi && msm_dsi1) - msm_dsi_host_power_off(msm_dsi1->host); -host1_on_fail: - msm_dsi_host_power_off(host); -host_on_fail: - dsi_mgr_phy_disable(id); -phy_en_fail: return; } @@ -573,6 +590,8 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, msm_dsi_host_set_display_mode(host, adjusted_mode); if (is_bonded_dsi && other_dsi) msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); + + dsi_mgr_bridge_power_on(bridge); } static const struct drm_connector_funcs dsi_mgr_connector_funcs = {