From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F2DC433EF for ; Sat, 19 Feb 2022 22:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbiBSWKp (ORCPT ); Sat, 19 Feb 2022 17:10:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbiBSWKo (ORCPT ); Sat, 19 Feb 2022 17:10:44 -0500 Received: from mx2.smtp.larsendata.com (mx2.smtp.larsendata.com [91.221.196.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE2142A19 for ; Sat, 19 Feb 2022 14:10:21 -0800 (PST) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id c5297060-91d0-11ec-b2df-0050568cd888; Sat, 19 Feb 2022 22:10:38 +0000 (UTC) Received: from ravnborg.org (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 0D1E7194B34; Sat, 19 Feb 2022 23:10:18 +0100 (CET) Date: Sat, 19 Feb 2022 23:10:14 +0100 X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: Noralf =?iso-8859-1?Q?Tr=F8nnes?= Cc: robh+dt@kernel.org, thierry.reding@gmail.com, maxime@cerno.tech, dave.stevenson@raspberrypi.com, david@lechnology.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v4 3/3] drm/tiny: Add MIPI DBI compatible SPI driver Message-ID: References: <20220218151110.11316-1-noralf@tronnes.org> <20220218151110.11316-4-noralf@tronnes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220218151110.11316-4-noralf@tronnes.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Noralf, On Fri, Feb 18, 2022 at 04:11:10PM +0100, Noralf Trønnes wrote: > Add a driver that will work with most MIPI DBI compatible SPI panels. > This avoids adding a driver for every new MIPI DBI compatible controller > that is to be used by Linux. The 'compatible' Device Tree property with > a '.bin' suffix will be used to load a firmware file that contains the > controller configuration. A solution where we have the command sequences as part of the DT-overlay is IMO a much better way to solve this: - The users needs to deal only with a single file, so there is less that goes wrong - The user need not reading special instructions how to handle a .bin file, if the overlay is present everything is fine - The file that contains the command sequences can be properly annotated with comments - The people that creates the command sequences has no need for a special script to create the file for a display - this is all readable ascii. - Using a DT-overlay the parsing of the DT-overlay can be done by well-tested functions, no need to invent something new to parse the file The idea with a common mipi DBI SPI driver is super, it is the detail with the .bin file that I am against. With the above said, a few comments to the current implementation below. As we know it from you - a very well-written driver. Sam > Acked-by: Maxime Ripard > Signed-off-by: Noralf Trønnes > --- > MAINTAINERS | 8 + > drivers/gpu/drm/tiny/Kconfig | 13 + > drivers/gpu/drm/tiny/Makefile | 1 + > drivers/gpu/drm/tiny/panel-mipi-dbi.c | 413 ++++++++++++++++++++++++++ > 4 files changed, 435 insertions(+) > create mode 100644 drivers/gpu/drm/tiny/panel-mipi-dbi.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 8e6e892f99f0..3a0e57f23ad0 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -6107,6 +6107,14 @@ T: git git://anongit.freedesktop.org/drm/drm-misc > F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt > F: drivers/gpu/drm/tiny/mi0283qt.c > > +DRM DRIVER FOR MIPI DBI compatible panels > +M: Noralf Trønnes > +S: Maintained > +W: https://github.com/notro/panel-mipi-dbi/wiki Nice with a wiki for this, I can see this will grow over time and be a place to find how to support more panels. > +T: git git://anongit.freedesktop.org/drm/drm-misc > +F: Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml > +F: drivers/gpu/drm/tiny/panel-mipi-dbi.c > + > DRM DRIVER FOR MSM ADRENO GPU > M: Rob Clark > M: Sean Paul > diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig > index 712e0004e96e..d552e1618da7 100644 > --- a/drivers/gpu/drm/tiny/Kconfig > +++ b/drivers/gpu/drm/tiny/Kconfig > @@ -51,6 +51,19 @@ 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 DRM_PANEL_MIPI_DBI > + tristate "DRM support for MIPI DBI compatible panels" > + depends on DRM && SPI > + select DRM_KMS_HELPER > + select DRM_KMS_CMA_HELPER This symbol is not present in my drm-misc-next tree (which is a few weeks old, so it may be newer). > + select DRM_MIPI_DBI > + select BACKLIGHT_CLASS_DEVICE > + help > + Say Y here if you want to enable support for MIPI DBI compatible > + panels. The controller command setup can be provided using a > + firmware file. Consider adding a link to the wiki here - this may make it easier for the user to find it. > + To compile this driver as a module, choose M here. > + > config DRM_SIMPLEDRM > tristate "Simple framebuffer driver" > depends on DRM && MMU > diff --git a/drivers/gpu/drm/tiny/Makefile b/drivers/gpu/drm/tiny/Makefile > index 5d5505d40e7b..1d9d6227e7ab 100644 > --- a/drivers/gpu/drm/tiny/Makefile > +++ b/drivers/gpu/drm/tiny/Makefile > @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o > obj-$(CONFIG_DRM_BOCHS) += bochs.o > obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o > obj-$(CONFIG_DRM_GM12U320) += gm12u320.o > +obj-$(CONFIG_DRM_PANEL_MIPI_DBI) += panel-mipi-dbi.o > obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm.o > obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o > obj-$(CONFIG_TINYDRM_ILI9163) += ili9163.o > diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c > new file mode 100644 > index 000000000000..9240fdec38d6 > --- /dev/null > +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c > @@ -0,0 +1,413 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * DRM driver for MIPI DBI compatible display panels > + * > + * Copyright 2022 Noralf Trønnes > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include