Skip to content

Commit

Permalink
video: rockchip/mpp_device: new common device design
Browse files Browse the repository at this point in the history
--------------    ---------------    ------------------
|            |    |             |    | mpp device     |
| mpp device |<-->| mpp service |<-->|  implementation|
|    top     |    |             |    |  and buttom    |
--------------    ---------------    ------------------

The mpp common device will do the top part, but still allow
the mpp device implementation change the default behaviour.

The mpp device implementation will register itself to the mpp
device framework. But the mpp common device is the base
class not the top class. The  mpp common device framework
also in charge of the communication with mpp service.

The clocks and power are all moved into the runtime power
domain management, we don't need to assign the clocks
in the driver but leaves those work to the rockchip power
domain and common driver, we just need to configure the clocks
in our device node.

The link mode will be regard as a bundle of tasks.

The functions with rockchip_mpp_* prefix are used
internal for the task operation.

This device mode is not just suitable for the video IP but
also IEP I think.

I now make the mpp common device become a module and
a different mpp device implementation will be module as well.

The iommu and video acceleration can work independently.

Change-Id: I97dd4eaf20a925f820133a6cb2d954fb97367cb3
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: ayaka <ayaka@soulik.info>
  • Loading branch information
Randy Li committed May 21, 2018
1 parent 4c0ced0 commit d5709ce
Show file tree
Hide file tree
Showing 18 changed files with 1,213 additions and 7,063 deletions.
5 changes: 2 additions & 3 deletions drivers/video/rockchip/vpu/Kconfig
Expand Up @@ -3,16 +3,15 @@ menu "ROCKCHIP_MPP"
depends on ARCH_ROCKCHIP

config ROCKCHIP_MPP_SERVICE
tristate "ROCKCHIP MPP SERVICE driver"
tristate "mpp service scheduler"
default n
help
rockchip mpp service.

config ROCKCHIP_MPP_DEVICE
tristate "ROCKCHIP MPP DEVICE driver"
tristate "mpp device framework"
depends on ROCKCHIP_MPP_SERVICE
default n
help
rockchip mpp module.

endmenu
9 changes: 5 additions & 4 deletions drivers/video/rockchip/vpu/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_ROCKCHIP_MPP_SERVICE) += mpp_service.o
obj-$(CONFIG_ROCKCHIP_MPP_DEVICE) += mpp_dev_rkvenc.o mpp_dev_vepu.o \
mpp_dev_h265e.o mpp_dev_common.o vpu_iommu_drm.o vpu_iommu_ion.o \
vpu_iommu_ops.o
rk-mpp-service-objs := mpp_service.o
rk-mpp-device-objs := mpp_dev_common.o mpp_iommu_dma.o

obj-$(CONFIG_ROCKCHIP_MPP_SERVICE) += rk-mpp-service.o
obj-$(CONFIG_ROCKCHIP_MPP_DEVICE) += rk-mpp-device.o
87 changes: 87 additions & 0 deletions drivers/video/rockchip/vpu/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 <linux/types.h>

/*
* 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

0 comments on commit d5709ce

Please sign in to comment.