Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1948240imu; Sat, 5 Jan 2019 10:34:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ONcW5sN3GVF9c8h7bmiyVD6VpnqtQzBAFnjVZVHKIKzwAE7nEoclSOANtRzJAzR+Ryv5c X-Received: by 2002:a63:ec13:: with SMTP id j19mr5535348pgh.6.1546713278009; Sat, 05 Jan 2019 10:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546713277; cv=none; d=google.com; s=arc-20160816; b=H9bIb0dwCh+oT7+QCtdL2sQ2HgEtGaREx/gcWv3ngkDNA4H+qObZRMASt93MKd4Y8W JZ5U6nHWQ6Y+zCHk7hCq6Bs0K6PjpyUtrLv/vVy5yY90znoiPpePpSt8k4IL8d204vHp O17ktXVmppBKQmzoGsnzQGMwydgIBJtQ5WYzsuwiUuKWRLbpHQguLztgdBM1NKanFwTW 8Ljo2FaPru+fWecXy/DTBR/fAQKpPcVMKdq8mIyjr0mNqWnP2Rovsvg5rOZzetdFdOBB oQhA2OxRo9VlrkRLjy4Ft6LpDvIIOCdyOIVxHfKPZruVzVOCJfg7/L2cp7oW8/fQ0ONV x9DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=v4+mG7semh14F95JKmFeTDei7jRR43czaI4LmPbhVDQ=; b=G5eyoqTPf4kop2l+6SIxfK4M7vtKOfVdoC3fHewU+GFkoQzknlDAGAfBd+9oqAXq/3 IkSUzhbaPMaumHQi8YLJt9FIUxH2qV/0EHEKbznDHviZxp3bjcHBUh6ODGNNxXJbRkAG l0nL9kHhe+79oCvRYlQt57X1WNasX10+Bt8EROI2RYQrdM0GLRbX8eHhCSuxeYqPj7p2 6H1bfs540B2/2qnZqBBKixXJa1oepMY8TPapcmS+6b9q0qtn6uZs9S+htOC9j4cy2g9r AUddt91iko6GXipZNy8s8ds4yl/srmrd8PIBV0CbOu1iNDXscx+8eckv0XIi0UADoUjc iU8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si465021pgh.395.2019.01.05.10.34.22; Sat, 05 Jan 2019 10:34:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbfAEScS (ORCPT + 99 others); Sat, 5 Jan 2019 13:32:18 -0500 Received: from kozue.soulik.info ([108.61.200.231]:40236 "EHLO kozue.soulik.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbfAEScR (ORCPT ); Sat, 5 Jan 2019 13:32:17 -0500 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:a00]) by kozue.soulik.info (Postfix) with ESMTPA id F3F72101714; Sun, 6 Jan 2019 03:32:39 +0900 (JST) From: Randy Li To: linux-rockchip@lists.infradead.org Cc: Randy Li , nicolas.dufresne@collabora.com, myy@miouyouyou.fr, paul.kocialkowski@bootlin.com, mchehab@kernel.org, linux-media@vger.kernel.org, hverkuil@xs4all.nl, heiko@sntech.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] staging: video: rockchip: video codec for vendor API Date: Sun, 6 Jan 2019 02:31:47 +0800 Message-Id: <20190105183150.20266-2-ayaka@soulik.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190105183150.20266-1-ayaka@soulik.info> References: <20190105183150.20266-1-ayaka@soulik.info> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Randy Li --- drivers/staging/rockchip-mpp/Kconfig | 52 + drivers/staging/rockchip-mpp/Makefile | 16 + drivers/staging/rockchip-mpp/mpp_debug.h | 87 ++ drivers/staging/rockchip-mpp/mpp_dev_common.c | 971 ++++++++++++++++++ drivers/staging/rockchip-mpp/mpp_dev_common.h | 219 ++++ drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c | 856 +++++++++++++++ drivers/staging/rockchip-mpp/mpp_dev_vdpu1.c | 615 +++++++++++ drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c | 577 +++++++++++ drivers/staging/rockchip-mpp/mpp_dev_vepu1.c | 481 +++++++++ drivers/staging/rockchip-mpp/mpp_dev_vepu2.c | 478 +++++++++ drivers/staging/rockchip-mpp/mpp_iommu_dma.c | 292 ++++++ drivers/staging/rockchip-mpp/mpp_iommu_dma.h | 42 + drivers/staging/rockchip-mpp/mpp_service.c | 197 ++++ drivers/staging/rockchip-mpp/mpp_service.h | 38 + include/uapi/video/rk_vpu_service.h | 101 ++ 15 files changed, 5022 insertions(+) create mode 100644 drivers/staging/rockchip-mpp/Kconfig create mode 100644 drivers/staging/rockchip-mpp/Makefile create mode 100644 drivers/staging/rockchip-mpp/mpp_debug.h create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_common.c create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_common.h create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_vdpu1.c create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_vepu1.c create mode 100644 drivers/staging/rockchip-mpp/mpp_dev_vepu2.c create mode 100644 drivers/staging/rockchip-mpp/mpp_iommu_dma.c create mode 100644 drivers/staging/rockchip-mpp/mpp_iommu_dma.h create mode 100644 drivers/staging/rockchip-mpp/mpp_service.c create mode 100644 drivers/staging/rockchip-mpp/mpp_service.h create mode 100644 include/uapi/video/rk_vpu_service.h diff --git a/drivers/staging/rockchip-mpp/Kconfig b/drivers/staging/rockchip-mpp/Kconfig new file mode 100644 index 000000000000..691ddc3bcd14 --- /dev/null +++ b/drivers/staging/rockchip-mpp/Kconfig @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0 +menu "ROCKCHIP_MPP" + depends on ARCH_ROCKCHIP + +config ROCKCHIP_MPP_SERVICE + tristate "mpp service scheduler" + default n + help + rockchip mpp service. + +config ROCKCHIP_MPP_DEVICE + tristate "mpp device framework" + depends on ROCKCHIP_MPP_SERVICE + default n + help + rockchip mpp device framework. + +config ROCKCHIP_MPP_VDEC_DEVICE + tristate "video decoder device driver" + depends on ROCKCHIP_MPP_DEVICE + default n + help + rockchip mpp video decoder and hevc decoder. + +config ROCKCHIP_MPP_VDPU1_DEVICE + tristate "VPU decoder v1 device driver" + depends on ROCKCHIP_MPP_DEVICE + default n + help + rockchip mpp vpu decoder v1. + +config ROCKCHIP_MPP_VEPU1_DEVICE + tristate "VPU encoder v1 device driver" + depends on ROCKCHIP_MPP_DEVICE + default n + help + rockchip mpp vpu encoder v1. + +config ROCKCHIP_MPP_VDPU2_DEVICE + tristate "VPU decoder v2 device driver" + depends on ROCKCHIP_MPP_DEVICE + default n + help + rockchip mpp vpu decoder v2. + +config ROCKCHIP_MPP_VEPU2_DEVICE + tristate "VPU encoder v2 device driver" + depends on ROCKCHIP_MPP_DEVICE + default n + help + rockchip mpp vpu encoder v2. +endmenu diff --git a/drivers/staging/rockchip-mpp/Makefile b/drivers/staging/rockchip-mpp/Makefile new file mode 100644 index 000000000000..06a9c58c92cb --- /dev/null +++ b/drivers/staging/rockchip-mpp/Makefile @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 +rk-mpp-service-objs := mpp_service.o +rk-mpp-device-objs := mpp_dev_common.o mpp_iommu_dma.o +rk-mpp-vdec-objs := mpp_dev_rkvdec.o +rk-mpp-vdpu1-objs := mpp_dev_vdpu1.o +rk-mpp-vdpu2-objs := mpp_dev_vdpu2.o +rk-mpp-vepu1-objs := mpp_dev_vepu1.o +rk-mpp-vepu2-objs := mpp_dev_vepu2.o + +obj-$(CONFIG_ROCKCHIP_MPP_SERVICE) += rk-mpp-service.o +obj-$(CONFIG_ROCKCHIP_MPP_DEVICE) += rk-mpp-device.o +obj-$(CONFIG_ROCKCHIP_MPP_VDEC_DEVICE) += rk-mpp-vdec.o +obj-$(CONFIG_ROCKCHIP_MPP_VDPU1_DEVICE) += rk-mpp-vdpu1.o +obj-$(CONFIG_ROCKCHIP_MPP_VEPU1_DEVICE) += rk-mpp-vepu1.o +obj-$(CONFIG_ROCKCHIP_MPP_VDPU2_DEVICE) += rk-mpp-vdpu2.o +obj-$(CONFIG_ROCKCHIP_MPP_VEPU2_DEVICE) += rk-mpp-vepu2.o diff --git a/drivers/staging/rockchip-mpp/mpp_debug.h b/drivers/staging/rockchip-mpp/mpp_debug.h new file mode 100644 index 000000000000..bd6c0e594da3 --- /dev/null +++ b/drivers/staging/rockchip-mpp/mpp_debug.h @@ -0,0 +1,87 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2016 - 2017 Fuzhou Rockchip Electronics Co., Ltd + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#ifndef _ROCKCHIP_MPP_DEBUG_H_ +#define _ROCKCHIP_MPP_DEBUG_H_ + +#include + +/* + * debug flag usage: + * +------+-------------------+ + * | 8bit | 24bit | + * +------+-------------------+ + * 0~23 bit is for different information type + * 24~31 bit is for information print format + */ + +#define DEBUG_POWER 0x00000001 +#define DEBUG_CLOCK 0x00000002 +#define DEBUG_IRQ_STATUS 0x00000004 +#define DEBUG_IOMMU 0x00000008 +#define DEBUG_IOCTL 0x00000010 +#define DEBUG_FUNCTION 0x00000020 +#define DEBUG_REGISTER 0x00000040 +#define DEBUG_EXTRA_INFO 0x00000080 +#define DEBUG_TIMING 0x00000100 +#define DEBUG_TASK_INFO 0x00000200 +#define DEBUG_DUMP_ERR_REG 0x00000400 +#define DEBUG_LINK_TABLE 0x00000800 + +#define DEBUG_SET_REG 0x00001000 +#define DEBUG_GET_REG 0x00002000 +#define DEBUG_PPS_FILL 0x00004000 +#define DEBUG_IRQ_CHECK 0x00008000 +#define DEBUG_CACHE_32B 0x00010000 + +#define DEBUG_RESET 0x00020000 + +#define PRINT_FUNCTION 0x80000000 +#define PRINT_LINE 0x40000000 + +#define mpp_debug_func(type, fmt, args...) \ + do { \ + if (unlikely(debug & type)) { \ + pr_info("%s:%d: " fmt, \ + __func__, __LINE__, ##args); \ + } \ + } while (0) +#define mpp_debug(type, fmt, args...) \ + do { \ + if (unlikely(debug & type)) { \ + pr_info(fmt, ##args); \ + } \ + } while (0) + +#define mpp_debug_enter() \ + do { \ + if (unlikely(debug & DEBUG_FUNCTION)) { \ + pr_info("%s:%d: enter\n", \ + __func__, __LINE__); \ + } \ + } while (0) + +#define mpp_debug_leave() \ + do { \ + if (unlikely(debug & DEBUG_FUNCTION)) { \ + pr_info("%s:%d: leave\n", \ + __func__, __LINE__); \ + } \ + } while (0) + +#define mpp_err(fmt, args...) \ + pr_err("%s:%d: " fmt, __func__, __LINE__, ##args) + +#endif diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.c b/drivers/staging/rockchip-mpp/mpp_dev_common.c new file mode 100644 index 000000000000..159aa5d244ce --- /dev/null +++ b/drivers/staging/rockchip-mpp/mpp_dev_common.c @@ -0,0 +1,971 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2016 - 2017 Fuzhou Rockchip Electronics Co., Ltd + * Randy Li, + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include