summaryrefslogtreecommitdiff
path: root/include/soc/qcom/early_domain.h
blob: 076f2d6fac2bdb715e44a40bf6c8876e9d6eee05 (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
98
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/* Early domain services invoked in bootloaders run in parallel after
 * kernel takes over. One page in memory is reserved to pass information
 * between bootloader and kernel. This page has a header to capture status,
 * request and cpumask described in structure early_domain_header. Early
 * domain core driver in kernel reads this header to decide the status of
 * services and takes necessary action. The rest of the page is intended to
 * pass service specific information. Offset for service specific area are
 * defined in macros, and its the service specific driver's responsiblity
 * to operate in their defined areas to pass service specific information.
 * *
 * *
 * *
 * *****************************************
 * *              Header                   *
 * *                                       *
 * *****************************************
 * *                                       *
 * *              Early display            *
 * *                                       *
 * *                                       *
 * *****************************************
 * *                                       *
 * *              Early camera             *
 * *                                       *
 * *                                       *
 * *****************************************
 * *                                       *
 * *              Early audio              *
 * *                                       *
 * *                                       *
 * *****************************************
 * *
 */

enum service_id {
	EARLY_DOMAIN_CORE = 0,
	EARLY_DISPLAY,
	EARLY_CAMERA,
	EARLY_AUDIO,
};

#ifdef CONFIG_QCOM_EARLY_DOMAIN
#include <linux/workqueue.h>
#include <linux/cpumask.h>
#include <linux/pm_qos.h>
#include <linux/notifier.h>

#define EARLY_DOMAIN_MAGIC	"ERLYDOM"
#define MAGIC_SIZE		8
#define NUM_SERVICES		3
#define SERVICE_SHARED_MEM_SIZE		((PAGE_SIZE)/(NUM_SERVICES))

struct early_domain_header {
	char magic[MAGIC_SIZE];
	unsigned long cpumask;
	unsigned long early_domain_status;
	unsigned long early_domain_request;
};

struct early_domain_core {
	struct platform_device *pdev;
	struct early_domain_header *pdata;
	struct work_struct early_domain_work;
	phys_addr_t lk_pool_paddr;
	size_t lk_pool_size;
	phys_addr_t early_domain_shm;
	size_t early_domain_shm_size;
	cpumask_t cpumask;
	struct notifier_block ed_notifier;
	struct pm_qos_request ed_qos_request;
	struct wakeup_source ed_wake_lock;
};

void request_early_service_shutdown(enum service_id);
bool get_early_service_status(enum service_id sid);
void *get_service_shared_mem_start(enum service_id sid);

#else

static inline void request_early_service_shutdown(enum service_id sid) {}
static inline bool get_early_service_status(enum service_id sid)
						{ return false; }
static inline void *get_service_shared_mem_start(enum service_id sid)
						{ return NULL; }

#endif