blob: aa2f6afa2354432fc0f58b6735f45356214f3579 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (C) 2019 Linaro Ltd. */
#ifndef __VENUS_PM_HELPERS_H__
#define __VENUS_PM_HELPERS_H__
struct device;
#define POWER_ON 1
#define POWER_OFF 0
struct venus_pm_ops {
int (*core_get)(struct device *dev);
void (*core_put)(struct device *dev);
int (*core_power)(struct device *dev, int on);
int (*vdec_get)(struct device *dev);
void (*vdec_put)(struct device *dev);
int (*vdec_power)(struct device *dev, int on);
int (*venc_get)(struct device *dev);
void (*venc_put)(struct device *dev);
int (*venc_power)(struct device *dev, int on);
int (*coreid_power)(struct venus_inst *inst, int on);
int (*load_scale)(struct venus_inst *inst);
};
const struct venus_pm_ops *venus_pm_get(enum hfi_version version);
static inline int venus_pm_load_scale(struct venus_inst *inst)
{
struct venus_core *core = inst->core;
if (!core->pm_ops || !core->pm_ops->load_scale)
return 0;
return core->pm_ops->load_scale(inst);
}
static inline int venus_pm_acquire_core(struct venus_inst *inst)
{
struct venus_core *core = inst->core;
const struct venus_pm_ops *pm_ops = core->pm_ops;
int ret = 0;
if (pm_ops && pm_ops->coreid_power)
ret = pm_ops->coreid_power(inst, POWER_ON);
return ret;
}
static inline int venus_pm_release_core(struct venus_inst *inst)
{
struct venus_core *core = inst->core;
const struct venus_pm_ops *pm_ops = core->pm_ops;
int ret = 0;
if (pm_ops && pm_ops->coreid_power)
ret = pm_ops->coreid_power(inst, POWER_OFF);
return ret;
}
#endif
|