aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/pm/pm.h
blob: 97689a809372c4e316f2f375e1c585d9dfcf8285 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Author: Rickard Andersson <rickard.andersson@stericsson.com> for
 *         ST-Ericsson.
 * License terms: GNU General Public License (GPL) version 2
 *
 */

#ifndef PM_COMMON_H
#define PM_COMMON_H

#ifdef CONFIG_PM

enum prcmu_idle_stat {
	SLEEP_OK		= 0xf3,
	DEEP_SLEEP_OK		= 0xf6,
	IDLE_OK			= 0xf0,
	DEEPIDLE_OK		= 0xe3,
	ARM2PRCMUPENDINGIT_ER	= 0x91,
};

/**
 * ux500_pm_gic_decouple()
 *
 * Decouple GIC from the interrupt bus.
 */
void ux500_pm_gic_decouple(void);

/**
 * ux500_pm_gic_recouple()
 *
 * Recouple GIC with the interrupt bus.
 */
void ux500_pm_gic_recouple(void);

/**
 * ux500_pm_gic_pending_interrupt()
 *
 * returns true, if there are pending interrupts.
 */
bool ux500_pm_gic_pending_interrupt(void);

/**
 * ux500_pm_prcmu_pending_interrupt()
 *
 * returns true, if there are pending interrupts.
 */
bool ux500_pm_prcmu_pending_interrupt(void);

/**
 * ux500_pm_prcmu_set_ioforce()
 *
 * @enable: Enable/disable
 *
 * Enable/disable the gpio-ring
 */
void ux500_pm_prcmu_set_ioforce(bool enable);

/**
 * ux500_pm_prcmu_copy_gic_settings()
 *
 * This function copies all the gic interrupt settings to the prcmu.
 * This is needed for the system to catch interrupts in ApIdle
 */
void ux500_pm_prcmu_copy_gic_settings(void);

/**
 * ux500_pm_gpio_save_wake_up_status()
 *
 * This function is called when the prcmu has woken the ARM
 * but before ioforce is disabled.
 */
void ux500_pm_gpio_save_wake_up_status(void);

/**
 * ux500_pm_gpio_read_wake_up_status()
 *
 * @bank_number: The gpio bank.
 *
 * Returns the WKS register settings for given bank number.
 * The WKS register is cleared when ioforce is released therefore
 * this function is needed.
 */
u32 ux500_pm_gpio_read_wake_up_status(unsigned int bank_number);

/**
 * ux500_pm_other_cpu_wfi()
 *
 * Returns true if the other CPU is in WFI.
 */
bool ux500_pm_other_cpu_wfi(void);

/**
 * ux500_pm_prcmu_idle_stat()
 *
 * Returns the status of the last prcmu idle/sleep
 */
enum prcmu_idle_stat ux500_pm_prcmu_idle_stat(void);

struct dev_power_domain;
extern struct dev_power_domain ux500_dev_power_domain;

#else
u32 ux500_pm_gpio_read_wake_up_status(unsigned int bank_number)
{
	return 0;
}

/**
 * ux500_pm_prcmu_set_ioforce()
 *
 * @enable: Enable/disable
 *
 * Enable/disable the gpio-ring
 */
static inline void ux500_pm_prcmu_set_ioforce(bool enable) { }

#endif

#endif