From patchwork Sun Jul 7 18:19:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11034261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4B9A1510 for ; Sun, 7 Jul 2019 18:35:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A16FF223C7 for ; Sun, 7 Jul 2019 18:35:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94DC9223A6; Sun, 7 Jul 2019 18:35:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EE75223A6 for ; Sun, 7 Jul 2019 18:35:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 80ABF89BC2; Sun, 7 Jul 2019 18:35:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6642C89BC2 for ; Sun, 7 Jul 2019 18:35:48 +0000 (UTC) Received: from pendragon.nordic-sky.finnair.com (unknown [38.98.37.142]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 984D3334; Sun, 7 Jul 2019 20:35:31 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 43/60] drm/omap: Create connector for bridges Date: Sun, 7 Jul 2019 21:19:20 +0300 Message-Id: <20190707181937.6250-40-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190707181937.6250-1-laurent.pinchart@ideasonboard.com> References: <20190707180852.5512-1-laurent.pinchart@ideasonboard.com> <20190707181937.6250-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562524547; bh=wPH35v1wpTtlALOqGzNzhICoqCV++K0ZgXNZUxr5xyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6b7rBWEtjmaF+YVraiR29dq2ZfA8BspbvbQWoi3z5Ill9nBTdNLwIkCSryTBBjMN L/cjibQnBCy9DI1MW730InaIYncRkgBbZXj0zzxqcSOfs/ZOMWqQKZtQ7BYtQlxS4X AHaWb4ENLIcIB6DxJ0YC9zUoTtHVFvRIZWdIFzR8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Sebastian Reichel , Tomi Valkeinen , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the drm_bridge_connector helper to create a connector for pipelines that use drm_bridge. This allows splitting connector operations across multiple bridges when necessary, instead of having the last bridge in the chain creating the connector and handling all connector operations internally. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_drv.c | 57 ++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 790a2b5a1591..88f9328eda72 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -21,7 +21,9 @@ #include #include +#include #include +#include #include #include "omap_dmm_tiler.h" @@ -296,9 +298,13 @@ static int omap_modeset_init(struct drm_device *dev) if (pipe->output->bridge) { ret = drm_bridge_attach(pipe->encoder, pipe->output->bridge, NULL, - true); - if (ret < 0) + false); + if (ret < 0) { + dev_err(priv->dev, + "unable to attach bridge %pOF\n", + pipe->output->bridge->of_node); return ret; + } } id = omap_display_id(pipe->output); @@ -334,8 +340,31 @@ static int omap_modeset_init(struct drm_device *dev) encoder); if (!pipe->connector) return -ENOMEM; + } else { + struct drm_bridge *bridge = pipe->output->bridge; - drm_connector_attach_encoder(pipe->connector, encoder); + pipe->connector = drm_bridge_connector_init(dev, + bridge); + if (IS_ERR(pipe->connector)) { + dev_err(priv->dev, + "unable to create bridge connector for %pOF\n", + bridge->of_node); + return PTR_ERR(pipe->connector); + } + } + + drm_connector_attach_encoder(pipe->connector, encoder); + + /* + * FIXME: drm_panel should not store the drm_connector pointer + * internally but should receive it in its .get_modes() + * operation. + */ + if (pipe->output->panel) { + ret = drm_panel_attach(pipe->output->panel, + pipe->connector); + if (ret < 0) + return ret; } crtc = omap_crtc_init(dev, pipe, priv->planes[i]); @@ -400,8 +429,15 @@ static void omap_modeset_enable_external_hpd(struct drm_device *ddev) unsigned int i; for (i = 0; i < priv->num_pipes; i++) { - if (priv->pipes[i].connector) - omap_connector_enable_hpd(priv->pipes[i].connector); + struct drm_connector *connector = priv->pipes[i].connector; + + if (!connector) + continue; + + if (priv->pipes[i].output->next) + omap_connector_enable_hpd(connector); + else + drm_bridge_connector_enable_hpd(connector); } } @@ -414,8 +450,15 @@ static void omap_modeset_disable_external_hpd(struct drm_device *ddev) unsigned int i; for (i = 0; i < priv->num_pipes; i++) { - if (priv->pipes[i].connector) - omap_connector_disable_hpd(priv->pipes[i].connector); + struct drm_connector *connector = priv->pipes[i].connector; + + if (!connector) + continue; + + if (priv->pipes[i].output->next) + omap_connector_disable_hpd(connector); + else + drm_bridge_connector_disable_hpd(connector); } }