intel_dmc.h 1.4 KB
Newer Older
1 2 3 4 5
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2019 Intel Corporation
 */

6 7
#ifndef __INTEL_DMC_H__
#define __INTEL_DMC_H__
8

9
#include "i915_reg_defs.h"
10 11 12
#include "intel_wakeref.h"
#include <linux/workqueue.h>

13 14
struct drm_i915_private;

15 16 17
#define DMC_VERSION(major, minor)	((major) << 16 | (minor))
#define DMC_VERSION_MAJOR(version)	((version) >> 16)
#define DMC_VERSION_MINOR(version)	((version) & 0xffff)
18

19 20
enum {
	DMC_FW_MAIN = 0,
21
	DMC_FW_PIPEA,
22
	DMC_FW_PIPEB,
23 24
	DMC_FW_PIPEC,
	DMC_FW_PIPED,
25 26 27
	DMC_FW_MAX
};

28 29 30 31 32 33
struct intel_dmc {
	struct work_struct work;
	const char *fw_path;
	u32 required_version;
	u32 max_fw_size; /* bytes */
	u32 version;
34 35 36 37
	struct dmc_fw_info {
		u32 mmio_count;
		i915_reg_t mmioaddr[20];
		u32 mmiodata[20];
38 39
		u32 dmc_offset;
		u32 start_mmioaddr;
40 41
		u32 dmc_fw_size; /*dwords */
		u32 *payload;
42
		bool present;
43 44
	} dmc_info[DMC_FW_MAX];

45 46 47 48 49 50
	u32 dc_state;
	u32 target_dc_state;
	u32 allowed_dc_mask;
	intel_wakeref_t wakeref;
};

51 52 53 54 55
void intel_dmc_ucode_init(struct drm_i915_private *i915);
void intel_dmc_load_program(struct drm_i915_private *i915);
void intel_dmc_ucode_fini(struct drm_i915_private *i915);
void intel_dmc_ucode_suspend(struct drm_i915_private *i915);
void intel_dmc_ucode_resume(struct drm_i915_private *i915);
56
bool intel_dmc_has_payload(struct drm_i915_private *i915);
57

58 59
void assert_dmc_loaded(struct drm_i915_private *i915);

60
#endif /* __INTEL_DMC_H__ */