From patchwork Wed Jun 30 18:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 468710 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp606457jao; Wed, 30 Jun 2021 11:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaul5A0K+1WD86VZG4Yr5aCgeEajST8Qw24B2uBJz5XGrfF12lH5ep5TaKtCFpzvXVUkav X-Received: by 2002:a65:6487:: with SMTP id e7mr35178902pgv.27.1625077945443; Wed, 30 Jun 2021 11:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625077945; cv=none; d=google.com; s=arc-20160816; b=U0L5kxGALg9hrS3yaKM7SQVCXrUi050POnpEbY6zxK1zNb+d04LWIpHFyGbAo9WF/B 7jxs5hhmeKunhJfrj9LsPTGRX66W/wTSUGLoHCzHNuoGYDYXuq6qayL15aqx8Q2wEccK PVrJRE7jwVMwptOHaUeuvzeoOJvg6xol7bsuBXch116E4wxIOq1eOmowRMSQMWprsf7H BGNu68ouM7IbkdiNNVSpuF65+vK44ZeTqY/BDbXM4lUaSs3J3ebLM6tL5FIwhYEbEm/S lYnznV79PiID6rwRkzY2Vr1+RAzBqsaiNlspJptSff7UvL4UjbUi6iVYF2f+JiFcfMw2 zUcw== 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=rUcB36bS2X448Ybx2jIGCCNZxE2W6HuARUij/r12L0o=; b=JtL958tVx2dhFoNaknuLXf+9bizFw6yS8qvPwXkg7MDkCa8cuBnvlR3SK016NExzKk U9id/dTtTDnI57d4csaPEPLue9xOt+1arbOmNzU5UiCBQcIUfH+e+Mm2Ab7MCUtPbBvD me58uQs7gj30umdxA2OjtUqTTJ7l/zoqpi3obW9jasi/J5z46Lh7XCpSKzGuBgxDCQCi V6NtoknQYylW1qeL812VlsKszW0Mxb+nVXIQAyCo8Aa4jCSpoE9FduydrgfPrHHUkv3T fDX30xhCoBK3yIHq5jueMrysNWKom7rwo64vPcQmTgH+zZYWmewrQUpbKkfBhU/GaK+I sRaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g+9NfMgK; 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 i18si30228420pgg.505.2021.06.30.11.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 11:32:25 -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=g+9NfMgK; 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 3ED106EA6C; Wed, 30 Jun 2021 18:32:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 76E216EA6C for ; Wed, 30 Jun 2021 18:32:23 +0000 (UTC) Received: by mail-lj1-x22d.google.com with SMTP id h6so4610704ljl.8 for ; Wed, 30 Jun 2021 11:32:23 -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=rUcB36bS2X448Ybx2jIGCCNZxE2W6HuARUij/r12L0o=; b=g+9NfMgKWUUNUxu8wdLf0aIra/wWdqRQWlwbd+xpz/fuj5gVe+f2dqozJPHinPtBh4 Ny3mdAERb3ZruK3+PXuaYNyFPvovEpR31sTAjnArhBblQ1/k8L3KsAj1iBxEGyGEvCNU EaTLl7lMuLp1Xj8eFhPOk999mdZII0WeSY7Si28t/sI8bKCFQ0/huXIQ4MSKiZljdkMj BQArqGeLzHhw4IodrXqbRl4lWye4lj17zV5cYXtGdRAAuWDyafE2+kP5wIIdmz2UuTfh xpDEmcaF7wImYCATsra34W1kimxZ9cIUkMAKwK66uCZkH0tlTgG4/aniS8eBhb7d+q8L LNUg== 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=rUcB36bS2X448Ybx2jIGCCNZxE2W6HuARUij/r12L0o=; b=oHPnsVnP4tUey6v9iq2XeXkCF0FQM621xtCtEJsmrYVOOq1nVaUJJIrG9PRzC70eMT ZG9uaXri1IyoSlr+8vEnfTBYBumlTraly+XUo5AljIBhjXWreKS/MwMzOZPAiXy6RPg+ avz04RM9eXVhZWHugbU5rdWwp3gPiNha8QwIW37ry07qYENQ+tHN+vF1VG9N3uoTqN0C orXVgDqFINHfzhMSRGs7JEgrR8eiWu6cIzLdPg5IFvHcSsTXi9G9IfFk+7YoFWECPH6L LkO/tiOUJTBb4qwiuEK5P6FDrDFbA82QwIYpmNn2qo8Jhv1+v4O+1qdOMNg4Jufp7wGo ej3w== X-Gm-Message-State: AOAM533XPOe2RndxhCZLUjCHpVtlZKONfEP04orpr7eJ9Fy9WvEd5YKV MaRoqgJsWCYK98Qw41OuVENORQ== X-Received: by 2002:a2e:8613:: with SMTP id a19mr8906074lji.410.1625077941784; Wed, 30 Jun 2021 11:32:21 -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 o142sm1986251lfa.299.2021.06.30.11.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 11:32:21 -0700 (PDT) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Subject: [PATCH 2/2 v2] drm/panel: ws2401: Add driver for WideChips WS2401 Date: Wed, 30 Jun 2021 20:28:04 +0200 Message-Id: <20210630182804.3628410-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210630182804.3628410-1-linus.walleij@linaro.org> References: <20210630182804.3628410-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 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 | 440 ++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-widechips-ws2401.c -- 2.31.1 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..e5731c08fc94 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-widechips-ws2401.c @@ -0,0 +1,440 @@ +// 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