summaryrefstree
path: root/kernel/include/linux/cpuidle-moce.h
blob: ebc4790a04f4c25325d1d0cece028f2af0f4e821 (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
/*
 * Copyright (c) 2018 Hong Hyunji, Samsung Electronics Co., Ltd <hyunji.hong@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Exynos MOCE(MOCE that can Diversify Conditions for Entry into Idle State) driver implementation
 * MOCE can vary the target residency and exit latency in accordance with the frequency
 */

typedef enum _factor_type {
	NO_FACTOR = -1,
	FREQ_FACTOR,
	/* Add enum value for new-factor */
} factor_type;

/*
 * Information about each factor that affects idle state entry,
 * initialized through the device tree.
 */
struct factor {
	/* list of factor */
	struct list_head	list;

	/* lock */
	spinlock_t		lock;

	/* factor type */
	factor_type		type;

	/* factor sibling-cpus */
	struct cpumask		cpus;

	/* factor ratio */
	unsigned int		size;
	unsigned int		ratio;
	unsigned int		*ratio_table;
};

/*
 * Information that is directly required to bias the entry conditions of the idle state,
 * and is managed by the per-cpu variable.
 */
struct bias_cpuidle {
	/* moce active or not */
	bool			biased;

	/*total ratio of factors */
	unsigned int		total_ratio;

	/* head of factor list */
	struct list_head	factor_list;
};

#ifdef CONFIG_ARM64_EXYNOS_MOCE
/* CPUIdle MOCE APIs */
extern unsigned int exynos_moce_get_ratio(unsigned int cpu);
#else
static inline unsigned int exynos_moce_get_ratio(unsigned int cpu)
{ return 100; }
#endif