blob: b5a0284394abd4a9535d9d7a2c0948e31403de08 (
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
|
/*
* Copyright (c) 2022, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <mt_cirq.h>
#include <mt_lp_irqremain.h>
#include <mt_lp_rm.h>
#include <plat_mtk_lpm.h>
#define KEYPAD_IRQ_ID U(138)
#define KEYPAD_WAKESRC (0x4U)
static struct mt_irqremain remain_irqs;
int mt_lp_irqremain_submit(void)
{
int ret = 0;
if (remain_irqs.count == 0) {
ret = -1;
} else {
set_wakeup_sources(remain_irqs.irqs, remain_irqs.count);
mt_lp_rm_do_update(-1, PLAT_RC_UPDATE_REMAIN_IRQS, &remain_irqs);
}
return ret;
}
int mt_lp_irqremain_aquire(void)
{
int ret = 0;
if (remain_irqs.count == 0) {
ret = -1;
} else {
mt_cirq_sw_reset();
mt_cirq_clone_gic();
mt_cirq_enable();
}
return ret;
}
int mt_lp_irqremain_release(void)
{
int ret = 0;
if (remain_irqs.count == 0) {
ret = -1;
} else {
mt_cirq_flush();
mt_cirq_disable();
}
return ret;
}
void mt_lp_irqremain_init(void)
{
uint32_t idx;
remain_irqs.count = 0U;
/*edge keypad*/
idx = remain_irqs.count;
remain_irqs.irqs[idx] = KEYPAD_IRQ_ID;
remain_irqs.wakeupsrc_cat[idx] = 0U;
remain_irqs.wakeupsrc[idx] = KEYPAD_WAKESRC;
remain_irqs.count++;
mt_lp_irqremain_submit();
}
|