From patchwork Thu Jul 9 02:37:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Jianwei.Wang@freescale.com" X-Patchwork-Id: 6752471 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 2273E9F38C for ; Thu, 9 Jul 2015 02:37:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 205DB20670 for ; Thu, 9 Jul 2015 02:37:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C402A20668 for ; Thu, 9 Jul 2015 02:37:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03E696E2FD; Wed, 8 Jul 2015 19:37:22 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 4566 seconds by postgrey-1.34 at gabe; Wed, 08 Jul 2015 19:37:20 PDT Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0109.outbound.protection.outlook.com [65.55.169.109]) by gabe.freedesktop.org (Postfix) with ESMTPS id 710766E2FD for ; Wed, 8 Jul 2015 19:37:20 -0700 (PDT) Received: from DM2PR0301MB1232.namprd03.prod.outlook.com (10.160.219.21) by DM2PR0301MB0606.namprd03.prod.outlook.com (10.160.95.22) with Microsoft SMTP Server (TLS) id 15.1.207.19; Thu, 9 Jul 2015 02:37:18 +0000 Received: from DM2PR0301MB1229.namprd03.prod.outlook.com (10.160.219.18) by DM2PR0301MB1232.namprd03.prod.outlook.com (10.160.219.21) with Microsoft SMTP Server (TLS) id 15.1.207.19; Thu, 9 Jul 2015 02:37:16 +0000 Received: from DM2PR0301MB1229.namprd03.prod.outlook.com ([10.160.219.18]) by DM2PR0301MB1229.namprd03.prod.outlook.com ([10.160.219.18]) with mapi id 15.01.0207.004; Thu, 9 Jul 2015 02:37:16 +0000 From: Wang J.W. To: Mark yao Subject: RE: [PATCH v5 1/3] drm/layerscape: Add Freescale DCU DRM driver Thread-Topic: [PATCH v5 1/3] drm/layerscape: Add Freescale DCU DRM driver Thread-Index: AQHQeNlgVz8LjrDFtUKDWD39AmcmRZ3FQ7GQgAENs4CADJtN8A== Date: Thu, 9 Jul 2015 02:37:15 +0000 Message-ID: References: <55934979.4060500@rock-chips.com> In-Reply-To: <55934979.4060500@rock-chips.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: rock-chips.com; dkim=none (message not signed) header.d=none; x-originating-ip: [199.59.226.141] x-microsoft-exchange-diagnostics: 1; DM2PR0301MB1232; 5:2y8FVIi7P9dvixxyG1C2pjviYJDVUxsgLDHHYUwkCtVXdHYDAAPUErSez5V/3bwD9llMzTLDKg494e3Y6AxvWqmWB7nJUUeojqrc8SDmYl5pmF8t+u++yfPGhzSCra5YH1YcquJnxv3rzcYOMsX1fw==; 24:MeAE0RYJAAIS3x6nQb3ZtX+BZeVY8sPUOUARzO8j3o8g76D2TiUY1aiRnTQRS60MUw3cFn1Hi8pNAr1sRikFP3N2TX2Mz74+WSPZEOPsWrs=; 20:AJfR2NWcCickXnV+4ung8Cnhp6z+UJQ2DrXrRuNMHJvrnAyu0FZCOUCePDWQBHaO0qO/xaGDsspM37aUJo1GpA== x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1232; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB0606; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:DM2PR0301MB1232; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1232; x-forefront-prvs: 0632519F33 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(24454002)(377454003)(45984002)(51404002)(106116001)(5002640100001)(5890100001)(66066001)(99286002)(19580405001)(33656002)(62966003)(77156002)(40100003)(46102003)(76576001)(74316001)(2950100001)(5001920100001)(2900100001)(5001960100002)(86362001)(110136002)(76176999)(50986999)(5003600100002)(122556002)(92566002)(77096005)(189998001)(19580395003)(575784001)(87936001)(54356999)(2656002)(102836002)(217873001)(559001)(579004); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1232; H:DM2PR0301MB1229.namprd03.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2015 02:37:15.9836 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB1232 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0606; 2:yEWHcwR7lhhB7mok3m8fKgmkkBqWGZy5b85YRaUUb70/nQH8y90S3nQzrRUCGeMv; 3:IMl3FAeMrxaSl55iqbyLwz+7cR9OOntk3HljmLFtCwlub/8C0tc3fUasqdH6D5lh1fAKPsRd2DNmnfY7WmM9TftWz8DobKlPPHCw7vftt6zAPFsru9YhpUdTXDT0L88UbEDRcpSgwfKX9cEcvLyu0A==; 25:QYErbw+mIR0zRKoZ/W+uyoSpvGpm99kHLnPpxiW/l4hvz0pe3O+OVW0Y4Fi2rP5Cm+Dergo7qwrrilF6pNucLpAbLHm6zt+AvsyDIHOn2hbPg10KPMJejFASng9yJwx8M8lO+4dgjw7Vqct6Zkdo2Du5+NvJfzH+jz7KskVQpSC6qfGZjwTkMn6LJbR7CLoVmoEPy9q6rHV0FIWTPCNizi6f1qYW9c5DAlWvON/+pol1L8XI69dD5TIPxAA3kZywkKpRUrf/mVh1w/TzJd52mQ==; 23:F2LNnFRDKXhnNe3qFRcRtiqD0qQ1Cjn3nqhkbjauEW9Czqju4PSvUJUtYhACXZYFBlYpNU16WYC5DynSXJ779vcVjvKIEeBRZXIrllm2QihOKojqwZMDPlmAC8Xe62xPAVq8I3km6mSRYwZZbh2OHBuKgXSljlKo/eNxXHTkZpaVuiIbRTbUQi1vquuvdt0BsGqMHMe+F5PfyscWTJbNw3i/SB6DL9AYsIjsRAV9twcVjAk7S/ihW1s1/FaB1xwU X-OriginatorOrg: freescale.com Cc: linux-kernel , dri-devel , "stefan@agner.ch" , "daniel.vetter@intel.com" , "linux-arm-kernel@lists.infradead.org" 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Hi Mark, Thank you very much for your review! From: Mark yao [mailto:mark.yao@rock-chips.com] Sent: Wednesday, July 01, 2015 9:59 AM To: Wang Jianwei-B52261 Cc: David Airlie; daniel.vetter@intel.com; stefan@agner.ch; dri-devel; linux-kernel; linux-arm-kernel@lists.infradead.org; Wang Jianwei-B52261 Subject: Re: [PATCH v5 1/3] drm/layerscape: Add Freescale DCU DRM driver On 2015?06?30? 18:01, Wang J.W. wrote: From: Jianwei Wang This patch add support for Two Dimensional Animation and Compositing Engine (2D-ACE) on the Freescale SoCs. 2D-ACE is a Freescale display controller. 2D-ACE describes the functionality of the module extremely well its name is a value that cannot be used as a token in programming languages. Instead the valid token "DCU" is used to tag the register names and function names. The Display Controller Unit (DCU) module is a system master that fetches graphics stored in internal or external memory and displays them on a TFT LCD panel. A wide range of panel sizes is supported and the timing of the interface signals is highly configurable. Graphics are read directly from memory and then blended in real-time, which allows for dynamic content creation with minimal CPU intervention. The features: (1) Full RGB888 output to TFT LCD panel. (2) For the current LCD panel, WQVGA "480x272" is supported. (3) Blending of each pixel using up to 4 source layers dependent on size of panel. (4) Each graphic layer can be placed with one pixel resolution in either axis. (5) Each graphic layer support RGB565 and RGB888 direct colors without alpha channel and BGRA8888 BGRA4444 ARGB1555 direct colors with an alpha channel and YUV422 format. (6) Each graphic layer support alpha blending with 8-bit resolution. This is a simplified version, only one primary plane, one framebuffer created for fbdev, one crtc, one connector for TFT LCD panel, an encoder. Signed-off-by: Alison Wang Signed-off-by: Xiubo Li Signed-off-by: Jianwei Wang --- Changed in V5 - Update commit message - Add layer registers initialization - Remove unused functions - Rename driver folder - Move pixel clock control functions to fsl_dcu_drm_drv.c - remove redundant enable the clock implicitly using regmap - Add maintainer message Changed in V4: -This version doesn't have functionality changed Just a minor adjustment. Changed in V3: - Test driver on Vybrid board and add compatible string - Remove unused functions - set default crtc for encoder - replace legacy functions with atomic help functions - Set the unique name of the DRM device - Implement irq handle function for vblank interrupt Changed in v2: - Add atomic support - Modify bindings file - Rename node for compatibility - Move platform related code out for compatibility .../devicetree/bindings/drm/fsl-dcu/fsl,dcu.txt | 50 +++ MAINTAINERS | 8 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/fsl-dcu/Kconfig | 17 + drivers/gpu/drm/fsl-dcu/Makefile | 7 + drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.c | 194 +++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.h | 30 ++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 172 ++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.h | 22 ++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 373 +++++++++++++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 223 ++++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_fbdev.c | 26 ++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 42 +++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.h | 17 + drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 192 +++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h | 23 ++ 17 files changed, 1399 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/fsl-dcu/fsl,dcu.txt create mode 100644 drivers/gpu/drm/fsl-dcu/Kconfig create mode 100644 drivers/gpu/drm/fsl-dcu/Makefile create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.h create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.h create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_fbdev.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.h create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __FSL_DCU_DRM_PLANE_H__ +#define __FSL_DCU_DRM_PLANE_H__ + +struct fsl_dcu_drm_device; +struct fsl_dcu_drm_plane { + struct drm_plane plane; + unsigned int index; +}; + +struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device +*dev); + +#endif /* __FSL_DCU_DRM_PLANE_H__ */ -- 2.1.0.27.g96db324 -- ?ark diff --git a/Documentation/devicetree/bindings/drm/fsl-dcu/fsl,dcu.txt b/Documentation/devicetree/bindings/drm/fsl-dcu/fsl,dcu.txt new file mode 100644 index 0000000..bdc7d5b --- /dev/null +++ b/Documentation/devicetree/bindings/drm/fsl-dcu/fsl,dcu.txt @@ -0,0 +1,49 @@ +Device Tree bindings for Freescale DCU DRM Driver + +Required properties: +- compatible: Should be one of + * "fsl,ls1021a-dcu". + * "fsl,vf610-dcu". +- reg: Address and length of the register set for dcu. +- clocks: From common clock binding: handle to dcu clock. +- clock-names: From common clock binding: Shall be "dcu". +- display: The phandle to display node. + +Required properties: +- bits-per-pixel: <16> for RGB565, + <24> for RGB888, + <32> for RGB8888. + +Required timing node for dispplay sub-node: +- display-timings: Refer to binding doc display-timing.txt for details. + +Examples: +dcu: dcu@2ce0000 { + compatible = "fsl,ls1021a-dcu"; + reg = <0x0 0x2ce0000 0x0 0x10000>; + clocks = <&platform_clk 0>; + clock-names = "dcu"; + big-endian; + display = <&display>; + + display: display@0 { + bits-per-pixel = <24>; + + display-timings { + native-mode = <&timing0>; + timing0: nl4827hc19 { + clock-frequency = <10870000>; + hactive = <480>; + vactive = <272>; + hback-porch = <2>; + hfront-porch = <2>; + vback-porch = <1>; + vfront-porch = <1>; + hsync-len = <41>; + vsync-len = <2>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; + }; +}; diff --git a/MAINTAINERS b/MAINTAINERS index 885be14..a6cff2f4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3398,6 +3398,14 @@ S: Maintained F: drivers/gpu/drm/imx/ F: Documentation/devicetree/bindings/drm/imx/ +DRM DRIVERS FOR FREESCALE DCU +M: Jianwei Wang +M: Alison Wang +L: dri-devel@lists.freedesktop.org +S: Supported +F: drivers/gpu/drm/fsl-dcu/ +F: Documentation/devicetree/bindings/drm/fsl-dcu/ + DRM DRIVERS FOR NVIDIA TEGRA M: Thierry Reding M: Terje Bergström diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 151a050..e64cf18 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig" source "drivers/gpu/drm/msm/Kconfig" +source "drivers/gpu/drm/fsl-dcu/Kconfig" + source "drivers/gpu/drm/tegra/Kconfig" source "drivers/gpu/drm/panel/Kconfig" diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 2c239b9..398eccf 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_UDL) += udl/ obj-$(CONFIG_DRM_AST) += ast/ obj-$(CONFIG_DRM_ARMADA) += armada/ obj-$(CONFIG_DRM_ATMEL_HLCDC) += atmel-hlcdc/ +obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/ obj-$(CONFIG_DRM_RCAR_DU) += rcar-du/ obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ obj-$(CONFIG_DRM_OMAP) += omapdrm/ diff --git a/drivers/gpu/drm/fsl-dcu/Kconfig b/drivers/gpu/drm/fsl-dcu/Kconfig new file mode 100644 index 0000000..e4f8df0 --- /dev/null +++ b/drivers/gpu/drm/fsl-dcu/Kconfig @@ -0,0 +1,17 @@ +config DRM_FSL_DCU + tristate "DRM Support for Freescale DCU" + depends on DRM && OF && ARM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select VIDEOMODE_HELPERS + select BACKLIGHT_CLASS_DEVICE + select BACKLIGHT_LCD_SUPPORT + select REGMAP_MMIO + select DRM_KMS_FB_HELPER + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + help + Choose this option if you have an Freescale DCU chipset. + If M is selected the module will be called fsl-dcu-drm. diff --git a/drivers/gpu/drm/fsl-dcu/Makefile b/drivers/gpu/drm/fsl-dcu/Makefile new file mode 100644 index 0000000..336b4a6 --- /dev/null +++ b/drivers/gpu/drm/fsl-dcu/Makefile @@ -0,0 +1,7 @@ +fsl-dcu-drm-y := fsl_dcu_drm_drv.o \ + fsl_dcu_drm_kms.o \ + fsl_dcu_drm_connector.o \ + fsl_dcu_drm_plane.o \ + fsl_dcu_drm_crtc.o \ + fsl_dcu_drm_fbdev.o +obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu-drm.o diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.c new file mode 100644 index 0000000..799682d --- /dev/null +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_connector.c @@ -0,0 +1,194 @@ +/* + * Copyright 2015 Freescale Semiconductor, Inc. + * + * Freescale DCU drm device driver + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +#include +#include +#include