From patchwork Sun Jul 7 18:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11034175 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 617AC13A4 for ; Sun, 7 Jul 2019 18:10:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4665128329 for ; Sun, 7 Jul 2019 18:10:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 346DE2837E; Sun, 7 Jul 2019 18:10:11 +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 E8C8528329 for ; Sun, 7 Jul 2019 18:10:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7EDEB893EA; Sun, 7 Jul 2019 18:10:07 +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 [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D391893EA for ; Sun, 7 Jul 2019 18:10:06 +0000 (UTC) Received: from pendragon.nordic-sky.finnair.com (unknown [38.98.37.142]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EB96CC; Sun, 7 Jul 2019 20:09:45 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 00/60] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Date: Sun, 7 Jul 2019 21:07:52 +0300 Message-Id: <20190707180852.5512-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562523004; bh=+X2P82ZcNYkRvWdRvMTldDDJfUZsMzNZvWqd1r3W/9A=; h=From:To:Cc:Subject:Date:From; b=jg+KHZg8G/Eqax0Jb7ckJYDfGhwUftS6awta28VMoD+p5/tEebFJa3kBippA/oN3d y0YHPhdvNUk4CEUvjOrcEsffA3yYJ+QJUTOuOC1A9PnAry+JNBeqra8Cy+T72uCwE7 FuxBhIxoqAsztqC7PqY69X02gNjb9V5HfyFF9lCI= 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 Hello, This patch series (nearly, see [1]) completes the rework of the omapdrm driver to move to drm_bridge and drm_panel. What a journey. This work was started more than a year ago, and this last piece is perhaps the one that will generate the most bikeshedding as it touches the DRM core. I'm braced for the impact, but please be gentle :-) Let's start with some context to understand the problem. omapdrm contains custom drivers for external encoders, panels and connectors (collectively referred to as display drivers). It combines them to create output pipelines abstracted by a drm_encoder and a drm_connector, with the ability to delegate the encoder and connector operations to the component in the pipeline that implements them. For instance, for an HDMI output pipeline, the hot plug detection and the EDID read can be implemented by two different components, when they are handled by two different devices at the hardware level. DRM/KMS uses drm_bridge and drm_panel to abstract external encoders and panels. The model is however simpler than what omapdrm provides, as bridges were designed to be simple add-ons at the output of a drm_encoder. The ability to chain bridges exists, but a bridge driver hardcodes in its design its position in the pipeline : bridges that expect to terminate the pipeline create a drm_connector, while bridges that expect to be an intermediate component in the pipeline do not create a connector. In addition to not supporting bridges that can be either internal or a termination point in the pipeline depending on the hardware design, implementing the drm_connector inside a bridge driver makes it impossible to support hardware where bridge operations are handled by different hardware components, as explained above. The omapdrm driver has received support for drm_bridge and drm_panel, but these issues prevented completely moving away from the omapdrm custom display drivers. This patch series thus first reworks the drm_bridge infrastructure to support the omapdrm use cases, and then transitions the omapdrm driver. The series starts by 01/60 that adds a new flag to the drm_display_info structure to identify HDMI sinks. This is a feature needed by the OMAP4 and OMAP5 HDMI encoders, and I believe it can be useful to other HDMI encoders as well. 02/60 is then a small drive-by cleanup. The first sizeable change follows with the rename of the dumb-vga-dac driver to simple-bridge (03/60 and 04/60) and support for non-VGA bridges (05/60). This doesn't change the spirit of the driver that still focusses on transparent bridges, but prepares it to support an analog video amplifier. Patches 06/60 then add support for an enable GPIO, and 07/60 support for the OPA362 video amplifier itself. The next two patches address the drm_bridge issues explained above. Patch 08/60 makes it possible to attach to a bridge without having the bridge create a connector. The connector is expected to be created by the display controller driver. Patch 09/60 adds connector-related operations to drm_bridge to make this possible. The approach taken here is slightly intrusive as path 08/60 adds a parameter to tbe bridge .attach() operation, and thus touches all bridge drivers, even if the changes are very simple (as a consequence I haven't CC'ed all the individual bridge maintainers as the CC list was too large). Other options may be possible, what matters most to me is the feature, not so much its implementation. Please note that I envision the parameter to be removed down the road once all bridge drivers will be converted to the new model (but this will likely take time, and both models can co-exist for as long as necessary). The next six patches make use of these new features: patches 10/60 and 11/60 add new bridge drivers for display connectors and for the TI TPD12S015 HDMI level shifter respectively, patch 12/60 supports the new API in the panel bridge driver, and patches 13/60 to 15/60 do the same in the ti-tfp410 driver. The nine patches that follow add support for six new panels, with the related DT bindings (16/60 to 18/60) and the drm_panel drivers (19/60 to 24/60). The code originates from the corresponding omapdrm-specific panel drivers (which explains why only three DT patches are needed as most of the bindings are already present). Patch 25/60 is possibly the most remarkable one in the series, with the drm_bridge operations extension, as it provides a helper for display controller drivers to construct a drm_connector entirerly backed by a chain of bridges. This offsets the complexity of the additional bridge operations by handling it all in a single place. An example usage for omapdrm can be found in patch 43/60. Don't let its diffstat mislead you, usage of the helper would remove lots of code if it wasn't for the fact that the legacy implementation still has to be kept for the DSI panel (see [1]). Down the road this helper and the new operation paradigm should remove code from both display controller and bridge drivers. The rest of the series is omapdrm-focussed, slowly preparing the driver for the switch to drm_bridge drivers using the new helper (43/60), the removal of the omapdrm-specific display drivers (44/60 and 50/60), and lots of simplification and code removal in the other patches. [1] The only notable exception is the omapdrm-specific DSI panel driver that implements a large number of custom operations. This should be addressed separately. Laurent Pinchart (60): drm/edid: Add flag to drm_display_info to identify HDMI sinks video: hdmi: Change return type of hdmi_avi_infoframe_init() to void drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge drm/bridge: dumb-vga-dac: Rename driver to simple-bridge drm/bridge: simple-bridge: Add support for non-VGA bridges drm/bridge: simple-bridge: Add support for enable GPIO drm/bridge: simple-bridge: Add support for the TI OP362 drm/bridge: Extend bridge API to disable connector creation drm/bridge: Add connector-related bridge operations and data drm/bridge: Add bridge driver for display connectors drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter drm/bridge: panel: Implement bridge connector operations drm/bridge: tfp410: Don't include drmP.h drm/bridge: tfp410: Replace manual connector handling with bridge drm/bridge: tfp410: Allow operation without drm_connector dt-bindings: Add vendor prefix for LG Display dt-bindings: Add legacy 'toppoly' vendor prefix dt-bindings: display: panel: Add bindings for NEC NL8048HL11 panel drm/panel: Add driver for the LG Philips LB035Q02 panel drm/panel: Add driver for the NEC NL8048HL11 panel drm/panel: Add driver for the Sharp LS037V7DW01 panel drm/panel: Add driver for the Sony ACX565AKM panel drm/panel: Add driver for the Toppology TD028TTEC1 panel drm/panel: Add driver for the Toppology TD043MTEA1 panel drm: Add helper to create a connector for a chain of bridges drm/omap: Detach from panels at remove time drm/omap: Simplify HDMI mode and infoframe configuration drm/omap: Factor out display type to connector type conversion drm/omap: Use the drm_panel_bridge API drm/omap: dss: Fix output next device lookup in DT drm/omap: Add infrastructure to support drm_bridge local to DSS outputs drm/omap: dss: Make omap_dss_device_ops optional drm/omap: hdmi: Allocate EDID in the .read_edid() operation drm/omap: hdmi4: Rework EDID read to isolate data read drm/omap: hdmi5: Rework EDID read to isolate data read drm/omap: hdmi4: Register a drm_bridge for EDID read drm/omap: hdmi5: Register a drm_bridge for EDID read drm/omap: hdmi4: Move mode set, enable and disable operations to bridge drm/omap: hdmi5: Move mode set, enable and disable operations to bridge drm/omap: hdmi4: Implement drm_bridge .lost_hotplug() operation drm/omap: dss: Remove .set_hdmi_mode() and .set_infoframe() operations drm/omap: venc: Register a drm_bridge drm/omap: Create connector for bridges drm/omap: Switch the HDMI and VENC outputs to drm_bridge drm/omap: Remove HPD, detect and EDID omapdss operations drm/omap: hdmi: Remove omap_dss_device operations drm/omap: venc: Remove omap_dss_device operations drm/omap: hdmi4: Simplify EDID read drm/omap: hdmi5: Simplify EDID read drm/omap: displays: Remove unused panel drivers drm/omap: dpi: Sort includes alphabetically drm/omap: dpi: Reorder functions in sections drm/omap: dpi: Simplify clock setting API drm/omap: dpi: Register a drm_bridge drm/omap: sdi: Sort includes alphabetically drm/omap: sdi: Register a drm_bridge drm/omap: Simplify connector implementation drm/omap: dss: Remove unused omap_dss_device operations drm/omap: dss: Inline the omapdss_display_get() function drm/omap: dss: Remove unused omapdss_of_find_connected_device() function .../bindings/display/panel/nec,nl8048hl11.txt | 38 + .../devicetree/bindings/vendor-prefixes.yaml | 4 + arch/arm/configs/davinci_all_defconfig | 2 +- arch/arm/configs/integrator_defconfig | 2 +- arch/arm/configs/multi_v7_defconfig | 2 +- arch/arm/configs/shmobile_defconfig | 2 +- arch/arm/configs/sunxi_defconfig | 2 +- arch/arm/configs/versatile_defconfig | 2 +- drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/arc/arcpgu_hdmi.c | 2 +- .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 2 +- drivers/gpu/drm/bridge/Kconfig | 29 +- drivers/gpu/drm/bridge/Makefile | 4 +- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 +- drivers/gpu/drm/bridge/analogix-anx78xx.c | 6 +- .../drm/bridge/analogix/analogix_dp_core.c | 8 +- drivers/gpu/drm/bridge/cdns-dsi.c | 6 +- drivers/gpu/drm/bridge/display-connector.c | 327 ++++++++ drivers/gpu/drm/bridge/dumb-vga-dac.c | 296 ------- drivers/gpu/drm/bridge/lvds-encoder.c | 4 +- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 6 +- drivers/gpu/drm/bridge/nxp-ptn3460.c | 6 +- drivers/gpu/drm/bridge/panel.c | 21 +- drivers/gpu/drm/bridge/parade-ps8622.c | 5 +- drivers/gpu/drm/bridge/sii902x.c | 6 +- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- drivers/gpu/drm/bridge/simple-bridge.c | 337 ++++++++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +- drivers/gpu/drm/bridge/tc358764.c | 5 +- drivers/gpu/drm/bridge/tc358767.c | 5 +- drivers/gpu/drm/bridge/thc63lvd1024.c | 5 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 5 +- drivers/gpu/drm/bridge/ti-tfp410.c | 202 ++--- drivers/gpu/drm/bridge/ti-tpd12s015.c | 204 +++++ drivers/gpu/drm/drm_bridge.c | 97 ++- drivers/gpu/drm/drm_bridge_connector.c | 385 +++++++++ drivers/gpu/drm/drm_edid.c | 8 +- drivers/gpu/drm/drm_simple_kms_helper.c | 2 +- drivers/gpu/drm/exynos/exynos_dp.c | 3 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 2 +- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 2 +- drivers/gpu/drm/i2c/tda998x_drv.c | 8 +- drivers/gpu/drm/imx/imx-ldb.c | 2 +- drivers/gpu/drm/imx/parallel-display.c | 2 +- drivers/gpu/drm/mcde/mcde_dsi.c | 6 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 2 +- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 8 +- drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +- drivers/gpu/drm/msm/edp/edp_bridge.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 2 +- drivers/gpu/drm/omapdrm/displays/Kconfig | 60 -- drivers/gpu/drm/omapdrm/displays/Makefile | 10 - .../omapdrm/displays/connector-analog-tv.c | 100 --- .../gpu/drm/omapdrm/displays/connector-hdmi.c | 186 ----- .../gpu/drm/omapdrm/displays/encoder-opa362.c | 140 ---- .../drm/omapdrm/displays/encoder-tpd12s015.c | 220 ----- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 2 +- .../displays/panel-lgphilips-lb035q02.c | 254 ------ .../omapdrm/displays/panel-nec-nl8048hl11.c | 271 ------- .../displays/panel-sharp-ls037v7dw01.c | 265 ------ .../omapdrm/displays/panel-sony-acx565akm.c | 766 ------------------ .../omapdrm/displays/panel-tpo-td028ttec1.c | 401 --------- .../omapdrm/displays/panel-tpo-td043mtea1.c | 513 ------------ drivers/gpu/drm/omapdrm/dss/Makefile | 2 +- drivers/gpu/drm/omapdrm/dss/base.c | 72 +- drivers/gpu/drm/omapdrm/dss/display.c | 9 - drivers/gpu/drm/omapdrm/dss/dpi.c | 336 ++++---- drivers/gpu/drm/omapdrm/dss/dsi.c | 4 +- drivers/gpu/drm/omapdrm/dss/dss-of.c | 28 - drivers/gpu/drm/omapdrm/dss/dss.c | 3 +- drivers/gpu/drm/omapdrm/dss/hdmi.h | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 321 ++++---- drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 59 +- drivers/gpu/drm/omapdrm/dss/hdmi4_core.h | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 303 +++---- drivers/gpu/drm/omapdrm/dss/hdmi5_core.c | 48 +- drivers/gpu/drm/omapdrm/dss/hdmi5_core.h | 5 +- .../gpu/drm/omapdrm/dss/omapdss-boot-init.c | 12 - drivers/gpu/drm/omapdrm/dss/omapdss.h | 47 +- drivers/gpu/drm/omapdrm/dss/output.c | 55 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 187 +++-- drivers/gpu/drm/omapdrm/dss/venc.c | 269 +++--- drivers/gpu/drm/omapdrm/omap_connector.c | 246 +----- drivers/gpu/drm/omapdrm/omap_connector.h | 3 - drivers/gpu/drm/omapdrm/omap_drv.c | 98 ++- drivers/gpu/drm/omapdrm/omap_encoder.c | 83 +- drivers/gpu/drm/panel/Kconfig | 44 + drivers/gpu/drm/panel/Makefile | 6 + drivers/gpu/drm/panel/panel-lg-lb035q02.c | 235 ++++++ drivers/gpu/drm/panel/panel-nec-nl8048hl11.c | 249 ++++++ .../gpu/drm/panel/panel-sharp-ls037v7dw01.c | 231 ++++++ drivers/gpu/drm/panel/panel-sony-acx565akm.c | 691 ++++++++++++++++ drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | 382 +++++++++ drivers/gpu/drm/panel/panel-tpo-td043mtea1.c | 510 ++++++++++++ drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 2 +- drivers/gpu/drm/rcar-du/rcar_lvds.c | 7 +- drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 +- drivers/gpu/drm/rockchip/rockchip_rgb.c | 2 +- drivers/gpu/drm/sti/sti_dvo.c | 2 +- drivers/gpu/drm/sti/sti_hda.c | 2 +- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- drivers/gpu/drm/stm/ltdc.c | 2 +- drivers/gpu/drm/sun4i/sun4i_lvds.c | 2 +- drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_external.c | 2 +- drivers/gpu/drm/vc4/vc4_dpi.c | 2 +- drivers/gpu/drm/vc4/vc4_dsi.c | 2 +- drivers/video/hdmi.c | 9 +- include/drm/drm_bridge.h | 174 +++- include/drm/drm_bridge_connector.h | 18 + include/drm/drm_connector.h | 5 + include/linux/hdmi.h | 2 +- 116 files changed, 5188 insertions(+), 4900 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/panel/nec,nl8048hl11.txt create mode 100644 drivers/gpu/drm/bridge/display-connector.c delete mode 100644 drivers/gpu/drm/bridge/dumb-vga-dac.c create mode 100644 drivers/gpu/drm/bridge/simple-bridge.c create mode 100644 drivers/gpu/drm/bridge/ti-tpd12s015.c create mode 100644 drivers/gpu/drm/drm_bridge_connector.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c delete mode 100644 drivers/gpu/drm/omapdrm/dss/dss-of.c create mode 100644 drivers/gpu/drm/panel/panel-lg-lb035q02.c create mode 100644 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c create mode 100644 drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c create mode 100644 drivers/gpu/drm/panel/panel-sony-acx565akm.c create mode 100644 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c create mode 100644 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c create mode 100644 include/drm/drm_bridge_connector.h