1 /* 2 * drivers/amlogic/media/frame_provider/decoder/utils/amvdec.h 3 * 4 * Copyright (C) 2016 Amlogic, Inc. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 */ 17 18 #ifndef AMVDEC_H 19 #define AMVDEC_H 20 #include <linux/amlogic/media/utils/amports_config.h> 21 #include <linux/amlogic/media/utils/vformat.h> 22 #include "vdec.h" 23 24 #define UCODE_ALIGN 8 25 #define UCODE_ALIGN_MASK 7UL 26 27 struct amvdec_dec_reg_s { 28 unsigned long mem_start; 29 unsigned long mem_end; 30 struct device *cma_dev; 31 struct dec_sysinfo *dec_sysinfo; 32 }; /*amvdec_dec_reg_t */ 33 34 struct vdec_s; 35 36 extern void amvdec_start(void); 37 extern void amvdec_stop(void); 38 extern void amvdec_enable(void); 39 extern void amvdec_disable(void); 40 s32 amvdec_loadmc_ex(enum vformat_e type, const char *name, char *def); 41 s32 amvdec_vdec_loadmc_ex(enum vformat_e type, const char *name, 42 struct vdec_s *vdec, char *def); 43 44 extern void amvdec2_start(void); 45 extern void amvdec2_stop(void); 46 extern void amvdec2_enable(void); 47 extern void amvdec2_disable(void); 48 s32 amvdec2_loadmc_ex(enum vformat_e type, const char *name, char *def); 49 50 extern void amhevc_start(void); 51 extern void amhevc_stop(void); 52 extern void amhevc_enable(void); 53 extern void amhevc_disable(void); 54 s32 amhevc_loadmc_ex(enum vformat_e type, const char *name, char *def); 55 s32 amhevc_vdec_loadmc_ex(enum vformat_e type, struct vdec_s *vdec, 56 const char *name, char *def); 57 s32 amvdec_vdec_loadmc_buf_ex(enum vformat_e type, const char *name, 58 struct vdec_s *vdec, char *buf, int size); 59 60 extern void amhcodec_start(void); 61 extern void amhcodec_stop(void); 62 s32 amhcodec_loadmc(const u32 *p); 63 s32 amhcodec_loadmc_ex(enum vformat_e type, const char *name, char *def); 64 65 extern int amvdev_pause(void); 66 extern int amvdev_resume(void); 67 68 #ifdef CONFIG_PM 69 extern int amvdec_suspend(struct platform_device *dev, pm_message_t event); 70 extern int amvdec_resume(struct platform_device *dec); 71 extern int amhevc_suspend(struct platform_device *dev, pm_message_t event); 72 extern int amhevc_resume(struct platform_device *dec); 73 74 #endif 75 76 int amvdec_init(void); 77 void amvdec_exit(void); 78 79 #if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */ 80 #define AMVDEC_CLK_GATE_ON(a) 81 #define AMVDEC_CLK_GATE_OFF(a) 82 #else 83 #define AMVDEC_CLK_GATE_ON(a) CLK_GATE_ON(a) 84 #define AMVDEC_CLK_GATE_OFF(a) CLK_GATE_OFF(a) 85 #endif 86 87 /* TODO: move to register headers */ 88 #define RESET_VCPU (1<<7) 89 #define RESET_CCPU (1<<8) 90 91 #endif /* AMVDEC_H */ 92