From patchwork Thu Jun 10 13:25:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12313175 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 24B39C47094 for ; Thu, 10 Jun 2021 13:27:10 +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 E27BB613E7 for ; Thu, 10 Jun 2021 13:27:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E27BB613E7 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 3529D6ED11; Thu, 10 Jun 2021 13:27:09 +0000 (UTC) Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99FE66ED11 for ; Thu, 10 Jun 2021 13:27:07 +0000 (UTC) Received: by mail-lf1-x12d.google.com with SMTP id n12so3240538lft.10 for ; Thu, 10 Jun 2021 06:27:07 -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=T4QEP3A/eh2Lcpmaz1OafJAywMZLP55ZdFmXuQCmgJs=; b=j85ZuZ8o/iLl6QOnU4pD9Xd+HUaJI9o/pe1PDQYr1j2iRSwZxtDP3U5SXquaJCRCXc XBIylVZX46UtBAjL1rTOhRyeXffSEka3SlhUkQm0kYbcspu9cSw7zWjB1IYHeWf0v3nh uyJuD7Dl+xULZa58Ond8h082veY7u7xBUK8kz1badBCHTHamU4siPkQUu89ZWcpu4t22 bCbqoX0Jp+SdJnppXGE9uZ7sexXsr/CkZMzhkjSVPW0ylaFACqb+ZyfSB9sYW7niBJWX gNQqYqALm6BwNL0AYNJjBFrFvT01HL4rZH/550xNiYuNcJ9v3ox4CS07ZjndspQpUSAN 2TpA== 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=T4QEP3A/eh2Lcpmaz1OafJAywMZLP55ZdFmXuQCmgJs=; b=CCfrpw0SBEpqUQo4vbWkc1mc6SjyzAEAvfhtTIujVQEBVSQu2Y+SSlmUuSqQFCYYR6 foVJtQlz5lJjELSv4cKamYM75ypuX6VoRS21LWTi6L7d9X9KqXrhjDCp1cSRPgBMvDjG oCVtFkLmAbturyKPabQ9k5ecMytV6fXdZApAH2OpfsdcoXf8U6PsW92XTNqxwTWxEex9 eIhRjy/qGKa5JPCzVOxNhK6A9g9vFeQMbcTORywI5fe+2kgt8o2wGX4Fz3MJw8+FDNcD Ocj+WXlaWUCfNgbsiSo+RYHYcBCFEKH7VXt8QOSLor3yI3b5pQ6mOQy1Yms4t+6wO4Vg SecQ== X-Gm-Message-State: AOAM532O9cYJaiRRx5lNoTuuI2ypD0W5fN5gPWFFOT3CtlKeN6nIUm1/ O4euIsUzpIRd/RNgcdI6Tw8S6Q== X-Google-Smtp-Source: ABdhPJyOHvEXMUxihAsaqH5/F29uceJFajZM1pQV0SYQAA8cyPj5Igl+G/M0q/ZQPwGbi7m3EK7JGg== X-Received: by 2002:a05:6512:3602:: with SMTP id f2mr1974028lfs.14.1623331625913; Thu, 10 Jun 2021 06:27:05 -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 x1sm337957ljm.132.2021.06.10.06.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 06:27:05 -0700 (PDT) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Subject: [PATCH v4] drm/panel: db7430: Add driver for Samsung DB7430 Date: Thu, 10 Jun 2021 15:25:01 +0200 Message-Id: <20210610132501.315086-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: Noralf Trønnes Cc: Paul Cercueil Cc: Doug Anderson Signed-off-by: Linus Walleij Acked-by: Noralf Trønnes --- 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 | 354 +++++++++++++++++++ 4 files changed, 372 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..c11b3da65896 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-db7430.c @@ -0,0 +1,354 @@ +// 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