From patchwork Tue Jul 21 19:36:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 6837851 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 85A9E9F358 for ; Tue, 21 Jul 2015 19:36:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11C68206E4 for ; Tue, 21 Jul 2015 19:36:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0EF90206EC for ; Tue, 21 Jul 2015 19:36:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64BAE6E09D; Tue, 21 Jul 2015 12:36:15 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com [209.85.192.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id F38026E09D for ; Tue, 21 Jul 2015 12:36:13 -0700 (PDT) Received: by qgy5 with SMTP id 5so92908783qgy.3 for ; Tue, 21 Jul 2015 12:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=92nNK58P79uYq8iyCOQuIfTexSXRhISvXVMQ8bdUi8o=; b=GhGguw68Ls/wQGRJtvFsPpYbaiiVmBFwL/NMvJWHeo6EDQ3PA9bYmR/f7erSSNtp97 bnZgzbU+vCvh/1oIU+RCGfhYhrziaU7PS1NkOZf7QThdEUA7l928n/hyw1SXUiUXK9oL 6PxGAyO1AOBTvVOwjaFre4YrnLXH1PUT1nVAboOd9Tm/NymuI83pDN/7EF3whhsuFyxw 9AEEF0y6d9Ajfp1UyUx3tyAeaxmjkm4Y5O20lNbZMTMaKPe3gqBugMIuY4FO4YddHQai PXx/5bvDw/pXwgGS5RI6Yhz0/hF9oJX9tMviXPv+UOCalqXeIM2YW5WhERxEdaQuPCnm PDGg== X-Received: by 10.140.132.148 with SMTP id 142mr52800069qhe.74.1437507372959; Tue, 21 Jul 2015 12:36:12 -0700 (PDT) Received: from localhost (c-50-187-42-4.hsd1.ma.comcast.net. [50.187.42.4]) by smtp.gmail.com with ESMTPSA id 25sm6890008qkp.37.2015.07.21.12.36.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 12:36:12 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/panel: auo novatek 1080p video mode panel Date: Tue, 21 Jul 2015 15:36:02 -0400 Message-Id: <1437507362-20162-1-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.4.3 Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson 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=-5.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 is one of several different panels that are used on the Sony Xperia Z3 phone. It can operate in either command or video mode, although so far only video mode is implemented (since that is the mode that the downstream kernel version I happened to be looking at was using, and that is where I got the programming sequences for the panel). Signed-off-by: Rob Clark --- Couple Notes: 1) programming sequences and basically everything I know about the panel came from downstream android kernel. I've started a wiki page to document how to translate from downstream kernel-msm way of doing things to upstream panel framework, which may be useful for others wanting to port downstream panel drivers for snapdragon devices: https://github.com/freedreno/freedreno/wiki/DSI-Panel-Driver-Porting 2) The Sony phones at least (not sure if this is common) use one of several different panels, with runtime probing. Depending on the device they seem to either use a gpio (simple) or send some DSI commands to read back the panel-id. My rough thinking here about how to handle this is to implement a "panel-meta" driver (or maybe one each for the different probing methods), which would take a list of phandles to the actual candidate panels, and fwd the panel fxn calls to the chosen panel after probing. .../bindings/panel/auo,novatek-1080p.txt | 25 ++ drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-auo-novatek-1080p.c | 470 +++++++++++++++++++++ 4 files changed, 505 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/auo,novatek-1080p.txt create mode 100644 drivers/gpu/drm/panel/panel-auo-novatek-1080p.c diff --git a/Documentation/devicetree/bindings/panel/auo,novatek-1080p.txt b/Documentation/devicetree/bindings/panel/auo,novatek-1080p.txt new file mode 100644 index 0000000..8a53093 --- /dev/null +++ b/Documentation/devicetree/bindings/panel/auo,novatek-1080p.txt @@ -0,0 +1,25 @@ +AU Optronics Corporation 1080x1920 DSI panel + +This panel supports both video and command mode (although currently only video +mode is implemented in the driver. + +Required properties: +- compatible: should be "auo,novatek-1080p-vid" + +Optional properties: +- power-supply: phandle of the regulator that provides the supply voltage +- reset-gpio: phandle of gpio for reset line +- backlight: phandle of the backlight device attached to the panel + +Example: + + dsi@54300000 { + panel: panel@0 { + compatible = "auo,novatek-1080p-vid"; + reg = <0>; + + power-supply = <...>; + reset-gpio = <...>; + backlight = <...>; + }; + }; diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 6d64c7b..89f0e8c 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -43,4 +43,13 @@ 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_AUO_NOVATEK_1080P + tristate "AUO Novatek 1080p video mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for AUO 1080p DSI panel + as found in some Sony XPERIA Z3 devices + endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4b2a043..cbcfedf 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_AUO_NOVATEK_1080P) += panel-auo-novatek-1080p.o diff --git a/drivers/gpu/drm/panel/panel-auo-novatek-1080p.c b/drivers/gpu/drm/panel/panel-auo-novatek-1080p.c new file mode 100644 index 0000000..0db70dd --- /dev/null +++ b/drivers/gpu/drm/panel/panel-auo-novatek-1080p.c @@ -0,0 +1,470 @@ +/* + * Copyright (C) 2015 Red Hat + * Author: Rob Clark + * + * 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. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include