summaryrefslogtreecommitdiff
path: root/drivers/media/platform/qcom/venus/pm_helpers.h
blob: d98b6dc20740be66205760ee04cca99ff940fabe (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
/* 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 (*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);
}

#endif