From patchwork Sat Aug 22 16:32:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11732235 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB91A1392 for ; Mon, 24 Aug 2020 06:55:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C9DCB2067C for ; Mon, 24 Aug 2020 06:55:52 +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="BriWF3t3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9DCB2067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crapouillou.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A777D6EC64; Mon, 24 Aug 2020 06:55:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from crapouillou.net (crapouillou.net [89.234.176.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 080D36E49F for ; Sat, 22 Aug 2020 16:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1598113992; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8PRTP+GttRbJXj9uz8wD1O1UnEM1+wUPJ8xznVdIxxk=; b=BriWF3t3gW5FkF2IqXWbsYeCpqQ/5n0rASe4pX7rDxQEKZW+mVDt+O8OtdJgkak105fOag kWLVuTMcGVJpsL7V6dSOOI0cUc2L52UAQwWQh9l6Zhi0luER5v56qeC3XoHKYZgRY45nOL tUsLPw0hdK5PPZ2QLFnyJK+tjB2Op8A= 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 Subject: [PATCH v2 4/6] drm/tiny: Add TinyDRM for DSI/DBI panels Date: Sat, 22 Aug 2020 18:32:48 +0200 Message-Id: <20200822163250.63664-5-paul@crapouillou.net> In-Reply-To: <20200822163250.63664-1-paul@crapouillou.net> References: <20200822163250.63664-1-paul@crapouillou.net> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 24 Aug 2020 06:55:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , devicetree@vger.kernel.org, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The new API function mipi_dsi_maybe_register_tiny_driver() is supposed to be called by DSI/DBI panel drivers at the end of their probe. If it is detected that the panel is not connected to any controller, because it has no port #0 node in Device Tree that points back to it, then a TinyDRM driver is registered with it. This TinyDRM driver expects that a DCS-compliant protocol is used by the DSI/DBI panel and can only be used with these. v2: No change Signed-off-by: Paul Cercueil --- drivers/gpu/drm/tiny/Kconfig | 8 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/tiny-dsi.c | 266 ++++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 19 +++ 4 files changed, 294 insertions(+) create mode 100644 drivers/gpu/drm/tiny/tiny-dsi.c diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig index 2b6414f0fa75..b62427b88dfe 100644 --- a/drivers/gpu/drm/tiny/Kconfig +++ b/drivers/gpu/drm/tiny/Kconfig @@ -28,6 +28,14 @@ config DRM_GM12U320 This is a KMS driver for projectors which use the GM12U320 chipset for video transfer over USB2/3, such as the Acer C120 mini projector. +config TINYDRM_DSI + tristate "DRM support for generic DBI/DSI display panels" + depends on DRM && DRM_MIPI_DSI + select DRM_MIPI_DBI + select DRM_KMS_CMA_HELPER + help + DRM driver for generic DBI/DSI display panels + config TINYDRM_HX8357D tristate "DRM support for HX8357D display panels" depends on DRM && SPI diff --git a/drivers/gpu/drm/tiny/Makefile b/drivers/gpu/drm/tiny/Makefile index 6ae4e9e5a35f..2bfee13347a5 100644 --- a/drivers/gpu/drm/tiny/Makefile +++ b/drivers/gpu/drm/tiny/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o obj-$(CONFIG_DRM_GM12U320) += gm12u320.o +obj-$(CONFIG_TINYDRM_DSI) += tiny-dsi.o obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o obj-$(CONFIG_TINYDRM_ILI9225) += ili9225.o obj-$(CONFIG_TINYDRM_ILI9341) += ili9341.o diff --git a/drivers/gpu/drm/tiny/tiny-dsi.c b/drivers/gpu/drm/tiny/tiny-dsi.c new file mode 100644 index 000000000000..b24d49836125 --- /dev/null +++ b/drivers/gpu/drm/tiny/tiny-dsi.c @@ -0,0 +1,266 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * TinyDRM driver for standard DSI/DBI panels + * + * Copyright 2020 Paul Cercueil + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include