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: 256079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D680C433E1 for ; Wed, 19 Aug 2020 11:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 397962078D for ; Wed, 19 Aug 2020 11:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597838355; bh=K/TA65WsLXZf8BWFVZatpLXWEsuuyX3vzmz5kGE6CMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZsDGzsTTdKOab2x4LSo/D6YgOk1AQnIY9BUxyI8vHzDVxhyMUtg0na1zNyXf+Z2ix odYryKZUh1PNEoXvc3dCOGdDMhyV3Afjxx317qgyVoEYPol5KJcSOSYGlSxWou6QhM rf2GKC8DcWypMrAX8/YPYzuh7GG1kb8udG9rXAOI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbgHSLtB (ORCPT ); Wed, 19 Aug 2020 07:49:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:47472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728135AbgHSLrC (ORCPT ); Wed, 19 Aug 2020 07:47:02 -0400 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 Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Chen Feng , Mauro Carvalho Chehab , John Stultz , Manivannan Sadhasivam , Daniel Vetter , dri-devel , Philipp Zabel , Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Sumit Semwal , Liwei Cai , Xiubin Zhang , Wanchun Zheng , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org 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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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