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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 49192C433E1 for ; Mon, 27 Jul 2020 20:32:06 +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 23CA620759 for ; Mon, 27 Jul 2020 20:32:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CA620759 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org 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 7765889FA0; Mon, 27 Jul 2020 20:32:05 +0000 (UTC) Received: from asavdk4.altibox.net (asavdk4.altibox.net [109.247.116.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87CF089FA0 for ; Mon, 27 Jul 2020 20:32:03 +0000 (UTC) Received: from ravnborg.org (unknown [188.228.123.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id E258B8048A; Mon, 27 Jul 2020 22:31:59 +0200 (CEST) Date: Mon, 27 Jul 2020 22:31:58 +0200 From: Sam Ravnborg To: Paul Cercueil Subject: Re: [PATCH 3/6] drm/bridge: Add SPI DBI host driver Message-ID: <20200727203158.GA1016751@ravnborg.org> References: <20200727164613.19744-1-paul@crapouillou.net> <20200727164613.19744-4-paul@crapouillou.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200727164613.19744-4-paul@crapouillou.net> X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=aP3eV41m c=1 sm=1 tr=0 a=S6zTFyMACwkrwXSdXUNehg==:117 a=S6zTFyMACwkrwXSdXUNehg==:17 a=8nJEP1OIZ-IA:10 a=ER_8r6IbAAAA:8 a=7X9hF7tqX14c7ykuo-AA:9 a=wPNLvfGTeEIA:10 a=9LHmKk7ezEChjTCyhBa9:22 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: devicetree@vger.kernel.org, Jernej Skrabec , od@zcrc.me, Thomas Zimmermann , Neil Armstrong , David Airlie , dri-devel@lists.freedesktop.org, Jonas Karlman , linux-kernel@vger.kernel.org, Andrzej Hajda , Rob Herring , Thierry Reding , Laurent Pinchart Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Paul. On Mon, Jul 27, 2020 at 06:46:10PM +0200, Paul Cercueil wrote: > This driver will register a DBI host driver for panels connected over > SPI. So this is actually a MIPI DBI host driver. I personally would love to have added mipi_ in the names - to make it all more explicit. But maybe that just because I get confused on all the acronyms. Some details in the following. Will try to find some more time so I can grasp the full picture. The following was just my low-level notes for now. Sam > = > 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. We did not have any define to distingush between DBI_C1 and DBI_c3: +/* MIPI bus types */ +#define MIPI_DEVICE_TYPE_DSI BIT(0) +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE1 BIT(1) +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE2 BIT(2) +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE3 BIT(3) +#define MIPI_DEVICE_TYPE_DBI_M6800 BIT(4) +#define MIPI_DEVICE_TYPE_DBI_I8080 BIT(5) Is this on purpose? I had assumed the host should tell what it supports and the device should tell what it wanted. So if the host did not support DBI_C3 and device wants it - then we could give up early. > = > Signed-off-by: Paul Cercueil > --- > drivers/gpu/drm/bridge/Kconfig | 8 + > drivers/gpu/drm/bridge/Makefile | 1 + > drivers/gpu/drm/bridge/dbi-spi.c | 261 +++++++++++++++++++++++++++++++ This is no bridge driver - so does not belong in the bridge directory. gpu/drm/drm_mipi_dbi_spi.c? > 3 files changed, 270 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/dbi-spi.c > = > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kcon= fig > index c7f0dacfb57a..ed38366847c1 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -219,6 +219,14 @@ config DRM_TI_TPD12S015 > Texas Instruments TPD12S015 HDMI level shifter and ESD protection > driver. > = > +config DRM_MIPI_DBI_SPI > + tristate "SPI host support for MIPI DBI" > + depends on OF && SPI > + select DRM_MIPI_DSI > + select DRM_MIPI_DBI > + help > + Driver to support DBI over SPI. > + > source "drivers/gpu/drm/bridge/analogix/Kconfig" > = > source "drivers/gpu/drm/bridge/adv7511/Kconfig" > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Mak= efile > index 7d7c123a95e4..c2c522c2774f 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -20,6 +20,7 @@ obj-$(CONFIG_DRM_I2C_ADV7511) +=3D adv7511/ > obj-$(CONFIG_DRM_TI_SN65DSI86) +=3D ti-sn65dsi86.o > obj-$(CONFIG_DRM_TI_TFP410) +=3D ti-tfp410.o > obj-$(CONFIG_DRM_TI_TPD12S015) +=3D ti-tpd12s015.o > +obj-$(CONFIG_DRM_MIPI_DBI_SPI) +=3D dbi-spi.o mipi_dbi_spi.o would be nice... > obj-$(CONFIG_DRM_NWL_MIPI_DSI) +=3D nwl-dsi.o > = > obj-y +=3D analogix/ > diff --git a/drivers/gpu/drm/bridge/dbi-spi.c b/drivers/gpu/drm/bridge/db= i-spi.c > new file mode 100644 > index 000000000000..1060b8f95fba > --- /dev/null > +++ b/drivers/gpu/drm/bridge/dbi-spi.c > @@ -0,0 +1,261 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * MIPI Display Bus Interface (DBI) SPI support > + * > + * Copyright 2016 Noralf Tr=F8nnes > + * Copyright 2020 Paul Cercueil > + */ > + > +#include > +#include > +#include > + > +#include > +#include > + > +#include