From patchwork Sat Aug 22 16:32:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 253506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F91C433DF for ; Sat, 22 Aug 2020 16:33:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C5AE206C0 for ; Sat, 22 Aug 2020 16:33:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="Ep+wl6yA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728564AbgHVQdb (ORCPT ); Sat, 22 Aug 2020 12:33:31 -0400 Received: from crapouillou.net ([89.234.176.41]:48722 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728514AbgHVQdb (ORCPT ); Sat, 22 Aug 2020 12:33:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1598113990; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VOADsf+zkaa1JPcnuwuK9JFkqtkUN121yhXN3FKMvOY=; b=Ep+wl6yA0yE8XujoZQ6btOAQ279oBjOy45Ow/JBcHJtGy5ZXQHk1rDrRbfBxqe5B1V3Y7X UIarEkz8KvQXNQBOHnV5IqTdgWr+47DruOJek+25sNNWrGEQQfrw0iUoi8k4EihXyPgVmO KCPinisdWvjOh/ix6gwIUVhWYNRGyT8= From: Paul Cercueil To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf Tronnes , Laurent Pinchart , Linus Walleij Cc: od@zcrc.me, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 3/6] drm: Add SPI DBI host driver Date: Sat, 22 Aug 2020 18:32:47 +0200 Message-Id: <20200822163250.63664-4-paul@crapouillou.net> In-Reply-To: <20200822163250.63664-1-paul@crapouillou.net> References: <20200822163250.63664-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This driver will register a DBI host driver for panels connected over SPI. DBI types c1 and c3 are supported. C1 is a SPI protocol with 9 bits per word, with the data/command information in the 9th (MSB) bit. C3 is a SPI protocol with 8 bits per word, with the data/command information carried by a separate GPIO. v2: - Move ouside of drivers/gpu/drm/bridge/ - The client drivers should now use module_mipi_dbi_spi_driver(). This ensures that the panel drivers can probe from the DSI/DBI bus, as well as from the SPI bus, using a shared OF match table. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/Kconfig | 8 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_mipi_dbi_spi.c | 247 +++++++++++++++++++++++++++++ include/drm/drm_mipi_dbi_spi.h | 42 +++++ 4 files changed, 298 insertions(+) create mode 100644 drivers/gpu/drm/drm_mipi_dbi_spi.c create mode 100644 include/drm/drm_mipi_dbi_spi.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 147d61b9674e..932c7bcaeff0 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -32,6 +32,14 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_MIPI_DBI_SPI + tristate "SPI host support for MIPI DBI" + depends on DRM && OF && SPI + select DRM_MIPI_DSI + select DRM_MIPI_DBI + help + Enable this option to support DBI panels connected over SPI. + config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 2f31579f91d4..8c60448a3ee5 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/ obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o +obj-$(CONFIG_DRM_MIPI_DBI_SPI) += drm_mipi_dbi_spi.o obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o obj-y += arm/ obj-$(CONFIG_DRM_TTM) += ttm/ diff --git a/drivers/gpu/drm/drm_mipi_dbi_spi.c b/drivers/gpu/drm/drm_mipi_dbi_spi.c new file mode 100644 index 000000000000..a7eaf3125a17 --- /dev/null +++ b/drivers/gpu/drm/drm_mipi_dbi_spi.c @@ -0,0 +1,247 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MIPI Display Bus Interface (DBI) SPI support + * + * Copyright 2016 Noralf Trønnes + * Copyright 2020 Paul Cercueil + */ + +#include +#include +#include + +#include +#include + +#include