Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp15914ybg; Mon, 27 Jul 2020 14:11:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKb0aShA4McQnA06jbGqtpD2lY8TlCERcJZ7GgIchV18QjMBUlQv8PJT5IkSga1+NtmBb1 X-Received: by 2002:a05:6402:13d9:: with SMTP id a25mr23626007edx.325.1595884294935; Mon, 27 Jul 2020 14:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595884294; cv=none; d=google.com; s=arc-20160816; b=nhcz0Fb1JVbKdGGRk8DiXcR/idyDrgPtzm1eyhm1WyVUoglPcwyn08cvhmwoC+g+Oo TFz/YH3nsKEs+HDaTLBoc7jJXuxM4eaEFYFw+TN+TB5uHU/B8TJyA4P1xtq+sZnwOKgg ASUFMthEubWA2dW5I9ogj33mLurY81bs7IdjlhenUQGeTLVzBVTOHxsGzgMb9MbBtIhM BeQt2w5BlAjVtPtpI7NqVlSEc/KoBNPlSzLZU4KdQMwbgzu8FLjTBI67NNQPmfYZvrBB RfYRBOvAn30iQTRdN9wwrXgbLdO8TrthNg2gCjl8STgbrErE1j7ippCe3Gx1U6bS6lAD VWsA== 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:cc:to:subject:from:date :dkim-signature; bh=ibbcLRFYEgPnpCrphWR8XefoNyDdgUA3SsRIyBPw0sk=; b=HJqLI1Y/VG30s7UqmpISn59ccNxbHbsMUaj03/11/gqqw1IQUIff3JdOqQFIfboFk9 QxE9hgs2U7CMR2Nil3FoGtdW1F7wgn6AS/3XD8qSh1zb1A54r5w0r+q3eCtd24hSGe1U WwgS4Q60GeyNwKKdGqAJ6/pBWPaUTYdcyvp6Tp6k5VVtlGqy59FOuYi0wGwQrOeAQ1/w GVi73uGgwXKlZL4mvy3AYLZT/2PjCKJcDwk+5nH27UvpIes1ycPWJJMYThpZBVH/eI1q a1vCfcYv06ltpKCL/HKdLc7/DLIavUx2IoLJ0UQYHfk5rcH/XMQtsXKzSWeJIlfH2LOX hKmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b="vG80/saN"; 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 j13si5845529ejc.314.2020.07.27.14.11.12; Mon, 27 Jul 2020 14:11:34 -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="vG80/saN"; 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 S1726799AbgG0VKu (ORCPT + 99 others); Mon, 27 Jul 2020 17:10:50 -0400 Received: from crapouillou.net ([89.234.176.41]:34038 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgG0VKu (ORCPT ); Mon, 27 Jul 2020 17:10:50 -0400 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 Cc: Thierry Reding , David Airlie , Daniel Vetter , Rob Herring , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf =?iso-8859-1?q?Tr=F8nnes?= , od@zcrc.me, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org 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 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sam, Le lun. 27 juil. 2020 =E0 22:31, Sam Ravnborg a=20 =E9crit : > Hi Paul. >=20 > On Mon, Jul 27, 2020 at 06:46:10PM +0200, Paul Cercueil wrote: >> This driver will register a DBI host driver for panels connected=20 >> over >> SPI. > So this is actually a MIPI DBI host driver. >=20 > 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=20 > can > grasp the full picture. The following was just my low-level notes for > now. >=20 > Sam >>=20 >> DBI types c1 and c3 are supported. C1 is a SPI protocol with 9 bits=20 >> per >> word, with the data/command information in the 9th (MSB) bit. C3 is=20 >> a >> SPI protocol with 8 bits per word, with the data/command information >> carried by a separate GPIO. >=20 > 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) >=20 > Is this on purpose? I understand the confusion. Here SPI_MODE1/3 actually mean SPI_C1/3. I=20 will rename them. > I had assumed the host should tell what it supports and the device=20 > 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 :) >>=20 >> 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=20 >> +++++++++++++++++++++++++++++++ > This is no bridge driver - so does not belong in the bridge > directory. > gpu/drm/drm_mipi_dbi_spi.c? >=20 >> 3 files changed, 270 insertions(+) >> create mode 100644 drivers/gpu/drm/bridge/dbi-spi.c >>=20 >> diff --git a/drivers/gpu/drm/bridge/Kconfig=20 >> 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=20 >> protection >> driver. >>=20 >> +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" >>=20 >> source "drivers/gpu/drm/bridge/adv7511/Kconfig" >> diff --git a/drivers/gpu/drm/bridge/Makefile=20 >> 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... >=20 >> obj-$(CONFIG_DRM_NWL_MIPI_DSI) +=3D nwl-dsi.o >>=20 >> obj-y +=3D analogix/ >> diff --git a/drivers/gpu/drm/bridge/dbi-spi.c=20 >> 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