1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2020, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef __HFI_PLATFORM_H__ 7 #define __HFI_PLATFORM_H__ 8 9 #include <linux/types.h> 10 #include <linux/videodev2.h> 11 12 #include "hfi.h" 13 #include "hfi_plat_bufs.h" 14 #include "hfi_helper.h" 15 16 #define MAX_PLANES 4 17 #define MAX_FMT_ENTRIES 32 18 #define MAX_CAP_ENTRIES 32 19 #define MAX_ALLOC_MODE_ENTRIES 16 20 #define MAX_CODEC_NUM 32 21 #define MAX_SESSIONS 16 22 23 struct raw_formats { 24 u32 buftype; 25 u32 fmt; 26 }; 27 28 struct hfi_plat_caps { 29 u32 codec; 30 u32 domain; 31 bool cap_bufs_mode_dynamic; 32 unsigned int num_caps; 33 struct hfi_capability caps[MAX_CAP_ENTRIES]; 34 unsigned int num_pl; 35 struct hfi_profile_level pl[HFI_MAX_PROFILE_COUNT]; 36 unsigned int num_fmts; 37 struct raw_formats fmts[MAX_FMT_ENTRIES]; 38 bool valid; /* used only for Venus v1xx */ 39 }; 40 41 struct hfi_platform_codec_freq_data { 42 u32 pixfmt; 43 u32 session_type; 44 unsigned long vpp_freq; 45 unsigned long vsp_freq; 46 unsigned long low_power_freq; 47 }; 48 49 struct hfi_platform { 50 unsigned long (*codec_vpp_freq)(struct venus_core *core, 51 u32 session_type, u32 codec); 52 unsigned long (*codec_vsp_freq)(struct venus_core *core, 53 u32 session_type, u32 codec); 54 unsigned long (*codec_lp_freq)(struct venus_core *core, 55 u32 session_type, u32 codec); 56 void (*codecs)(struct venus_core *core, u32 *enc_codecs, 57 u32 *dec_codecs, u32 *count); 58 const struct hfi_plat_caps *(*capabilities)(struct venus_core *core, 59 unsigned int *entries); 60 int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type, 61 u32 buftype, struct hfi_buffer_requirements *bufreq); 62 }; 63 64 extern const struct hfi_platform hfi_plat_v4; 65 extern const struct hfi_platform hfi_plat_v6; 66 67 const struct hfi_platform *hfi_platform_get(enum hfi_version version); 68 unsigned long hfi_platform_get_codec_vpp_freq(struct venus_core *core, 69 enum hfi_version version, 70 u32 codec, u32 session_type); 71 unsigned long hfi_platform_get_codec_vsp_freq(struct venus_core *core, 72 enum hfi_version version, 73 u32 codec, u32 session_type); 74 unsigned long hfi_platform_get_codec_lp_freq(struct venus_core *core, 75 enum hfi_version version, 76 u32 codec, u32 session_type); 77 int hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, 78 u32 *dec_codecs, u32 *count); 79 #endif 80