From patchwork Thu Jun 10 22:05:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 457878 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp26205jae; Thu, 10 Jun 2021 15:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw3UoUNQ/Vtwt5hhupvvlNKv/kMfFZUgnPXrKLNq1ArHAyCStVO51h4vK09p7gcK9CqR7X X-Received: by 2002:aa7:83ca:0:b029:2e5:3a96:982a with SMTP id j10-20020aa783ca0000b02902e53a96982amr5018180pfn.12.1623362858437; Thu, 10 Jun 2021 15:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623362858; cv=none; d=google.com; s=arc-20160816; b=FBm3J0H4qXkVLnLUNANpkyLSccbHxtomTHqLAMGNqxV1nPziUtad4sAuPRRENAxlOS YiutBiT+XwCxyBsp/CtJ2xio2piCGcxdxlv1uIwhNXJSTEgdaxYzQ+VuvmkoA8Ud8BM0 i37tPDZbX5FlQtgPZEcudH4cECbDPbhluk9WSP8+pOqBVTy/7Hikm0DSFBOJVQpIHNbc r23zCBx3Wx9+ecb3AWQGrJsxH/CdqVaLR4Me8PjAYnX9qNlDbxNv1nLmOghGdOsKbX7Z m1tgWZzi05eBu8qrelvSXrqfzL5qMsoOLEQAAZQQqgJn5fJHVNaiKJE1KlOWr45bYeFw rcUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :delivered-to; bh=Yd+cabvH8B0wf3hUn1MO1I4Tke7jRwDD5Kxkax5Uv9s=; b=xqQJ+J165KnA7cugT2l8q2Wnd9eskOoKgmvUuVMuZEqiWh4Va6sJnQF6nL/RrWOqeu i3V1Dop2maPZQtu8byK+t6rYEhUQQmSKTWSyEokYkCVmPVMUMMTf5lFSFs6+J/TMSOK5 KDpFQEH+J7OPB5g7xmtsD2rbZGOuZgls1Qo4QJWhMhDHx2XwpABvivFTvsYPd4OnPLuN XgMxe6wuQPeslNjjvmoozxBl2RQV3V4Tk/CxaeXxvkD28cb+A1CgHRUQ662HPt6eH76y QAiz5pKYwpGD4DIUS6EEnHMJJmWxGuBPDJq3B53W7lmil5RgIIFs5hoPLTEGjSDTMDZP DLiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bYJCUox0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id c8si4733658pgg.437.2021.06.10.15.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 15:07:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bYJCUox0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 503766EE02; Thu, 10 Jun 2021 22:07:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id E521F6EE02 for ; Thu, 10 Jun 2021 22:07:32 +0000 (UTC) Received: by mail-lj1-x235.google.com with SMTP id r16so6959612ljk.9 for ; Thu, 10 Jun 2021 15:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yd+cabvH8B0wf3hUn1MO1I4Tke7jRwDD5Kxkax5Uv9s=; b=bYJCUox0A/r0LscNCAgcHEx1EwjzrpnLLaE1wmWhDVRmysrEy39aPpmTXf2Rnxg/up Caj7tle4zXe3bAvGFJ93zu62FTkvRTd3+cd9lUWgkfuvPcUku6r05E9s9JJdJGWyJz6V nRrdsiUfugLCL1LTvPKWdsJ0QU0bsw8yMVBLuka08SNn+LOZj71IA3yO0NUOHl1JiIbH NnE96ll/8Rv2Yyh4k5+woU3JIJZRp35fqTViQSSq9nRpF3LIEGXNBjioTRaC6cjqARq6 Anv4f51jcjD4Vi177n/jc5HcPUoDJWws7qiRZbD8MyAXNU7pmygnYq98i++c98nyLDtF 6pjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yd+cabvH8B0wf3hUn1MO1I4Tke7jRwDD5Kxkax5Uv9s=; b=ChhzEsOrBtqD+a7tFV/8A6pDlTv3s7BtnIu5IplUUGMCNe49lwU/hFD3wt9uBn/iUT tZD5I9A5f3jtMIItRBVne44ImQLdl0VZEDekPkaCmRJbJqYf/8DahWKIKj+JrUI1zgD1 b74pNaLqPYWdOs3g5uvgyOlyYp2CKhQaX2Ov2tB3ywgp6KRDjnA1CV4gOHd/1YRZ75NG SvSKkn5Mqw7Eszaj2S1i5EaD//8REBjSm/Xr3b8xpGzCQ0Ha8rx1rm8+c61T7l3mAuhW BCzf8/IxaVYkULLpMDQbOHgScNQo+Co9AzP4jTjJYR9uR62/FejiNO2DeKXwPRIFjcMW 5Jnw== X-Gm-Message-State: AOAM532Bprh95xlLfbZZwxJYSrBDi8coL8OZfjiHrjPXtS+WlsNMtHR4 xNoaOP9LoAR78pMIAyz21q1AkQ== X-Received: by 2002:a2e:7d12:: with SMTP id y18mr532617ljc.188.1623362851248; Thu, 10 Jun 2021 15:07:31 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id b13sm475549ljf.14.2021.06.10.15.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 15:07:30 -0700 (PDT) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Subject: [PATCH v5] drm/panel: db7430: Add driver for Samsung DB7430 Date: Fri, 11 Jun 2021 00:05:27 +0200 Message-Id: <20210610220527.366432-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 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: Paul Cercueil , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Doug Anderson Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds a new driver for the Samsung DB7430 DPI display controller as controlled over SPI. Right now the only panel product we know that is using this display controller is the LMS397KF04 but there may be more. This is the first regular panel driver making use of the MIPI DBI helper library. The DBI "device" portions can not be used because that code assumes the use of a single regulator and specific timings around the reset pulse that do not match the DB7430 datasheet. Cc: Paul Cercueil Cc: Doug Anderson Acked-by: Noralf Trønnes Signed-off-by: Linus Walleij --- ChangeLog v4->v5: - Drop the SPI hardcoding to 9 BPW, so the DBI emulation will be utilized if needed. - Drop the MODE_3 setting: we can set this up in the DTS instead. - Collect Noralf's ACK. ChangeLog v3->v4: - Managed to make use of the in-kernel DBI support to conjure and send 9bit DBI SPI messages. - This cuts out a bit of overhead. - Deeper integration with the DBI library is not done, as assumes too much about the device, such as being used as a stand-alone framebuffer (this device is not). ChangeLog v2->v3: - Fix some minor comments and formatting. - Print an error if the DCS sequence write fails. - Set BPC (bits per color) to 8 on the display_info. Some drivers may need this. ChangeLog v1->v2: - Rename driver and variables with the db7430_* prefix instead of lms397kf04 as there may be more display products out there using this display controller. Also change Kconfig symbol. - Push doc comments together on one line where possible. - Rename DB7430_MANUFACTURER_CMD to DB7430_ACCESS_PROT_OFF - Return error from regulator_bulk_disable() down to db7430_unprepare() and propagate. - Use usleep_range(1000, 5000) instead of msleep(1) - Shorten prepare/unprepare callbacks by more compact code. - Use devm_err_probe() and provide proper probe errors all the way through the probe() function. --- MAINTAINERS | 7 + drivers/gpu/drm/panel/Kconfig | 10 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-samsung-db7430.c | 347 +++++++++++++++++++ 4 files changed, 365 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-db7430.c -- 2.31.1 Reviewed-by: Douglas Anderson diff --git a/MAINTAINERS b/MAINTAINERS index bd7aff0c120f..6ff4777b1018 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5857,6 +5857,13 @@ S: Maintained F: Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml F: drivers/gpu/drm/panel/panel-raydium-rm67191.c +DRM DRIVER FOR SAMSUNG DB7430 PANELS +M: Linus Walleij +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml +F: drivers/gpu/drm/panel/panel-samsung-db7430.c + DRM DRIVER FOR SITRONIX ST7703 PANELS M: Guido Günther R: Purism Kernel Team diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 4894913936e9..6d1b90f4f2bb 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -342,6 +342,16 @@ config DRM_PANEL_RONBO_RB070D30 Say Y here if you want to enable support for Ronbo Electronics RB070D30 1024x600 DSI panel. +config DRM_PANEL_SAMSUNG_DB7430 + tristate "Samsung DB7430-based DPI panels" + depends on OF && SPI && GPIOLIB + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help + Say Y here if you want to enable support for the Samsung + DB7430 DPI display controller used in such devices as the + LMS397KF04 480x800 DPI panel. + config DRM_PANEL_SAMSUNG_S6D16D0 tristate "Samsung S6D16D0 DSI video mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index cae4d976c069..a350e0990d17 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o diff --git a/drivers/gpu/drm/panel/panel-samsung-db7430.c b/drivers/gpu/drm/panel/panel-samsung-db7430.c new file mode 100644 index 000000000000..fe58263bd9cd --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-db7430.c @@ -0,0 +1,347 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Panel driver for the Samsung LMS397KF04 480x800 DPI RGB panel. + * According to the data sheet the display controller is called DB7430. + * Found in the Samsung Galaxy Beam GT-I8350 mobile phone. + * Linus Walleij + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include