From patchwork Wed Jul 7 23:43:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 470855 Delivered-To: patch@linaro.org Received: by 2002:a17:907:d92:0:0:0:0 with SMTP id go18csp78548ejc; Wed, 7 Jul 2021 16:55:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxheero/boi7jgVBh78ZAS9Vf/V+9hpy/XCYMbLtOEUMXrf8VZUbGDfuUJziVkNN7CxhUmj X-Received: by 2002:a63:1c1f:: with SMTP id c31mr28374266pgc.380.1625702122479; Wed, 07 Jul 2021 16:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625702122; cv=none; d=google.com; s=arc-20160816; b=ZrKaWCrnsjoNV1snJQ1G7+h0XO0DJ5zz4SXjQXN6XUDrc1soa9izqxLO0TAZ5Om1X8 LhkM6O64rpJlabbo9bff+YvnJHdPZ094P120xNnlhGYFHC06lbYd3jwnqrJVWSaRuWyg +PFt0mcqQAlNqS6IbaoximZQeYLRWbsDVBV1jCx1aGjjyze5vGkllk1N+5fp9BvVd5/F KpUvClprlR/xUA0hG4qim/Mab+/NNj5zuYE0QQSh3CCSQMzcFWhruLWZKFY0m5foEpug Cy7VgGRvZw2Fu+wSB/eMunym7Dn9lEm0Pz9RXIqMRMpQqJJQ1njlFip45a8JBLRosLHI Z+SA== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=1m0NWTOkOS8kZ+4K4vsZ20hHhu0fqbkXYqD2i8Lxu2c=; b=WML1mCiouZWUMsAguTEdwh6UB6yYVgiWBsc4AiU+MROdK2CsAjELGZEJYf4yDFZ6Dm x96lc57XFbOZXQSvqVrfFoV/SEEsbmm8Rq9KMe2b5riEPVIBMpaOmgF1pN1ipX492uS2 KXiEm7MCARH/QzxY23QDknMFsxdfPi938BriNLxYYyW9Rrjni/k05EnR1lR4TFqICKFR osNy9/aiFRP2ODXTb3nA/zQzepZbZWlp0+RQT8g9hWflGJ3sHAhIJDplbOpgIkwYIWbk Fy9QnpO5sXLk4V9T2VOAY8xrK6v3S/vc6yPPVjARUaHUbuwTfdHyxBuXamvvaZaDKzAB kfpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wPD67vN7; 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 k14si10587090pji.47.2021.07.07.16.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 16:55:22 -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=wPD67vN7; 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 76C286E1E0; Wed, 7 Jul 2021 23:55:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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 C4F2D6E1E0 for ; Wed, 7 Jul 2021 23:55:18 +0000 (UTC) Received: by mail-lf1-x12d.google.com with SMTP id u18so9105971lff.9 for ; Wed, 07 Jul 2021 16:55:18 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=1m0NWTOkOS8kZ+4K4vsZ20hHhu0fqbkXYqD2i8Lxu2c=; b=wPD67vN7XgN9o9rXmeNBTwxVpzBE+g98IFhP9VR7IQDhEYdQo+pDRv3Nn3p/jjnjMP WR67gywZk72MGD1A9nroWm9v2FiiTpepeArU5gQ1KsdPgDynEXp9WJRnGnxur8m4P9fa +zJY9FlzfFeRpn47oEcFlZ35nox19/rhmy7ZHzDYsWWl0QYZcP5hgKuXIUwrY6MEdpJQ ntQxyCrVv4RrK8ndGK8E0ge2FwqRK8nYtFHUOhpQ2MzBNZbA+oEWA8WIx/zwUqa3WFoL w9dTC4wXJsKUrQmlltQN8KHqpoqAembHDQGRDf4728Bp7VsBUlAs9Kh4WbjdIgDuHM7K U5+g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=1m0NWTOkOS8kZ+4K4vsZ20hHhu0fqbkXYqD2i8Lxu2c=; b=pH1eMME2T5qSR7WKBqHN3dpwVtvYdXDzDYzhBvYAaiFV94vj75+z2kKD/l/eKTMKQS txn0fMzVh/tALCOM41oGM8om3aGjy76G44yWaKDO60nt2Y1rH/pT0Qp4Bp9AEtPaX4qD NsNm2jBevV8bKFpHoMlZogGOypFTTq069Wg8PtIWa7iIwyHogP/cUq+LEnFYZ8/ZPwOy uCNtCr75znzQsR5nbF0Fp+yOzQhm+3NgOJXyqe2DpE9fw4Ae4drZUgOlAmD60wDLz6sY CSuSj+T4IbRl2D4btQ8OKlYb7nn9pAdpy01/4Ix6v43Z7ou3zCXQGmZWQJjasS7rc9xk oP2Q== X-Gm-Message-State: AOAM530WshLuYTdbBhBHRfdGl8Z88jiUjc5k1Ve7V0yXUgScAQJcdzu+ G07biT5pz04zf3EVGMMfiJBOCg== X-Received: by 2002:ac2:508f:: with SMTP id f15mr14585155lfm.278.1625702117196; Wed, 07 Jul 2021 16:55:17 -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 c9sm51062ljb.22.2021.07.07.16.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 16:55:16 -0700 (PDT) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Subject: [PATCH 2/2 v3] drm/panel: ws2401: Add driver for WideChips WS2401 Date: Thu, 8 Jul 2021 01:43:15 +0200 Message-Id: <20210707234315.242663-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210707234315.242663-1-linus.walleij@linaro.org> References: <20210707234315.242663-1-linus.walleij@linaro.org> 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: phone-devel@vger.kernel.org, Douglas Anderson , =?utf-8?q?Noralf_Tr=C3=B8nnes?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds a driver for panels based on the WideChips WS2401 display controller. This display controller is used in the Samsung LMS380KF01 display found in the Samsung GT-I8160 (Codina) mobile phone and possibly others. As is common with Samsung displays manufacturer commands are necessary to configure the display to a working state. The display optionally supports internal backlight control, but can also use an external backlight. This driver re-uses the DBI infrastructure to communicate with the display. Cc: phone-devel@vger.kernel.org Cc: Douglas Anderson Cc: Noralf Trønnes Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Drop the ws2401_command() macro - we enhanced the mipi_dbi_command() to print errors for everyone instead. - Read out MTP properly (used wrong variables) - Register internal backlight if and only if the panel->backlight field is NULL after trying to look up external backlight. ChangeLog v1->v2: - Disable the backlight in ->unprepare() before entering sleep mode. - If we are not using internal backlight, close the L2 access after initializing. - Depromote some talkative dev_info()s to dev_dbg(). - Power up and read the MTP values before we register the display. This works fine and is probably how MTP is supposed to work. - Fix the set-up of gamma values, this was found in the GT-I8160 HD kernel tree. - Bail out properly if drm_panel_of_backlight() returns -EDEFER_PROBE. - Drop OF from dependencies since drm_panel_of_backlight() has static inline stubs in the header file. - Sort MAINTAINERS properly. - Alphabetize includes - Use format specifier %#02x so we get 0x... output in debug - Drop unnecessary braces around if () in debug macro - Drop unused include. --- MAINTAINERS | 7 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-widechips-ws2401.c | 436 ++++++++++++++++++ 4 files changed, 453 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-widechips-ws2401.c -- 2.31.1 Reviewed-by: Noralf Trønnes Reviewed-by: Douglas Anderson diff --git a/MAINTAINERS b/MAINTAINERS index bd7aff0c120f..10bba4be1678 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5956,6 +5956,13 @@ T: git git://people.freedesktop.org/~sroland/linux F: drivers/gpu/drm/vmwgfx/ F: include/uapi/drm/vmwgfx_drm.h +DRM DRIVER FOR WIDECHIPS WS2401 PANELS +M: Linus Walleij +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml +F: drivers/gpu/drm/panel/panel-widechips-ws2401.c + DRM DRIVERS M: David Airlie M: Daniel Vetter diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 4894913936e9..319fa44c4bc9 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -552,6 +552,15 @@ config DRM_PANEL_VISIONOX_RM69299 Say Y here if you want to enable support for Visionox RM69299 DSI Video Mode panel. +config DRM_PANEL_WIDECHIPS_WS2401 + tristate "Widechips WS2401 DPI panel driver" + depends on SPI && GPIOLIB + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help + Say Y here if you want to enable support for the Widechips WS2401 DPI + 480x800 display controller used in panels such as Samsung LMS380KF01. + config DRM_PANEL_XINPENG_XPP055C272 tristate "Xinpeng XPP055C272 panel driver" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index cae4d976c069..d94c27df17aa 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -58,4 +58,5 @@ obj-$(CONFIG_DRM_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o obj-$(CONFIG_DRM_PANEL_VISIONOX_RM69299) += panel-visionox-rm69299.o +obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o diff --git a/drivers/gpu/drm/panel/panel-widechips-ws2401.c b/drivers/gpu/drm/panel/panel-widechips-ws2401.c new file mode 100644 index 000000000000..95825063f812 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-widechips-ws2401.c @@ -0,0 +1,436 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Panel driver for the WideChips WS2401 480x800 DPI RGB panel, used in + * the Samsung Mobile Display (SMD) LMS380KF01. + * Found in the Samsung Galaxy Ace 2 GT-I8160 mobile phone. + * Linus Walleij + * Inspired by code and know-how in the vendor driver by Gareth Phillips. + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include