GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / media / platform / qcom / venus / hfi_platform.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
4  */
5 #include "hfi_platform.h"
6
7 const struct hfi_platform *hfi_platform_get(enum hfi_version version)
8 {
9         switch (version) {
10         case HFI_VERSION_4XX:
11                 return &hfi_plat_v4;
12         case HFI_VERSION_6XX:
13                 return &hfi_plat_v6;
14         default:
15                 break;
16         }
17
18         return NULL;
19 }
20
21 unsigned long
22 hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session_type)
23 {
24         const struct hfi_platform *plat;
25         unsigned long freq = 0;
26
27         plat = hfi_platform_get(version);
28         if (!plat)
29                 return 0;
30
31         if (plat->codec_vpp_freq)
32                 freq = plat->codec_vpp_freq(session_type, codec);
33
34         return freq;
35 }
36
37 unsigned long
38 hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session_type)
39 {
40         const struct hfi_platform *plat;
41         unsigned long freq = 0;
42
43         plat = hfi_platform_get(version);
44         if (!plat)
45                 return 0;
46
47         if (plat->codec_vpp_freq)
48                 freq = plat->codec_vsp_freq(session_type, codec);
49
50         return freq;
51 }
52
53 unsigned long
54 hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type)
55 {
56         const struct hfi_platform *plat;
57         unsigned long freq = 0;
58
59         plat = hfi_platform_get(version);
60         if (!plat)
61                 return 0;
62
63         if (plat->codec_lp_freq)
64                 freq = plat->codec_lp_freq(session_type, codec);
65
66         return freq;
67 }
68