From patchwork Fri May 24 09:20:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165092 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3319453ili; Fri, 24 May 2019 02:20:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7fG8r14T4EuHGf9SAzP4GntltD5ORMvhaVngJrIyQksqp7mgr+mdltBkBnKkGrLJRWvaa X-Received: by 2002:a62:3085:: with SMTP id w127mr87116032pfw.170.1558689634649; Fri, 24 May 2019 02:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558689634; cv=none; d=google.com; s=arc-20160816; b=NedGhag9aomxD6+hnQuQ3aezFXzJfwys9XXJc8Z5Caexeaow+SpoLUCn7S+SiBT7MT yvlYpm7kcT6SFYzXnu+eaFON6JiM5i7Lzknfnn8Rnmg/AxOgQXpOk7ZrLSBYzqWQcbpd sVJW6lP4hbpxnREOD4bi3/6Mexb8NIz3iX8byJLBmGg0V9GDE+zXFlvEvxaZU/2IZogK LthIn0Pqsee86UWSMlLWdQba4cUDxQs5+eAwaZhCofFm4IJT+86Pw5wC6pLXjKwr2foU bjCj3JMKcHepkNHa7oTvSLHAYC/0fpljxLeZXfGZsl4Ybs+i+PNlN60stzUlqi9O9tYi 2v9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=CpE0FoF/SGOGI+ykdgOrdvaAC4ug8+KvPlCOukRCU1g=; b=T/4SppbuWkHkZcsw55dnV2kHcZZTLI5YlTKS8AGU5ex4QB3HbyJ3wpaMZpxZA0LJyJ JGtj0wVSRWYWuj4ClFJ+vE493Rj1hOsalyX7owGhhoCrb5XQGvYoDpD6DfpuDvzZ3COF lm7G6m5uNDWS1TnUj/YJHZsA7f+Hch12J1jnBb3HdnXmcKRQbjYv4V6GpkqKv6+c0RSq JFwM/lefK3txu2ebaM5X1AhEq0ExAAdotxVUbqM1MOUmjcK92xXo86gJMIPU7pR6NUl7 XIhrWJpgwqNFnej6rFnyIAPmxTR9a0y2pD8hX2mpnottEIXmqfFLb6lOdZ2QeZ+I8+fb B1Hg== ARC-Authentication-Results: i=1; mx.google.com; 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 x19si3343670pfr.226.2019.05.24.02.20.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 02:20:34 -0700 (PDT) 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; 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 CDE5C8910C; Fri, 24 May 2019 09:20:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8DB16E0A5 for ; Fri, 24 May 2019 09:20:28 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id b11so174362lfa.5 for ; Fri, 24 May 2019 02:20:28 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=ZioeGdLZKB5v6MZL8EwV0+7iKs90Ylwsuwww37jZoDY=; b=DB0AXxunAKHTw0rYYOmLp8w3ZNyHxm9jlbgiIB2uLtLBbjV0O/FNrUIGro8VKvwSKw SPTmqgjCKUH82D0tkpCBRablPrnQ8RGW5LmM0qep1RT/DrvZeJxVLtyZnj6leP1ODV4A eLDEE+j+F4c2neekHbaya+Ye0iHyf21yABUhqEvcwf0XWO3WpTs+8zOIxNLecIncZt0r yw50WSBEpJZAiT3m0LT/fO5Tc1EGJDzGKtXVviyO10nNBQK4DJ4p/qnoTO13MxmkJxcr GQ3yIp6xiCJncK9A5h3ae3AbL4OXoz1HWkW8AFH1IERqb90myxRjo+eBBdiu03Y0Zusr 7jPA== X-Gm-Message-State: APjAAAUrdxI9ABH4L/S1WAu6b561+STsdUmnLXsMO0dBmJsES7l+8IA3 VBR5Gt1DkEdhaYGNPjcMqtByALeIXVk= X-Received: by 2002:ac2:418c:: with SMTP id z12mr20131398lfh.0.1558689625093; Fri, 24 May 2019 02:20:25 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t22sm408611lje.58.2019.05.24.02.20.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 02:20:23 -0700 (PDT) From: Linus Walleij To: dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Sean Paul Subject: [PATCH v4] drm/mcde: Add new driver for ST-Ericsson MCDE Date: Fri, 24 May 2019 11:20:19 +0200 Message-Id: <20190524092019.19355-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZioeGdLZKB5v6MZL8EwV0+7iKs90Ylwsuwww37jZoDY=; b=kn2CnSbPAng/Y/t+eY6v7PNQ/2NMqn92cCt5lPwOzLzjED1wHOMt/oDvETDHcCFvzz 0YLGzIO6AuxstLBFosVOQ3OtMjxncJqBMvxgbz5FTgKhXHAlpiowV15XlEyi86M1HQQ8 dv5oSjFF8+JtXGePUs+EKbRjactWC9oZ6TQyuQQyKTMhVmM0VQUVMXHQfeBr7BpEAovd YFornedPFAM0YKsxM1tdk7VZEfRfQ4+6ClXZZKJyUKQRKN7+PVooOZgRWoAHmxMqVnA7 jilv5DtPh2wdeXSPO3AtBe/rBJrnCy4B5KGJtiLcQzvgCpVSbzH9jeYlPd3iUyI5yJLg 62XQ== 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: Daniel Vetter , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds a new DRM driver for the ST-Ericsson Multi Channel Display Engine, MCDE display controller. This hardware has three independent DSI hosts and can composit and display several memory buffers onto an LCD display. It was developed for several years inside of ST-Ericsson and shipped with a few million mobile phones from Sony and Samsung, as well as with the Snowball community development board. The driver is currently pretty rudimentary but supports a simple framebuffer so we can get penguins and graphics when using these SoCs. Acked-by: Daniel Vetter Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Collect Dvetters ACK. - Fix a stray semicolons warning (found by kbuild). ChangeLog v2->v3: - Break out functions for enabling and disabling the display pipeline, use abstract enums to indicate FIFOs, channels, external sources, formatters and overlays. - Break out functions to configure channel, FIFO, external sources, formatter and overlays. This makes it more clear how the display pipeline is actually set up. - Split out the registers to separate include files for the mcde_display.c and mcde_dsi.c driver files. Keep the few registers in mcde_drv.c locally. - Switch event handling and display update in the .update() callback so that we arm the vblank IRQ before we send the display update, so there is no risk of missing the vblank IRQ. - Use drm_gem_fb_simple_display_pipe_prepare_fb() - Use drm_gem_fb_create_with_dirty() and we start to get better explicit commits of the dirty framebuffers, with the core enabling and using the vblank, interrupt count going up. - Get rid of the helper variables "enabled" and "vblank_irq_on" that were competing with atomic updates. Instead call the drm_atomic_helper_commit_tail_rpm() from the mode config helpers .atomic_commit_tail() so that the CRTC is always enabled before sending an update and voila it magically works. - Order includes alphabetically. - Get rid of - Move to using an embedded struct drm_device and using drm_dev_init() ChangeLog v1->v2: - Replace the quirky custom encoder structure and hacks in the FBDEV core with a straight-forward internal DSI bridge which is in turn connected to the panel bridge. It works like a charm, much to my surprise. - Drop the panel port graph parsing for the DSI host to panels: the panels are children of the DSI node, so just spin over the children and take the first working panel. - Move clock lookup and handling for the DSI HS and LP clocks to the DSI driver file as this is now cleanly associated with respective DSI port. --- Documentation/gpu/drivers.rst | 1 + Documentation/gpu/mcde.rst | 8 + MAINTAINERS | 7 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/mcde/Kconfig | 18 + drivers/gpu/drm/mcde/Makefile | 3 + drivers/gpu/drm/mcde/mcde_display.c | 1145 ++++++++++++++++++++++ drivers/gpu/drm/mcde/mcde_display_regs.h | 518 ++++++++++ drivers/gpu/drm/mcde/mcde_drm.h | 44 + drivers/gpu/drm/mcde/mcde_drv.c | 572 +++++++++++ drivers/gpu/drm/mcde/mcde_dsi.c | 1044 ++++++++++++++++++++ drivers/gpu/drm/mcde/mcde_dsi_regs.h | 385 ++++++++ 13 files changed, 3748 insertions(+) create mode 100644 Documentation/gpu/mcde.rst create mode 100644 drivers/gpu/drm/mcde/Kconfig create mode 100644 drivers/gpu/drm/mcde/Makefile create mode 100644 drivers/gpu/drm/mcde/mcde_display.c create mode 100644 drivers/gpu/drm/mcde/mcde_display_regs.h create mode 100644 drivers/gpu/drm/mcde/mcde_drm.h create mode 100644 drivers/gpu/drm/mcde/mcde_drv.c create mode 100644 drivers/gpu/drm/mcde/mcde_dsi.c create mode 100644 drivers/gpu/drm/mcde/mcde_dsi_regs.h diff --git a/Documentation/gpu/drivers.rst b/Documentation/gpu/drivers.rst index 044a7025477c..4bfb7068e9f7 100644 --- a/Documentation/gpu/drivers.rst +++ b/Documentation/gpu/drivers.rst @@ -7,6 +7,7 @@ GPU Driver Documentation amdgpu amdgpu-dc i915 + mcde meson pl111 tegra diff --git a/Documentation/gpu/mcde.rst b/Documentation/gpu/mcde.rst new file mode 100644 index 000000000000..c69e977defda --- /dev/null +++ b/Documentation/gpu/mcde.rst @@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================================= + drm/mcde ST-Ericsson MCDE Multi-channel display engine +======================================================= + +.. kernel-doc:: drivers/gpu/drm/mcde/mcde_drv.c + :doc: ST-Ericsson MCDE DRM Driver diff --git a/MAINTAINERS b/MAINTAINERS index 5cfbea4ce575..56cbc8780507 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5128,6 +5128,13 @@ S: Maintained F: drivers/gpu/drm/tinydrm/st7735r.c F: Documentation/devicetree/bindings/display/sitronix,st7735r.txt +DRM DRIVER FOR ST-ERICSSON MCDE +M: Linus Walleij +T: git git://anongit.freedesktop.org/drm/drm-misc +S: Maintained +F: drivers/gpu/drm/mcde/ +F: Documentation/devicetree/bindings/display/ste,mcde.txt + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index e360a4a131e1..0fe1d59e4479 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -342,6 +342,8 @@ source "drivers/gpu/drm/panfrost/Kconfig" source "drivers/gpu/drm/aspeed/Kconfig" +source "drivers/gpu/drm/mcde/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 72f5036d9bfa..15e4841fe4cd 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -113,3 +113,4 @@ obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/ obj-$(CONFIG_DRM_LIMA) += lima/ obj-$(CONFIG_DRM_PANFROST) += panfrost/ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ +obj-$(CONFIG_DRM_MCDE) += mcde/ diff --git a/drivers/gpu/drm/mcde/Kconfig b/drivers/gpu/drm/mcde/Kconfig new file mode 100644 index 000000000000..b3990126562c --- /dev/null +++ b/drivers/gpu/drm/mcde/Kconfig @@ -0,0 +1,18 @@ +config DRM_MCDE + tristate "DRM Support for ST-Ericsson MCDE (Multichannel Display Engine)" + depends on DRM + depends on CMA + depends on ARM || COMPILE_TEST + depends on OF + select MFD_SYSCON + select DRM_MIPI_DSI + select DRM_BRIDGE + select DRM_PANEL_BRIDGE + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_GEM_CMA_HELPER + select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE + help + Choose this option for DRM support for the ST-Ericsson MCDE + Multi-Channel Display Engine. + If M is selected the module will be called mcde_drm. diff --git a/drivers/gpu/drm/mcde/Makefile b/drivers/gpu/drm/mcde/Makefile new file mode 100644 index 000000000000..fe28f4e0fe46 --- /dev/null +++ b/drivers/gpu/drm/mcde/Makefile @@ -0,0 +1,3 @@ +mcde_drm-y += mcde_drv.o mcde_dsi.o mcde_display.o + +obj-$(CONFIG_DRM_MCDE) += mcde_drm.o diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c new file mode 100644 index 000000000000..2843eadd92fc --- /dev/null +++ b/drivers/gpu/drm/mcde/mcde_display.c @@ -0,0 +1,1145 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Linus Walleij + * Parts of this file were based on the MCDE driver by Marcus Lorentzon + * (C) ST-Ericsson SA 2013 + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include