Skip to content

Commit

Permalink
add k230 vpu driver
Browse files Browse the repository at this point in the history
correct format

rollback clang_format

Signed-off-by: longyiluo <[email protected]>
  • Loading branch information
longyiluo authored and RevySR committed Jul 19, 2024
1 parent 6bf189a commit d1339da
Show file tree
Hide file tree
Showing 71 changed files with 101,922 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/riscv/boot/dts/canaan/k230.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,16 @@
status = "disabled";
};

vpu: vpu@0x90400000 {
status = "okay";
compatible = "canaan,vpu";
reg = <0x0 0x90400000 0x0 0x10000>;
interrupts = <132 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&sysctl_power K230_PM_DOMAIN_VPU>;
clocks = <&vpu_src>;
clock-names = "vpu";
};

gpu: gpu@90800000 {
compatible = "verisilicon,gc8000ul";
reg = <0x0 0x90800000 0x0 0x1000>;
Expand Down
5 changes: 5 additions & 0 deletions arch/riscv/configs/k230_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,8 @@ CONFIG_TOUCHSCREEN_GOODIX=y
CONFIG_INPUT_EVDEV=y
CONFIG_GPU_VGLITE=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_I2C=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_PLATFORM_SUPPORT=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VPU_CANAAN=y
1 change: 1 addition & 0 deletions drivers/media/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ source "drivers/media/platform/ti/Kconfig"
source "drivers/media/platform/verisilicon/Kconfig"
source "drivers/media/platform/via/Kconfig"
source "drivers/media/platform/xilinx/Kconfig"
source "drivers/media/platform/canaan/vpu/Kconfig"

endif # MEDIA_PLATFORM_DRIVERS
1 change: 1 addition & 0 deletions drivers/media/platform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ obj-y += ti/
obj-y += verisilicon/
obj-y += via/
obj-y += xilinx/
obj-y += canaan/vpu/

# Please place here only ancillary drivers that aren't SoC-specific
# Please keep it alphabetically sorted by Kconfig name
Expand Down
38 changes: 38 additions & 0 deletions drivers/media/platform/canaan/vpu/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
config VPU_CANAAN
tristate "Linlon VPU support."
depends on VIDEO_DEV
depends on COMMON_CLK && HAS_DMA
select VIDEO_V4L2_SUBDEV_API
select VIDEOBUF2_DMA_CONTIG
select V4L_MEM2MEM_DRIVERS
select V4L2_FWNODE
select VIDEOBUF2_DMA_SG
default y
help
This is a v4l2 driver for Canaan video codec.
Canaan video codec is video decoder and encoder hardware unit.
It accelerates video decoder and encoder operations, such as h264, hevc,
jpeg formats.
To compile this driver as a module choose m here.

config VPU_CANAAN_FTRACE
depends on VPU_CANAAN
bool "Send kernel space logs to ftrace."
default n
help
This is a v4l2 driver for Canaan video codec.
Canaan video codec is video decoder and encoder hardware unit.
It accelerates video decoder and encoder operations, such as h264, hevc,
jpeg formats. Send kernel space logs to ftrace.
To compile this driver as a module choose m here.

config VPU_CANAAN_PRINT_FILE
depends on VPU_CANAAN
bool "Append file and line number to kernel space log messages."
default y
help
This is a v4l2 driver for Canaan video codec.
Canaan video codec is video decoder and encoder hardware unit.
It accelerates video decoder and encoder operations, such as h264, hevc,
jpeg formats. Append file and line number to kernel space log messages.
To compile this driver as a module choose m here.
58 changes: 58 additions & 0 deletions drivers/media/platform/canaan/vpu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#############################################if/##############
# Set the include-path according to the defined interface.
###########################################################

ccflags-y += -I$(src) -I$(src)/if -I$(src)/dev -I$(src)/if/v4l2 -I$(src)/external
ccflags-$(CONFIG_VPU_CANAAN_FTRACE) += -DMVX_LOG_FTRACE_ENABLE
ccflags-$(CONFIG_VPU_CANAAN_PRINT_FILE) += -DMVX_LOG_PRINT_FILE_ENABLE
ccflags-y += $(EXTRA_CCFLAGS)

###########################################################
# Define build targets and what files to include.
###########################################################

# Amvx module
obj-$(CONFIG_VPU_CANAAN) := amvx.o

# Add objects for if module.
if-y := mvx_if.o \
mvx_buffer.o \
mvx_firmware_cache.o \
mvx_firmware.o \
mvx_firmware_v2.o \
mvx_firmware_v3.o \
mvx_mmu.o \
mvx_secure.o \
mvx_session.o \
fw_jpegenc.o \
fw_jpegdec.o \
fw_h264enc.o \
fw_h264dec.o \
fw_hevcenc.o \
fw_hevcdec.o

# Add external interface.
if-y += mvx_ext_v4l2.o \
mvx_v4l2_buffer.o \
mvx_v4l2_session.o \
mvx_v4l2_vidioc.o \
mvx_v4l2_fops.o \
mvx_v4l2_ctrls.o

# Add objects for dev module.
dev-y := mvx_dev.o \
mvx_hwreg.o \
mvx_hwreg_v500.o \
mvx_hwreg_v550.o \
mvx_hwreg_v61.o \
mvx_hwreg_v52_v76.o \
mvx_lsid.o \
mvx_scheduler.o \
mvx_pm_runtime.o

# Add driver objects.
amvx-y := mvx_driver.o \
mvx_seq.o \
mvx_log.o \
mvx_log_group.o \
$(if-y) $(dev-y)
11,335 changes: 11,335 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_h264dec.c

Large diffs are not rendered by default.

15,101 changes: 15,101 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_h264enc.c

Large diffs are not rendered by default.

9,181 changes: 9,181 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_hevcdec.c

Large diffs are not rendered by default.

14,775 changes: 14,775 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_hevcenc.c

Large diffs are not rendered by default.

7,714 changes: 7,714 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_jpegdec.c

Large diffs are not rendered by default.

11,613 changes: 11,613 additions & 0 deletions drivers/media/platform/canaan/vpu/fw_jpegenc.c

Large diffs are not rendered by default.

Loading

0 comments on commit d1339da

Please sign in to comment.