Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1227267imm; Wed, 6 Jun 2018 12:28:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLBOIC5CXMaEYF+f0rXV7xzQM6TVT8i3f8vLwaJRj+KMcQCy8PoCg6hy6acyeW9hVJQJbFe X-Received: by 2002:a62:c809:: with SMTP id z9-v6mr3650949pff.5.1528313318842; Wed, 06 Jun 2018 12:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528313318; cv=none; d=google.com; s=arc-20160816; b=UmWqpslGRRX1OBiMrgDdmdygyTynwo8wQyFvInCJGeWJA7cHmhQgGLFUZkCYk3fVC0 2U2iII3n60EmYIewWcJ8BTxeZLKPKWXZy39MvCSb61jTPwe0zXRsOXKYwACLSlXLaqhQ sz8W3c0zvRIYUyBi3SFwqxB9AywHKBwvUtipsR14sJfixkLY8QD2AllzAGXtWkMJwvEq xp+ZL+9Q0+nSz0ysJcdA6TZaOVsBbKEsJgIEuww3RdzLn6IXlMB8cVEczyAa73HQZCqL O3XH+CE1Cqy5z5SktO5jFHT72hf0UqlLkUK5Kac7B1fev99Pafs6GeAxFhwuXXQwc7Co 9Q+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wsXU3nXAPDzLIJx5sW5mmgQ8n1IE/svSfGfin1cVqEw=; b=K0019Z0s2E3WKRWplpfkO2yAPsjuw1rQ0Zr2F/msAQvE5q9/GPbzQJeqH8ERJ4QDP9 vHdGIopqkgdNvUGMptYGqP1SWCWnCoa/IUVU/91scINu+5muq/8sQmtIjiuZSZnYLKmb JkTKC8LhRR2gNVXFVeBrdXb3eQl/JJRaIqpJMdKCTqDz5UYYtoVCbSbCQ/8M4A2CZycg e7eXOMzBWNwP+3NifwkY2L3WHFxveFqgsSfjhISPjrTOdqwaJAiH+nqMZS8v0mxiPEQw NIAT65x6EEspoeA8ZSqQ8FA1+P1G2wFXJey+qJ8TasijR6s5xUetOwAUDb40w6UlrWxs nlOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d26-v6si11730836pge.330.2018.06.06.12.28.24; Wed, 06 Jun 2018 12:28:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752995AbeFFTEg (ORCPT + 99 others); Wed, 6 Jun 2018 15:04:36 -0400 Received: from anholt.net ([50.246.234.109]:50096 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbeFFTEf (ORCPT ); Wed, 6 Jun 2018 15:04:35 -0400 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id B093D10A1874; Wed, 6 Jun 2018 12:04:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id r9hfmd_dDCP4; Wed, 6 Jun 2018 12:04:32 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 8A12D10A15ED; Wed, 6 Jun 2018 12:04:32 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id B896E2FE462F; Wed, 6 Jun 2018 12:04:31 -0700 (PDT) From: Eric Anholt To: dri-devel@lists.freedesktop.org, Archit Taneja , Andrzej Hajda , Laurent Pinchart Cc: linux-kernel@vger.kernel.org, Eric Anholt Subject: [PATCH 3/3] drm/vc4: Make DSI call into the bridge after the DSI link is enabled. Date: Wed, 6 Jun 2018 12:04:31 -0700 Message-Id: <20180606190431.1833-3-eric@anholt.net> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180606190431.1833-1-eric@anholt.net> References: <20180606190431.1833-1-eric@anholt.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows panels or bridges that need to send DSI commands during pre_enable() to successfully send them. We delay DISP0 (aka the actual display) enabling until after pre_enable so that pixels aren't streaming before then. Signed-off-by: Eric Anholt --- drivers/gpu/drm/vc4/vc4_dsi.c | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 8aa897835118..02cbfcc3cc4b 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -814,7 +814,9 @@ static void vc4_dsi_encoder_disable(struct drm_encoder *encoder) struct vc4_dsi *dsi = vc4_encoder->dsi; struct device *dev = &dsi->pdev->dev; + drm_bridge_disable(dsi->bridge); vc4_dsi_ulps(dsi, true); + drm_bridge_post_disable(dsi->bridge); clk_disable_unprepare(dsi->pll_phy_clock); clk_disable_unprepare(dsi->escape_clock); @@ -1089,21 +1091,6 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) /* Display reset sequence timeout */ DSI_PORT_WRITE(PR_TO_CNT, 100000); - if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { - DSI_PORT_WRITE(DISP0_CTRL, - VC4_SET_FIELD(dsi->divider, - DSI_DISP0_PIX_CLK_DIV) | - VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) | - VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME, - DSI_DISP0_LP_STOP_CTRL) | - DSI_DISP0_ST_END | - DSI_DISP0_ENABLE); - } else { - DSI_PORT_WRITE(DISP0_CTRL, - DSI_DISP0_COMMAND_MODE | - DSI_DISP0_ENABLE); - } - /* Set up DISP1 for transferring long command payloads through * the pixfifo. */ @@ -1128,6 +1115,25 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) vc4_dsi_ulps(dsi, false); + drm_bridge_pre_enable(dsi->bridge); + + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { + DSI_PORT_WRITE(DISP0_CTRL, + VC4_SET_FIELD(dsi->divider, + DSI_DISP0_PIX_CLK_DIV) | + VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) | + VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME, + DSI_DISP0_LP_STOP_CTRL) | + DSI_DISP0_ST_END | + DSI_DISP0_ENABLE); + } else { + DSI_PORT_WRITE(DISP0_CTRL, + DSI_DISP0_COMMAND_MODE | + DSI_DISP0_ENABLE); + } + + drm_bridge_enable(dsi->bridge); + if (debug_dump_regs) { DRM_INFO("DSI regs after:\n"); vc4_dsi_dump_regs(dsi); @@ -1639,6 +1645,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) dev_err(dev, "bridge attach failed: %d\n", ret); return ret; } + dsi->bridge->disable_midlayer_calls = true; pm_runtime_enable(dev); -- 2.17.0