1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2019 Linaro Ltd. */
3 #ifndef __VENUS_PM_HELPERS_H__
4 #define __VENUS_PM_HELPERS_H__
12 int (*core_get
)(struct device
*dev
);
13 void (*core_put
)(struct device
*dev
);
14 int (*core_power
)(struct device
*dev
, int on
);
16 int (*vdec_get
)(struct device
*dev
);
17 void (*vdec_put
)(struct device
*dev
);
18 int (*vdec_power
)(struct device
*dev
, int on
);
20 int (*venc_get
)(struct device
*dev
);
21 void (*venc_put
)(struct device
*dev
);
22 int (*venc_power
)(struct device
*dev
, int on
);
24 int (*coreid_power
)(struct venus_inst
*inst
, int on
);
26 int (*load_scale
)(struct venus_inst
*inst
);
29 const struct venus_pm_ops
*venus_pm_get(enum hfi_version version
);
31 static inline int venus_pm_load_scale(struct venus_inst
*inst
)
33 struct venus_core
*core
= inst
->core
;
35 if (!core
->pm_ops
|| !core
->pm_ops
->load_scale
)
38 return core
->pm_ops
->load_scale(inst
);
41 static inline int venus_pm_acquire_core(struct venus_inst
*inst
)
43 struct venus_core
*core
= inst
->core
;
44 const struct venus_pm_ops
*pm_ops
= core
->pm_ops
;
47 if (pm_ops
&& pm_ops
->coreid_power
)
48 ret
= pm_ops
->coreid_power(inst
, POWER_ON
);
53 static inline int venus_pm_release_core(struct venus_inst
*inst
)
55 struct venus_core
*core
= inst
->core
;
56 const struct venus_pm_ops
*pm_ops
= core
->pm_ops
;
59 if (pm_ops
&& pm_ops
->coreid_power
)
60 ret
= pm_ops
->coreid_power(inst
, POWER_OFF
);