Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1062054pxa; Sat, 22 Aug 2020 09:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWu5fbEZJwwSjw1ya6LMEikrWbVbXSxrSdfTjAOOBOnguurqRSoVLzaCd5IrenpVWpfyW7 X-Received: by 2002:aa7:dd91:: with SMTP id g17mr8192351edv.186.1598114188148; Sat, 22 Aug 2020 09:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598114188; cv=none; d=google.com; s=arc-20160816; b=RdVK/iOhWLEAFS3tDD7oAOeoOoBt7oH09k1u4YVONgbschkJkcfvGMInPzLs6JIPTU k4CoXaX/GS4Fwlonkn2OlV1Obzo7CKU6KZu3i6kMPuRWdew5bjcjx/XPnBrcg/W69/nC CchXm4KkDt6HyTvbK76GVfsdQLGFgRi45RDFlGsBPouP90P3mzwPVvCvww5LpxoMMFcx jKzhkHaPmBmPFBg0A0wnFtxl4H97JfmoM2k0EuYfJk3EmEWe9oTztEKFVYUPvvY4rLms gwzFuUYGpnXTHNVpyHFERVqyYSiPSwLpevNMDIU89hktEm0w0w8FrNNZBUdw3guLnmF1 QqWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8PRTP+GttRbJXj9uz8wD1O1UnEM1+wUPJ8xznVdIxxk=; b=q0jFlPhT8qieBL3P4hJ7I3+a9MELeVQdhJa9e2USfL6xVKqVy6ThkH45GCp1QTL7HY Duw37oiy+iHlZSjEdBmSsdt5h+rrk9YhVn+6AZjZzrLDOiV3Vd8AOxOH5rLJiAvYUET/ 7AGanDZMEscqfPaxWk0ViOLNazg6JXMwZ2z1EKJkxSpa4cDmjDC8w3sSzoJlNyJevWcI HkR8pZM3JTMwrSOqESKCZtT513nkad+3lb5+xEaC9EFCbuZtchaUQNUdkRqgtQAG5CYl Oda2fBwwHSxRIMGf9nZ7ZWPIEWRSUhtJX9Ft7doUpQfOEjS00Jk3fibp59PEGUayxhyu 4Uhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=BriWF3t3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si3267839eja.174.2020.08.22.09.36.04; Sat, 22 Aug 2020 09:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=BriWF3t3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728600AbgHVQdm (ORCPT + 99 others); Sat, 22 Aug 2020 12:33:42 -0400 Received: from crapouillou.net ([89.234.176.41]:48762 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728514AbgHVQdj (ORCPT ); Sat, 22 Aug 2020 12:33:39 -0400 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 Cc: od@zcrc.me, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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