1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef __INTEL_DMC_H__
7 #define __INTEL_DMC_H__
8 
9 #include "i915_reg.h"
10 #include "intel_wakeref.h"
11 #include <linux/workqueue.h>
12 
13 struct drm_i915_private;
14 
15 #define DMC_VERSION(major, minor)	((major) << 16 | (minor))
16 #define DMC_VERSION_MAJOR(version)	((version) >> 16)
17 #define DMC_VERSION_MINOR(version)	((version) & 0xffff)
18 
19 struct intel_dmc {
20 	struct work_struct work;
21 	const char *fw_path;
22 	u32 required_version;
23 	u32 max_fw_size; /* bytes */
24 	u32 *dmc_payload;
25 	u32 dmc_fw_size; /* dwords */
26 	u32 version;
27 	u32 mmio_count;
28 	i915_reg_t mmioaddr[20];
29 	u32 mmiodata[20];
30 	u32 dc_state;
31 	u32 target_dc_state;
32 	u32 allowed_dc_mask;
33 	intel_wakeref_t wakeref;
34 };
35 
36 void intel_dmc_ucode_init(struct drm_i915_private *i915);
37 void intel_dmc_load_program(struct drm_i915_private *i915);
38 void intel_dmc_ucode_fini(struct drm_i915_private *i915);
39 void intel_dmc_ucode_suspend(struct drm_i915_private *i915);
40 void intel_dmc_ucode_resume(struct drm_i915_private *i915);
41 bool intel_dmc_has_payload(struct drm_i915_private *i915);
42 
43 #endif /* __INTEL_DMC_H__ */
44