From patchwork Wed Aug 19 11:45:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11725695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35BD114F6 for ; Thu, 20 Aug 2020 07:15:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAD8520786 for ; Thu, 20 Aug 2020 07:15:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="asYZL6wp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAD8520786 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 423796E8C0; Thu, 20 Aug 2020 07:14:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5063B6E225 for ; Wed, 19 Aug 2020 11:46:23 +0000 (UTC) Received: from mail.kernel.org (ip5f5ad5a3.dynamic.kabel-deutschland.de [95.90.213.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 516F32080C; Wed, 19 Aug 2020 11:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597837582; bh=K/TA65WsLXZf8BWFVZatpLXWEsuuyX3vzmz5kGE6CMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asYZL6wpN998uDspvLQLvK3RnhHfASpEITWQd5b6XicSMGT2PmW7LgVXtNIz4SJGG KeOTO1XbeWkXd6fRymZiRSFgsIIxumXzDRrzg9+qdaKxFWZCxuHH2OeJ6EkTwPmsY/ YCoCXQTWZ4MFLTDSylCVQHFZrmi/4ctKb8g/8tUc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1k8MXq-00EuZy-TA; Wed, 19 Aug 2020 13:46:19 +0200 From: Mauro Carvalho Chehab To: Greg Kroah-Hartman Subject: [PATCH 01/49] staging: hikey9xx: Add hisilicon DRM driver for hikey960/970 Date: Wed, 19 Aug 2020 13:45:29 +0200 Message-Id: <2002b1c05fa14a1ff6c19d220c0e5afd1ea18156.1597833138.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Aug 2020 07:14:47 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanchun Zheng , linuxarm@huawei.com, dri-devel , Jesper Dangaard Brouer , devel@driverdev.osuosl.org, Daniel Borkmann , Mauro Carvalho Chehab , John Fastabend , Xiubin Zhang , Jakub Kicinski , linux-media@vger.kernel.org, Liwei Cai , Manivannan Sadhasivam , Chen Feng , Alexei Starovoitov , linaro-mm-sig@lists.linaro.org, mauro.chehab@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, "David S. Miller" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Chen Feng Add initial driver for hikey960 DRM driver, backported from OOT tree. Later patches will be needed to make this driver work. [jstultz: Rework patchset to use upstream adv7511 and remove duplicated code] [mchehab+huawei@kernel.org: port just a subset of the original patch and place it at staging] Signed-off-by: Chen Feng Signed-off-by: Liwei Cai Signed-off-by: John Stultz Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/hikey9xx/gpu/Kconfig | 52 + drivers/staging/hikey9xx/gpu/Makefile | 12 + drivers/staging/hikey9xx/gpu/dw_drm_dsi.c | 1650 +++++++++ drivers/staging/hikey9xx/gpu/dw_dsi_reg.h | 145 + drivers/staging/hikey9xx/gpu/kirin_dpe_reg.h | 3114 +++++++++++++++++ .../hikey9xx/gpu/kirin_drm_dpe_utils.c | 731 ++++ .../hikey9xx/gpu/kirin_drm_dpe_utils.h | 58 + drivers/staging/hikey9xx/gpu/kirin_drm_drv.c | 380 ++ drivers/staging/hikey9xx/gpu/kirin_drm_drv.h | 60 + drivers/staging/hikey9xx/gpu/kirin_drm_dss.c | 701 ++++ .../hikey9xx/gpu/kirin_drm_overlay_utils.c | 1288 +++++++ drivers/staging/hikey9xx/gpu/kirin_fb.c | 94 + drivers/staging/hikey9xx/gpu/kirin_fbdev.c | 470 +++ 13 files changed, 8755 insertions(+) create mode 100644 drivers/staging/hikey9xx/gpu/Kconfig create mode 100644 drivers/staging/hikey9xx/gpu/Makefile create mode 100644 drivers/staging/hikey9xx/gpu/dw_drm_dsi.c create mode 100644 drivers/staging/hikey9xx/gpu/dw_dsi_reg.h create mode 100644 drivers/staging/hikey9xx/gpu/kirin_dpe_reg.h create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_dpe_utils.c create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_dpe_utils.h create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_drv.c create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_drv.h create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_dss.c create mode 100644 drivers/staging/hikey9xx/gpu/kirin_drm_overlay_utils.c create mode 100644 drivers/staging/hikey9xx/gpu/kirin_fb.c create mode 100644 drivers/staging/hikey9xx/gpu/kirin_fbdev.c diff --git a/drivers/staging/hikey9xx/gpu/Kconfig b/drivers/staging/hikey9xx/gpu/Kconfig new file mode 100644 index 000000000000..5533ee624f29 --- /dev/null +++ b/drivers/staging/hikey9xx/gpu/Kconfig @@ -0,0 +1,52 @@ +config DRM_HISI_KIRIN + tristate "DRM Support for Hisilicon Kirin series SoCs Platform" + depends on DRM && OF && ARM64 + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select HISI_KIRIN_DW_DSI + help + Choose this option if you have a hisilicon Kirin chipsets(hi6220). + If M is selected the module will be called kirin-drm. + +config DRM_KIRIN_960 + tristate "DRM Support for Hisilicon Kirin960 series SoCs Platform" + depends on DRM && OF && ARM64 + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select HISI_KIRIN_DW_DSI + help + Choose this option if you have a hisilicon Kirin chipsets(kirin960). + If M is selected the module will be called kirin-drm. + +config HISI_KIRIN_DW_DSI + tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" + depends on DRM_HISI_KIRIN || DRM_KIRIN_960 + select DRM_MIPI_DSI + select DRM_PANEL + help + This selects support for HiSilicon Kirin SoC specific extensions for + the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on + hi6220 based SoC, you should selet this option. + +config DRM_PANEL_HIKEY960_NTE300NTS + tristate "Hikey960 NTE300NTS video mode panel" + depends on OF + depends on DRM_MIPI_DSI + help + Say Y here if you want to enable LCD panel driver for Hikey960 boadr. + Current support panel: NTE300NTS(1920X1200) + +config HISI_FB_970 + tristate "DRM Support for Hisilicon Kirin970 series SoCs Platform" + depends on DRM && OF && ARM64 + depends on DRM_MIPI_DSI + help + Choose this option if you have a hisilicon Kirin chipsets(kirin970). + If M is selected the module will be called kirin-drm. + +config HDMI_ADV7511_AUDIO + tristate "HDMI Support ADV7511 audio" + help + Choose this option to support HDMI ADV7511 audio. diff --git a/drivers/staging/hikey9xx/gpu/Makefile b/drivers/staging/hikey9xx/gpu/Makefile new file mode 100644 index 000000000000..42d1ed179264 --- /dev/null +++ b/drivers/staging/hikey9xx/gpu/Makefile @@ -0,0 +1,12 @@ +EXTRA_CFLAGS += \ + -Iinclude/drm + +kirin-drm-y := kirin_fbdev.o \ + kirin_fb.o \ + kirin_drm_drv.o \ + kirin_drm_dss.o \ + kirin_drm_dpe_utils.o \ + kirin_drm_overlay_utils.o \ + +obj-$(CONFIG_DRM_KIRIN_960) += kirin-drm.o +obj-$(CONFIG_HISI_KIRIN_DW_DSI) += dw_drm_dsi.o diff --git a/drivers/staging/hikey9xx/gpu/dw_drm_dsi.c b/drivers/staging/hikey9xx/gpu/dw_drm_dsi.c new file mode 100644 index 000000000000..1d1d4f49609c --- /dev/null +++ b/drivers/staging/hikey9xx/gpu/dw_drm_dsi.c @@ -0,0 +1,1650 @@ +/* + * DesignWare MIPI DSI Host Controller v1.02 driver + * + * Copyright (c) 2016 Linaro Limited. + * Copyright (c) 2014-2016 Hisilicon Limited. + * + * Author: + * + * + * + * 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