summaryrefstree
path: root/kernel/techpack/display/include/linux/sde_vm_event.h
blob: 0fa15eac1b6ca707068aa310d58287283a0f88d7 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 */

#ifndef __SDE_VM_EVENT_H__
#define __SDE_VM_EVENT_H__

#include <linux/list.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <drm/drm_device.h>

/**
 * struct - msm_io_irq_entry - define irq item
 * @label: hh_irq_label for the irq
 * @irq_num: linux mapped irq num
 * @list: list head pointer
 */
struct msm_io_irq_entry {
	u32 label;
	u32 irq_num;
	struct list_head list;
};

/**
 * struct - msm_io_mem_entry - define io memory item
 * @base: reg base
 * @size: size of the reg range
 * @list: list head pointer
 */
struct msm_io_mem_entry {
	phys_addr_t base;
	phys_addr_t size;
	struct list_head list;
};

/**
 * struct - msm_io_res - represents the hw resources for vm sharing
 * @irq: list of IRQ's of all the dislay sub-devices
 * @mem: list of IO memory ranges of all the display sub-devices
 */
struct msm_io_res {
	struct list_head irq;
	struct list_head mem;
};

/**
 * struct msm_vm_ops - hooks for communication with vm clients
 * @vm_pre_hw_release: invoked before releasing the HW
 * @vm_post_hw_acquire: invoked before pushing the first commit
 * @vm_check: invoked to check the readiness of the vm_clients
 *	      before releasing the HW
 * @vm_get_io_resources: invoked to collect HW resources
 */
struct msm_vm_ops {
	int (*vm_pre_hw_release)(void *priv_data);
	int (*vm_post_hw_acquire)(void *priv_data);
	int (*vm_check)(void *priv_data);
	int (*vm_get_io_resources)(struct msm_io_res *io_res, void *priv_data);
};

/**
 * msm_vm_client_entry - defines the vm client info
 * @ops: client vm_ops
 * @dev: clients device id. Used in unregister
 * @data: client custom data
 * @list: linked list entry
 */
struct msm_vm_client_entry {
	struct msm_vm_ops ops;
	struct device *dev;
	void *data;
	struct list_head list;
};

/**
 * msm_register_vm_event - api for display dependent drivers(clients) to
 *                         register for vm events
 * @dev: msm device
 * @client_dev: client device
 * @ops: vm event hooks
 * @priv_data: client custom data
 */
int msm_register_vm_event(struct device *dev, struct device *client_dev,
			  struct msm_vm_ops *ops, void *priv_data);

/**
 * msm_unregister_vm_event - api for display dependent drivers(clients) to
 *                           unregister from vm events
 * @dev: msm device
 * @client_dev: client device
 */
void msm_unregister_vm_event(struct device *dev, struct device *client_dev);

#endif //__SDE_VM_EVENT_H__