From patchwork Sun Aug 12 18:46:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 10563713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A14C01057 for ; Sun, 12 Aug 2018 18:51:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B6542916D for ; Sun, 12 Aug 2018 18:51:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E5A5291B4; Sun, 12 Aug 2018 18:51:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD6F92916D for ; Sun, 12 Aug 2018 18:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0ST2pzJ9Sc7X+oDtVFOmDBkO1dK6Z/Vq5vhzg3KWO48=; b=NAEVVNoFzQnEI9F3qLnQKS/Csm sXITxPI8BfR4I/NHAIXWmTv7ZEhkwFEPMlJBJfjgrLlxhJ9g95uvzo7yJJyhufVmzjt6gal9EOM/5 POaCeTw2geCLAf2bWg6Xb+h/zrLv27HfqKjFPMElk55lMVtDCJN0eNRfCI/ZokGjH4u8eK6dFK4Xo Add6tR5wm6/m8UyY5UoiO9y824Obx6bgxeaGue0fsmebiXsw88u2n7KqgPaT2EBBBKglx6J4JK+le o2k4gsp0/W2Az+ZKU/ULHvycBm3/09Gxq5I7zhijSOnm02Bq0Dmp29O0PyGih+5nRWwoc11Q3N7mO gBznha4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fovSL-0001sh-JS; Sun, 12 Aug 2018 18:51:13 +0000 Received: from mail-ed1-f67.google.com ([209.85.208.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fovRH-00089m-QF for linux-arm-kernel@lists.infradead.org; Sun, 12 Aug 2018 18:50:23 +0000 Received: by mail-ed1-f67.google.com with SMTP id e19-v6so7167148edq.7 for ; Sun, 12 Aug 2018 11:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=B4gnshzq36eoM3BArIKPQbGHhYbNwIeR9BEMTz8Ph74=; b=cTztyJUxdwgzJahMC8mPKCEW9Xre+qkH3Upt4ETOifaSoAfSUFAJZlI9LWbEPimAGj N7fAA/17W3JvbXs+9xzMHjHAw5+cmdNwuio8Vl3maQgFmFM04B9jHBAAQ5l0aKJoutqo XcneczdOLjkOa7XoPBaD7I7M78tf58kIHM/PC9D3QRBHVJ/Ov4uUb0B3M0VShCW/h5uH 03grSKnXbAXmBiXdOJbEx1XPpLLLCeZIaFQMASstdViV6Rb8pWXZaCdU7bUGuqLXg6le 1f3/1hu53M2GNTCeHf2GsZjbGO4D8Crl61LGt6u4D6UneRRS//moO/6ayncaVmSpv9Nc BXGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=B4gnshzq36eoM3BArIKPQbGHhYbNwIeR9BEMTz8Ph74=; b=tLj6qFZz88x8fbZd8fQyyafdPcbt+FWLzMKtsjrSyNS8Onyc7rqEqI+D55UNJi/HN+ aXDCrxGo/dyYrR9xOpE7NU9wMTSjhWHn4i1+rkZmc+szcCZosCEkWz68eovK5Vs8ByGK +Bl6MEv0yjRujKMK5Q7cUQA4F4RngNYDS9sULQ2ntvMI1KPVX+IPW8ZvHkQrAGnDsEBt wTL1hs8LflIeK4uBruoAwhQgUfccLRhZUVQDrDEsgpQ9I/nxfLrGkPej55oV5RcI5/8H KgvqzuhPyP34V6Hv355/blJXHTLtppbNnG0JTUuixKvFuvixGtq/P1gzE7sRaLIq6IUA w3+Q== X-Gm-Message-State: AOUpUlEx1dNuXhqvf7cnCI7IPkBEUnDNeQlxEe/z+ItloZJa8CF6MSIm tCAEZT0/aQQZPJzD+mLBmUIZU40pXSU= X-Google-Smtp-Source: AA+uWPyF+JA81PEFFYtERLuOZ75os+sCsgXB5F5pXxmA6O3EvtwXpkzPvYIjc2LRumrYME/vadvSaw== X-Received: by 2002:a50:9662:: with SMTP id y89-v6mr19527914eda.32.1534099615744; Sun, 12 Aug 2018 11:46:55 -0700 (PDT) Received: from jupiter.lan (126.158-248-196.customer.lyse.net. [158.248.196.126]) by smtp.gmail.com with ESMTPSA id g14-v6sm5897941edm.25.2018.08.12.11.46.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Aug 2018 11:46:55 -0700 (PDT) From: Sam Ravnborg To: Boris Brezillon , Rob Herring , Mark Rutland , Lee Jones , Nicolas Ferre , Alexandre Belloni Subject: [PATCH v1 7/7] drm: add Atmel LCDC display controller support Date: Sun, 12 Aug 2018 20:46:29 +0200 Message-Id: <20180812184629.3808-7-sam@ravnborg.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180812184152.GA22343@ravnborg.org> References: <20180812184152.GA22343@ravnborg.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180812_115008_252868_08B0FFF2 X-CRM114-Status: GOOD ( 24.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, Boris Brezillon , Nicolas Ferre , dri-devel@lists.freedesktop.org, Sam Ravnborg , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is a DRM based driver for the Atmel LCDC IP. There exist today a framebuffer based driver and this is a re-implmentation of the same on top of DRM. The rewrite was based on the original fbdev driver but the driver has also seen inspiration from the atmel-hlcdc_dc driver and others. The driver is not a full replacement: - STN displays are not supported Binding support is missing but most of the STN specific functionality is otherwise ported from the fbdev driver. - gamma support is missing The driver utilises drm_simple_kms_helper and this helper lacks support for settting up gamma - modesetting is not checked (see TODO in file) - support for extra modes as applicable (and lcd-wiring-mode) - support for AVR32 (is it relevant?) Signed-off-by: Sam Ravnborg Cc: Nicolas Ferre Cc: Boris Brezillon Cc: Alexandre Belloni --- MAINTAINERS | 7 + drivers/gpu/drm/atmel/Kconfig | 12 + drivers/gpu/drm/atmel/Makefile | 2 + drivers/gpu/drm/atmel/atmel_lcdc-dc.c | 1094 +++++++++++++++++++++++++++++++++ 4 files changed, 1115 insertions(+) create mode 100644 drivers/gpu/drm/atmel/atmel_lcdc-dc.c diff --git a/MAINTAINERS b/MAINTAINERS index 09ce76a9a1dc..0a594d02a7c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4685,6 +4685,13 @@ F: drivers/gpu/drm/atmel/atmel-hlcdc* F: Documentation/devicetree/bindings/display/atmel/ T: git git://anongit.freedesktop.org/drm/drm-misc +DRM DRIVERS FOR ATMEL LCDC +M: Sam Ravnborg +L: dri-devel@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/atmel/atmel-lcdc* +F: Documentation/devicetree/bindings/display/atmel/ + DRM DRIVERS FOR BRIDGE CHIPS M: Archit Taneja M: Andrzej Hajda diff --git a/drivers/gpu/drm/atmel/Kconfig b/drivers/gpu/drm/atmel/Kconfig index 7cd3862f9d18..c4c6150f271a 100644 --- a/drivers/gpu/drm/atmel/Kconfig +++ b/drivers/gpu/drm/atmel/Kconfig @@ -14,3 +14,15 @@ config DRM_ATMEL_HLCDC help Choose this option if you have an ATMEL SoC with an HLCDC display controller (i.e. at91sam9n12, at91sam9x5 family or sama5d3 family). + +config DRM_ATMEL_LCDC + tristate "DRM Support for ATMEL LCDC Display Controller" + depends on DRM && OF && COMMON_CLK && MFD_ATMEL_LCDC && ARM + select DRM_ATMEL + select DRM_GEM_CMA_HELPER + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_PANEL + help + Choose this option if you have an ATMEL SoC with an LCDC display + controller (only at91sam9263 or at91sam9rl). diff --git a/drivers/gpu/drm/atmel/Makefile b/drivers/gpu/drm/atmel/Makefile index 49dc89f36b73..9fdfada613d2 100644 --- a/drivers/gpu/drm/atmel/Makefile +++ b/drivers/gpu/drm/atmel/Makefile @@ -5,3 +5,5 @@ atmel-hlcdc-dc-y := atmel_hlcdc_crtc.o \ atmel_hlcdc_plane.o obj-$(CONFIG_DRM_ATMEL_HLCDC) += atmel-hlcdc-dc.o + +obj-$(CONFIG_DRM_ATMEL_LCDC) += atmel_lcdc-dc.o diff --git a/drivers/gpu/drm/atmel/atmel_lcdc-dc.c b/drivers/gpu/drm/atmel/atmel_lcdc-dc.c new file mode 100644 index 000000000000..275a09e2e100 --- /dev/null +++ b/drivers/gpu/drm/atmel/atmel_lcdc-dc.c @@ -0,0 +1,1094 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Sam Ravnborg + * + * The driver is based on atmel_lcdfb which is: + * Copyright (C) 2007 Atmel Corporation + * + * Atmel LCD Controller Display Controller. + * A sub-device of the Atmel LCDC IP. + * + * The Atmel LCD Controller supports in the following configuration: + * - TFT only, with BGR565, 8 bits/pixel + * - Resolution up to 2048x2048 + * - Single plane, crtc, one fixed output + * + * Features not (yet) ported from atmel_lcdfb: + * - Support for extra modes (and configurable intensify bit) + * - Check modesetting support - lcdc_dc_display_check() + * - set color / palette handling + * - support for STN displays (partly implemented) + * - AVR32 support (relevant?) + */ + +#include +#include +#include +#include +#include +#include +#include + +#include