From patchwork Fri Aug 9 16:24:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11087225 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 BECD414D5 for ; Fri, 9 Aug 2019 16:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC7641FF73 for ; Fri, 9 Aug 2019 16:24:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FC6E200CB; Fri, 9 Aug 2019 16:24:34 +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 22AD5201B1 for ; Fri, 9 Aug 2019 16:24:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AB366EE58; Fri, 9 Aug 2019 16:24:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E81689CF5 for ; Fri, 9 Aug 2019 16:24:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id B7BF8FB03; Fri, 9 Aug 2019 18:24:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3amAQx4zBijK; Fri, 9 Aug 2019 18:24:24 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id A595841D9E; Fri, 9 Aug 2019 18:24:23 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Lee Jones , =?utf-8?q?Guido_G=C3=BCnther?= , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robert Chiras , Sam Ravnborg Subject: [PATCH v2 0/3] drm: bridge: Add NWL MIPI DSI host controller support Date: Fri, 9 Aug 2019 18:24:20 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This adds initial support for the NWL MIPI DSI Host controller found on i.MX8 SoCs. It adds support for the i.MX8MQ but the same IP core can also be found on e.g. i.MX8QXP. I added the necessary hooks to support other imx8 variants but since I only have imx8mq boards to test I omitted the platform data for other SoCs. The code is based on NXPs BSP so I added Robert Chiras as Co-authored-by. Robert, if this looks sane could you add your Signed-off-by:? The most notable changes over the BSP driver are - Calculate HS mode timing from phy_configure_opts_mipi_dphy - Perform all clock setup via DT - Merge nwl-imx and nwl drivers - Add B0 silion revision quirk - Become a bridge driver to hook into mxsfb (from what I read[0] DCSS, which also can drive the nwl on the imx8mq will likely not become part of imx-display-subsystem so it makes sense to make it drive a bridge for dsi as well). - Use panel_bridge to attach the panel This has been tested on a Librem 5 devkit using mxsfb with Robert's patches[1] and the rocktech-jh057n00900 panel driver on next-20190807. The DCSS can later on also act as input source too. Changes from v1: - Per review comments by Sam Ravnborg https://lists.freedesktop.org/archives/dri-devel/2019-July/228130.html - Change binding docs to YAML - build: Don't always visit imx-nwl/ - build: Add header-test-y - Sort headers according to DRM convention - Use drm_display_mode instead of videmode - Per review comments by Fabio Estevam https://lists.freedesktop.org/archives/dri-devel/2019-July/228299.html - Don't restrict build to ARCH_MXC - Drop unused includes - Drop unreachable code in imx_nwl_dsi_bridge_mode_fixup() - Drop remaining calls of dev_err() and use DRM_DEV_ERR() consistently. - Use devm_platform_ioremap_resource() - Drop devm_free_irq() in probe() error path - Use single line comments where sufficient - Use instead of defining USEC_PER_SEC - Make input source select imx8 specific - Drop inclusion (after removal of get_unaligned_le32) - Drop all EXPORT_SYMBOL_GPL() for functions used in the same module but different source files. - Drop nwl_dsi_enable_{rx,tx}_clock() by invoking clk_prepare_enable() directly - Remove pointless comment - Laurent Pinchart https://lists.freedesktop.org/archives/dri-devel/2019-July/228313.html https://lists.freedesktop.org/archives/dri-devel/2019-July/228308.html - Drop (on iMX8MQ) unused csr regmap - Use NWL_MAX_PLATFORM_CLOCKS everywhere - Drop get_unaligned_le32() usage - remove duplicate 'for the' in binding docs - Don't include unused - Don't include unused - Drop dpms_mode for tracking state, trust the drm layer on that - Use pm_runtime_put() instead of pm_runtime_put_sync() - Don't overwrite encoder type - Make imx_nwl_platform_data const - Use the reset controller API instead of open coding that platform specific part - Use intead of making up our own defines - name mipi_dsi_transfer less generic: nwl_dsi_transfer - ensure clean in .remove by calling mipi_dsi_host_unregister. - prefix constants by NWL_DSI_ - properly format transfer_direction enum - simplify platform clock handling - Don't modify state in mode_fixup() and use mode_set() instead - Drop bridge detach(), already handle by nwl_dsi_host_detach() - Drop USE_*_QUIRK() macros - Drop (for now) unused clock defnitions. 'pixel' and 'bypass' clock will be used for i.MX8 SoCs but since they're unused atm drop the definitions - but keep the logic to enable/disable several clocks in place since we know we'll need it in the future. Changes from v0: - Add quirk for IMQ8MQ silicon B0 revision to not mess with the system reset controller on power down since enable() won't work otherwise. - Drop devm_free_irq() handled by the device driver core - Disable tx esc clock after the phy power down to unbreak disable/enable (unblank/blank) - Add ports to dt binding docs - Select GENERIC_PHY_MIPI_DPHY instead of GENERIC_PHY for phy_mipi_dphy_get_default_config - Select DRM_MIPI_DSI - Include drm_print.h to fix build on next-20190408 - Drop some debugging messages - Newline terminate all DRM_ printouts - Turn component driver into a drm bridge [0]: https://lists.freedesktop.org/archives/dri-devel/2019-May/219484.html [1]: https://patchwork.freedesktop.org/series/62822/ Guido Günther (3): arm64: imx8mq: add imx8mq iomux-gpr field defines dt-bindings: display/bridge: Add binding for NWL mipi dsi host controller drm/bridge: Add NWL MIPI DSI host controller support .../bindings/display/bridge/nwl-dsi.yaml | 155 ++++ drivers/gpu/drm/bridge/Kconfig | 2 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/nwl-dsi/Kconfig | 15 + drivers/gpu/drm/bridge/nwl-dsi/Makefile | 4 + drivers/gpu/drm/bridge/nwl-dsi/nwl-drv.c | 484 ++++++++++++ drivers/gpu/drm/bridge/nwl-dsi/nwl-drv.h | 66 ++ drivers/gpu/drm/bridge/nwl-dsi/nwl-dsi.c | 700 ++++++++++++++++++ drivers/gpu/drm/bridge/nwl-dsi/nwl-dsi.h | 112 +++ include/linux/mfd/syscon/imx8mq-iomuxc-gpr.h | 62 ++ 10 files changed, 1601 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/Kconfig create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/Makefile create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/nwl-drv.c create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/nwl-drv.h create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/nwl-dsi.c create mode 100644 drivers/gpu/drm/bridge/nwl-dsi/nwl-dsi.h create mode 100644 include/linux/mfd/syscon/imx8mq-iomuxc-gpr.h