From patchwork Fri May 29 09:46:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyungwon Hwang X-Patchwork-Id: 6506261 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1CE59F1CC for ; Fri, 29 May 2015 09:47:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00B9B205EA for ; Fri, 29 May 2015 09:47:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E3AA9205DF for ; Fri, 29 May 2015 09:47:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBDF26ED4C; Fri, 29 May 2015 02:47:05 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id D3F516E529 for ; Fri, 29 May 2015 02:47:03 -0700 (PDT) Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NP30044YV67F010@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 29 May 2015 18:46:55 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.112]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 0E.64.29324.E8538655; Fri, 29 May 2015 18:46:55 +0900 (KST) X-AuditID: cbfee68d-f79106d00000728c-d0-5568358ebf2e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 55.AB.05312.E8538655; Fri, 29 May 2015 18:46:54 +0900 (KST) Received: from localhost.localdomain ([10.252.82.145]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NP300ACLV64BQ30@mmp1.samsung.com>; Fri, 29 May 2015 18:46:54 +0900 (KST) From: Hyungwon Hwang To: dri-devel@lists.freedesktop.org, thierry.reding@gmail.com, a.hajda@samsung.com, inki.dae@samsung.com Subject: [v4] drm/panel: add s6e3ha2 AMOLED panel driver Date: Fri, 29 May 2015 18:46:51 +0900 Message-id: <1432892811-10746-1-git-send-email-human.hwang@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOLMWRmVeSWpSXmKPExsWyRsSkQLffNCPUoOMSm8WtdedYLa6ft7O4 8vU9m8XSGX2sFpPuT2Cx+LlrHosDm8fOWXfZPe53H2fy6NuyijGAOYrLJiU1J7MstUjfLoEr 4+uLpawFK5YwVVw/8o+5gXHCa8YuRk4OCQETidO7O9khbDGJC/fWs3UxcnEICSxllFj/9A0T TNGnjXeZIRKLGCUuvn3OCuH8YJSYtmIDK0gVm4CexIJrP8BGiQhkSSy+3QhmMwvYS9zdOR1s krCAhcTEbQ/BVrMIqEqc7u9mAbF5BdwlZm4+DnWSnMTJY5PBFkgIvGaT+PvjClSDgMS3yYeA GjiAErISmw4wQ9RLShxccYNlAqPgAkaGVYyiqQXJBcVJ6UWGesWJucWleel6yfm5mxiB4Xn6 37PeHYy3D1gfYhTgYFTi4e24kR4qxJpYVlyZe4jRFGjDRGYp0eR8YBTklcQbGpsZWZiamBob mVuaKYnzKkr9DBYSSE8sSc1OTS1ILYovKs1JLT7EyMTBKdXA6GSlvD8pZPrx+4J9nckaj/e9 8L4eKcj9QWoFU8YuESORSeEhU/jL501cPKm6zySy899vzm93DuaYbek27XDavKtof+RrfrGI Hz7mOdWPp5x6w2CyV5Dh2jdWgegOoTPfdRYtWu4fG/N/4qojaqeXlX0I/TvJv5rX5sWcCylN Tw4l/58afvXLeiWW4oxEQy3mouJEAOx8sbdKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42I5/e+xgG6faUaowdtZVha31p1jtbh+3s7i ytf3bBZLZ/SxWky6P4HF4ueueSwObB47Z91l97jffZzJo2/LKsYA5qgGRpuM1MSU1CKF1Lzk /JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoMVKCmWJOaVAoYDE4mIlfTtM E0JD3HQtYBojdH1DguB6jAzQQMIaxoyvL5ayFqxYwlRx/cg/5gbGCa8Zuxg5OSQETCQ+bbzL DGGLSVy4t56ti5GLQ0hgEaPExbfPWSGcH4wS01ZsYAWpYhPQk1hw7Qc7iC0ikCWx+HYjmM0s YC9xd+d0JhBbWMBCYuK2h2AbWARUJU73d7OA2LwC7hIzNx+H2iwncfLYZNYJjNwLGBlWMYqm FiQXFCel5xrpFSfmFpfmpesl5+duYgQH/zPpHYyrGiwOMQpwMCrx8FrcTQ8VYk0sK67MPcQo wcGsJMK7SycjVIg3JbGyKrUoP76oNCe1+BCjKdD2icxSosn5wMjMK4k3NDYxM7I0Mje0MDI2 VxLnPZnvEyokkJ5YkpqdmlqQWgTTx8TBKdXAuCHjzOR7f0o2FD+UzXKccHnmu7VLasI3NOuW fzXfsqpcaLFlxZTSKY3y97mCt65t9j7+fdHnvItfGtsYfhfv+5i38V7z9I5jvdy3ovnvy9y0 kWpibmrnVv9Q8OKnU+r564a3JG9sn3p2mcMXTs8CAwmPdbdCGG+6p97nFdtRYnSkYftzETn9 XiWW4oxEQy3mouJEABFYV4iUAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: Donghwa Lee , human.hwang@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds MIPI-DSI based S6E3HA2 panel driver. This panel has 1440x2560 resolution in 5.7-inch physical panel. Signed-off-by: Donghwa Lee Signed-off-by: Hyungwon Hwang Cc: Inki Dae --- As Thierry Reding said in https://patchwork.kernel.org/patch/5714111/, it can be confusing to check the result of a function call using a variable which is not explicitly passed to function call. At the same time, as Andrzej Hajda said, checking the result using the return value in this driver makes the code too bloated. In the situation where many simple function calls and the result checking for them are needed, I thought that passing variable by reference with explicit variable is the best. Changes for v2: - Fix errata in documentation and source code comments Changes for v3: - Remove the term LCD to clarify the sort of this panel - Rename lcd-en-gpios to panel-en-gpios to clarify the sort of this panel - Fix errata in documentation and source code comments Changes for v4: - Add support for brightness control - Adjust the sequence of turning on/off - Rename variable and properties for clarity .../devicetree/bindings/panel/samsung,s6e3ha2.txt | 40 + drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-s6e3ha2.c | 904 +++++++++++++++++++++ 4 files changed, 956 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt create mode 100644 drivers/gpu/drm/panel/panel-s6e3ha2.c -- 1.9.1 diff --git a/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt b/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt new file mode 100644 index 0000000..b8cacc0 --- /dev/null +++ b/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt @@ -0,0 +1,40 @@ +Samsung S6E3HA2 5.7" 1440x2560 AMOLED panel + +Required properties: + - compatible: "samsung,s6e3ha2" + - reg: virtual channel number assigned to the panel + - vdd3-supply: core voltage supply + - vci-supply: voltage supply for analog circuits + - reset-gpio: GPIO spec for resetting + - enable-gpio: GPIO spec for enabling + - te-gpio: GPIO spec for receiving tearing effect synchronization signal + - display-timings: resolution, clock, timing information for the panel [1] + +[1]: Documentation/devicetree/bindings/video/display-timing.txt + +Example: + +panel@0 { + compatible = "samsung,s6e3ha2"; + reg = <0>; + vdd3-supply = <&ldo27_reg>; + vci-supply = <&ldo28_reg>; + reset-gpio = <&gpg0 0 GPIO_ACTIVE_LOW>; + enable-gpio = <&gpf1 5 GPIO_ACTIVE_HIGH>; + te-gpio = <&gpf1 3 GPIO_ACTIVE_LOW>; + + display-timings { + timing-0 { + clock-frequency = <0>; + hactive = <1440>; + vactive = <2560>; + hfront-porch = <1>; + hback-porch = <1>; + hsync-len = <1>; + vfront-porch = <1>; + vback-porch = <15>; + vsync-len = <1>; + }; + }; +}; + diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 6d64c7b..7833073 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -43,4 +43,15 @@ config DRM_PANEL_SHARP_LQ101R1SX01 To compile this driver as a module, choose M here: the module will be called panel-sharp-lq101r1sx01. +config DRM_PANEL_S6E3HA2 + tristate "S6E3HA2 DSI command mode panel" + depends on OF + depends on BACKLIGHT_CLASS_DEVICE + depends on DRM_MIPI_DSI + select VIDEOMODE_HELPERS + Say Y here if you want to enable support for Samsung S6E3HA2 + AMOLED panel module. This panel has a 1440x2560 resolution and + uses 32-bit RGB per pixel. It provides a 4 lane MIPI DSI interface + to the host. + endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4b2a043..16ff312 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o +obj-$(CONFIG_DRM_PANEL_S6E3HA2) += panel-s6e3ha2.o diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c b/drivers/gpu/drm/panel/panel-s6e3ha2.c new file mode 100644 index 0000000..8cf5b7e --- /dev/null +++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c @@ -0,0 +1,904 @@ +/* + * MIPI-DSI based s6e3ha2 AMOLED 5.7 inch panel driver. + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd + * + * Donghwa Lee + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include + +#include +#include + +#include +#include + +#include