Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1048204ybi; Sun, 30 Jun 2019 06:18:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzX5qr+wUOvNgFom8gvO9Po4+O2IRkiM8BnTMy7XCUfX/wHAgb2V5Ip/DNfL7n0COUhdUvm X-Received: by 2002:a63:2606:: with SMTP id m6mr7141190pgm.436.1561900692572; Sun, 30 Jun 2019 06:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561900692; cv=none; d=google.com; s=arc-20160816; b=EWVrEd/5ZPUf2an+PtdbY1TwGeeR7ONDMACsEDxAYZZJ1VBMrYJV6KjLQfaIBcaIsp 7yuKv8FsbTGpscgLJjUk3QG0Rp4HpOJ2vBH9tK1Xsz/iAYcqfS1kj9a+otgkRsM/FjAB dA8ixusNcpWvrijy/xwfIQDn/fN4kg784jPWtuswc2X6ZP/+4GrTNF3/DglGTchst+5L s1dIKZqYNsMzmTRcAQ3qLRkgDAaK80Z2FZxQyBLeMTVyWsOfhllJ51VK0dGoggUME5SO gRVSGj9/z6SsERCP/vmuwpyxlQMn2+EwLLgGT9f+Vs7W4iDAQiek+rcffeEb/ITC2Zb6 6YVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tU2QjlplILF/dSwxFDxnwqJmz4lOyuJ9m7+FabAB1TM=; b=KX+qsTr16p192gONz/pO/0U3buXU5j1PqsfEhP2c85YECJyCLwgbksKUwJz5xs/Vi0 c9LxghcirZ7aO3fSpzWkcib6LCrmdD329mSmWF3vH0/b1YAvBRRi6KLM2rXKc3sXnqbj aT2hA7BURD7+HqRpzBCGGPjeS0NGY16mJvQHQENv8ZHXm7drSb6iq/IGbZVNXZbdq5C2 Icwnu58jxPSccRFD3a7lqyC5T6YC3+8aCZOYWV4csaDuSH/wzNNedco23OlmqYcMGJOT WHrymyTh9IHefX/gCcnH8sgYxzov01UfDfWA7oN63RaQ7Nx5F8bnylDo3KUqXaNKjxtI WOjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=umgpvucg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13si8150402pfa.17.2019.06.30.06.17.56; Sun, 30 Jun 2019 06:18:12 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=umgpvucg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbfF3NQI (ORCPT + 99 others); Sun, 30 Jun 2019 09:16:08 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41206 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfF3NQI (ORCPT ); Sun, 30 Jun 2019 09:16:08 -0400 Received: by mail-qt1-f195.google.com with SMTP id d17so11720687qtj.8; Sun, 30 Jun 2019 06:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tU2QjlplILF/dSwxFDxnwqJmz4lOyuJ9m7+FabAB1TM=; b=umgpvucg5VZShrp5PSpC9dvsc75qP858M/zMR+GQN3iy05FW3gMeOsPQKRagKs74JB S71vE+eQvwM15M5hNZPq8iw7IkZlmTeUs3GDuZO0lHh4+TB0X4PhQ0Zg5a9NNPZYlYDl a5iubN/yE1fnk39HOgrk5GGpv/8RDlVu5IfRt9EGd8JIL0NInLSpOspXY3ujxn52suu5 7BamjYtEf9OkpVw9DWGkWzHfAEyQDwecwKkWSlXLhNmVzG0gEuC8N+kOA/4e4y2qX5B1 7jKGSBDRJ0xkbhnFSYI7ewsyQgGKpoK6m3LAgWu0E1OgMvSKtPOeFYNsBVjff5m7Jtpb fQOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tU2QjlplILF/dSwxFDxnwqJmz4lOyuJ9m7+FabAB1TM=; b=K3xMFpWHy8ML1qdJ3H9EMMvb+4EUM2SMJTGhL05Eo0nMjJ6mDLmlNEI7SZmktUcq/S zQciDSUDMZie6oiMt2d+vIUSVbG1qwba8Ip2p8vyQbyTEfUIF47B1OVwjA+CC+CfvTXA k8HzPUx9IW9+oPJE4pVkYq0+Vf36bGzEAxgdA9l2bxrIOe9xTBbeMBPLUKR57ipjhiUV NVWl0b+B/Hs7vRjp43F1XBcYE3OUQsQCJ1ZUaafU1aiIIFqmQPqGcioh3wRgTPECW6jZ b+GkLkmsZmzcQf0idT20j2Tqe2m5PyuOjlPLZf4/7WBHl6qXSmFVzn9UQ9QSytknXkJY 9Egg== X-Gm-Message-State: APjAAAXTv5MYvbgI2PQ6GJbUK885H0nl21vZNZG8Qw5wIt5kMnEL38jG V3iqmjLO6xpS16WFS1kJeXM+4HcgG1g= X-Received: by 2002:ac8:18b2:: with SMTP id s47mr15559015qtj.75.1561900566858; Sun, 30 Jun 2019 06:16:06 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id l6sm3643043qkf.83.2019.06.30.06.16.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 06:16:06 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Sibi Sankar , Chandan Uddaraju , Jordan Crouse , Abhinav Kumar , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/msm/dsi: make sure we have panel or bridge earlier Date: Sun, 30 Jun 2019 06:14:43 -0700 Message-Id: <20190630131445.25712-4-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630131445.25712-1-robdclark@gmail.com> References: <20190630131445.25712-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark If we are going to -EPROBE_DEFER due to panel/bridge not probed yet, we want to do it before we start touching hardware. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 30 +++++++++++++-------------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 9 +++----- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 53bb124e8259..e15e7534ccd9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -171,7 +171,7 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host); unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host); struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host); -int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer); +int msm_dsi_host_register(struct mipi_dsi_host *host); void msm_dsi_host_unregister(struct mipi_dsi_host *host); int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host, struct msm_dsi_pll *src_pll); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 1ae2f5522979..8e5b0ba9431e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1824,6 +1824,20 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) goto fail; } + /* + * Make sure we have panel or bridge early, before we start + * touching the hw. If bootloader enabled the display, we + * want to be sure to keep it running until the bridge/panel + * is probed and we are all ready to go. Otherwise we'll + * kill the display and then -EPROBE_DEFER + */ + if (IS_ERR(of_drm_find_panel(msm_host->device_node)) && + !of_drm_find_bridge(msm_host->device_node)) { + pr_err("%s: no panel or bridge yet\n", __func__); + return -EPROBE_DEFER; + } + + msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL"); if (IS_ERR(msm_host->ctrl_base)) { pr_err("%s: unable to map Dsi ctrl base\n", __func__); @@ -1941,7 +1955,7 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host, return 0; } -int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer) +int msm_dsi_host_register(struct mipi_dsi_host *host) { struct msm_dsi_host *msm_host = to_msm_dsi_host(host); int ret; @@ -1955,20 +1969,6 @@ int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer) return ret; msm_host->registered = true; - - /* If the panel driver has not been probed after host register, - * we should defer the host's probe. - * It makes sure panel is connected when fbcon detects - * connector status and gets the proper display mode to - * create framebuffer. - * Don't try to defer if there is nothing connected to the dsi - * output - */ - if (check_defer && msm_host->device_node) { - if (IS_ERR(of_drm_find_panel(msm_host->device_node))) - if (!of_drm_find_bridge(msm_host->device_node)) - return -EPROBE_DEFER; - } } return 0; diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index ff39ce6150ad..cd3450dc3481 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -82,7 +82,7 @@ static int dsi_mgr_setup_components(int id) int ret; if (!IS_DUAL_DSI()) { - ret = msm_dsi_host_register(msm_dsi->host, true); + ret = msm_dsi_host_register(msm_dsi->host); if (ret) return ret; @@ -101,14 +101,11 @@ static int dsi_mgr_setup_components(int id) /* Register slave host first, so that slave DSI device * has a chance to probe, and do not block the master * DSI device's probe. - * Also, do not check defer for the slave host, - * because only master DSI device adds the panel to global - * panel list. The panel's device is the master DSI device. */ - ret = msm_dsi_host_register(slave_link_dsi->host, false); + ret = msm_dsi_host_register(slave_link_dsi->host); if (ret) return ret; - ret = msm_dsi_host_register(master_link_dsi->host, true); + ret = msm_dsi_host_register(master_link_dsi->host); if (ret) return ret; -- 2.20.1