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=-9.8 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 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 B63EBC433F4 for ; Mon, 27 Jul 2020 23:33:16 +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 8A93020809 for ; Mon, 27 Jul 2020 23:33:16 +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="vG80/saN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A93020809 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 EFDEF6E0F0; Mon, 27 Jul 2020 23:32:45 +0000 (UTC) Received: from crapouillou.net (crapouillou.net [89.234.176.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A1D789ECB for ; Mon, 27 Jul 2020 21:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1595884246; 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=ibbcLRFYEgPnpCrphWR8XefoNyDdgUA3SsRIyBPw0sk=; b=vG80/saNxe7RbQ4n9kOrudyT3as6nUBJKZqkLrVI1Cg6EJihUgPVNcQMfo4rDTZ+y2wLkB V9iid1aHwaVBMeVpis/PXLy0/e768UIgbPZkj6XiEUKxfGtaKwUT12VwqR+0K7rTaG+g92 R0YfOeOU/4nSYQCgFpqQUMY22Loz/QQ= Date: Mon, 27 Jul 2020 23:10:30 +0200 From: Paul Cercueil Subject: Re: [PATCH 3/6] drm/bridge: Add SPI DBI host driver To: Sam Ravnborg Message-Id: In-Reply-To: <20200727203158.GA1016751@ravnborg.org> References: <20200727164613.19744-1-paul@crapouillou.net> <20200727164613.19744-4-paul@crapouillou.net> <20200727203158.GA1016751@ravnborg.org> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 27 Jul 2020 23:32:42 +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: 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Sam, Le lun. 27 juil. 2020 =E0 22:31, Sam Ravnborg a = =E9crit : > 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. I can rename the driver and move it out of drm/bridge/, no problem. > 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 understand the confusion. Here SPI_MODE1/3 actually mean SPI_C1/3. I = will rename them. > 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. Well that's exactly what's done here - just with badly named macros :) >> = >> 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/Kconfig >> 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/Makefile >> 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/dbi-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