From patchwork Tue Jan 29 17:23:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 14342 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1426523E2E for ; Tue, 29 Jan 2013 17:23:23 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id 76292A18833 for ; Tue, 29 Jan 2013 17:23:22 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id fa15so428490vbb.11 for ; Tue, 29 Jan 2013 09:23:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:dkim-signature:x-received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-gm-message-state; bh=LCN+ze1mEmHDntx8Q7EyvMHI2nJ2ylrjmk4tqHQ8Zko=; b=BR7DaEb82xG0duKJLHdkXPieXluFlR0eN6Xd/3yu98qNIR6n/Rtx6Cmf/M87AgVQ6Y VOC9w0pYohZHvK+/V5wa9q6h8tdWMa7dVXJM5Y/PCHI9EfAY/h2GOY9hm/fGcNm+suy+ d8ahbEZjMeMOc1XStwIFryj01H2brxPYAG8QpVXteMwHg7q+lcGpUmnSbV9ul9/2qBKo 3t77qBV7+buQgBm1iiPRT8Z4qybzW6/iWRuUEU28yR3qM9vekSPBSykpGcw3x+1KjtyP j4o/5tVPmKGED5cMsDPIdc9pVggMGXOIileg300yQ/cZCwjfHE1fvGQSvwfsC2ICZpMT QVDA== X-Received: by 10.220.209.74 with SMTP id gf10mr1892956vcb.10.1359480201936; Tue, 29 Jan 2013 09:23:21 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp147599veb; Tue, 29 Jan 2013 09:23:21 -0800 (PST) X-Received: by 10.60.10.227 with SMTP id l3mr1288116oeb.119.1359480201297; Tue, 29 Jan 2013 09:23:21 -0800 (PST) Received: from mail-oa0-f43.google.com (mail-oa0-f43.google.com [209.85.219.43]) by mx.google.com with ESMTPS id h4si14138706obn.206.2013.01.29.09.23.21 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Jan 2013 09:23:21 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.219.43 as permitted sender) client-ip=209.85.219.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.219.43 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-oa0-f43.google.com with SMTP id l10so695026oag.16 for ; Tue, 29 Jan 2013 09:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=LCN+ze1mEmHDntx8Q7EyvMHI2nJ2ylrjmk4tqHQ8Zko=; b=OnBnJmiVgBPDLbXxdiLN28LpYCaJcsLfOAyflf6TSjdDxjgD5m5JnC00Nrqmhk2b2a 5orDpUn14B/xiGUO8SEHhCbz0E1XClIlFsOosePTMntENBZcpLZOogLc+zL7wyCMeqtC jpCfqdycLRTK2C6wxXk0JO32BIj2Adfs8wY7z7w+3lyq1y/iGIlL5MKoM8TWODPHsztz QSGVxagYvEZl3G5wMRFPGk1dkskH0QwusOA2hQHWf/G/2tF/O8YvpcpU7qAbeua/DX+a GslpnRLFkuLjS7JcyPOjSm12GL0upGhN+zFI0n29B74ZprrAdDkdBw4cdBFRuC5eGPOQ WZIQ== X-Received: by 10.182.118.103 with SMTP id kl7mr1386303obb.13.1359480201071; Tue, 29 Jan 2013 09:23:21 -0800 (PST) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id ow7sm9123166obc.20.2013.01.29.09.23.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Jan 2013 09:23:20 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Clark Subject: [PATCH 4/4] drm/tilcdc: add support for LCD panels (v5) Date: Tue, 29 Jan 2013 11:23:04 -0600 Message-Id: <1359480184-9168-5-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359480184-9168-1-git-send-email-robdclark@gmail.com> References: <1359480184-9168-1-git-send-email-robdclark@gmail.com> X-Gm-Message-State: ALoCoQkDzDjHAbv46gRS7va1Ln6S41H+EOLjmbjJlVxOe5SmHt0lg4NtQsJ3wToTtfAci8SCJ/Dt Add an output panel driver for LCD panels. Tested with LCD3 cape on beaglebone. v1: original v2: s/of_find_node_by_name()/of_get_child_by_name()/ from Pantelis Antoniou v3: add backlight support v4: rebase to latest of video timing helpers v5: remove some unneeded fields from panel-info struct, add DT bindings docs Signed-off-by: Rob Clark Tested-by: Koen Kooi --- .../devicetree/bindings/drm/tilcdc/panel.txt | 59 +++ drivers/gpu/drm/tilcdc/Kconfig | 3 + drivers/gpu/drm/tilcdc/Makefile | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 + drivers/gpu/drm/tilcdc/tilcdc_panel.c | 436 +++++++++++++++++++++ drivers/gpu/drm/tilcdc/tilcdc_panel.h | 26 ++ 6 files changed, 528 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/tilcdc/panel.txt create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_panel.c create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_panel.h diff --git a/Documentation/devicetree/bindings/drm/tilcdc/panel.txt b/Documentation/devicetree/bindings/drm/tilcdc/panel.txt new file mode 100644 index 0000000..5ff1e61 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/tilcdc/panel.txt @@ -0,0 +1,59 @@ +Device-Tree bindings for tilcdc DRM generic panel output driver + +Required properties: + - compatible: value should be "tilcdc,panel". + - panel-info: configuration info to configure LCDC correctly for the panel + - ac-bias: AC Bias Pin Frequency + - ac-bias-intrpt: AC Bias Pin Transitions per Interrupt + - dma-burst-sz: DMA burst size + - bpp: Bits per pixel + - fdd: FIFO DMA Request Delay + - sync-edge: Horizontal and Vertical Sync Edge: 0=rising 1=falling + - sync-ctrl: Horizontal and Vertical Sync: Control: 0=ignore + - raster-order: Raster Data Order Select: 1=Most-to-least 0=Least-to-most + - fifo-th: DMA FIFO threshold + - display-timings: typical videomode of lcd panel. Multiple video modes + can be listed if the panel supports multiple timings, but the 'native-mode' + should be the preferred/default resolution. Refer to + Documentation/devicetree/bindings/video/display-timing.txt for display + timing binding details. + +Recommended properties: + - pinctrl-names, pinctrl-0: the pincontrol settings to configure + muxing properly for pins that connect to TFP410 device + +Example: + + /* Settings for CDTech_S035Q01 / LCD3 cape: */ + lcd3 { + compatible = "tilcdc,panel"; + pinctrl-names = "default"; + pinctrl-0 = <&bone_lcd3_cape_lcd_pins>; + panel-info { + ac-bias = <255>; + ac-bias-intrpt = <0>; + dma-burst-sz = <16>; + bpp = <16>; + fdd = <0x80>; + sync-edge = <0>; + sync-ctrl = <1>; + raster-order = <0>; + fifo-th = <0>; + }; + display-timings { + native-mode = <&timing0>; + timing0: 320x240 { + hactive = <320>; + vactive = <240>; + hback-porch = <21>; + hfront-porch = <58>; + hsync-len = <47>; + vback-porch = <11>; + vfront-porch = <23>; + vsync-len = <2>; + clock-frequency = <8000000>; + hsync-active = <0>; + vsync-active = <0>; + }; + }; + }; diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig index ee9b592..ae14fd6 100644 --- a/drivers/gpu/drm/tilcdc/Kconfig +++ b/drivers/gpu/drm/tilcdc/Kconfig @@ -4,6 +4,9 @@ config DRM_TILCDC select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER + select OF_VIDEOMODE + select OF_DISPLAY_TIMING + select BACKLIGHT_CLASS_DEVICE help Choose this option if you have an TI SoC with LCDC display controller, for example AM33xx in beagle-bone, DA8xx, or diff --git a/drivers/gpu/drm/tilcdc/Makefile b/drivers/gpu/drm/tilcdc/Makefile index aa9097e..deda656 100644 --- a/drivers/gpu/drm/tilcdc/Makefile +++ b/drivers/gpu/drm/tilcdc/Makefile @@ -4,6 +4,7 @@ tilcdc-y := \ tilcdc_crtc.o \ tilcdc_tfp410.o \ tilcdc_slave.o \ + tilcdc_panel.o \ tilcdc_drv.o obj-$(CONFIG_DRM_TILCDC) += tilcdc.o diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 25f3add..c5b592d 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -21,6 +21,7 @@ #include "tilcdc_regs.h" #include "tilcdc_tfp410.h" #include "tilcdc_slave.h" +#include "tilcdc_panel.h" #include "drm_fb_helper.h" @@ -589,6 +590,7 @@ static int __init tilcdc_drm_init(void) DBG("init"); tilcdc_tfp410_init(); tilcdc_slave_init(); + tilcdc_panel_init(); return platform_driver_register(&tilcdc_platform_driver); } @@ -597,6 +599,7 @@ static void __exit tilcdc_drm_fini(void) DBG("fini"); tilcdc_tfp410_fini(); tilcdc_slave_fini(); + tilcdc_panel_fini(); platform_driver_unregister(&tilcdc_platform_driver); } diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c new file mode 100644 index 0000000..d1463f5 --- /dev/null +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -0,0 +1,436 @@ +/* + * Copyright (C) 2012 Texas Instruments + * 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