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: 12314183 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=-21.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 82FA7C48BDF for ; Thu, 10 Jun 2021 22:07:35 +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 4BA45613BD for ; Thu, 10 Jun 2021 22:07:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BA45613BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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 503766EE02; Thu, 10 Jun 2021 22:07:34 +0000 (UTC) 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-Google-Smtp-Source: ABdhPJyf0sofq+IiNW6vuOnZTOPVdpVjfA5SiwS29VponYVkA1x5Oz1Thvki2UYae9NPxXapCIKRGg== 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 Reviewed-by: Douglas Anderson --- 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 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