diff options
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/pmu-ypr1.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/pmu-ypr1.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr1/pmu-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/pmu-ypr1.c new file mode 100644 index 0000000000..8a2a724ca4 --- /dev/null +++ b/firmware/target/hosted/samsungypr/ypr1/pmu-ypr1.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include <unistd.h> | ||
23 | #include <fcntl.h> | ||
24 | |||
25 | #include "pmu-ypr1.h" | ||
26 | #include "panic.h" | ||
27 | |||
28 | static int pmu_dev = -1; | ||
29 | |||
30 | void pmu_init(void) | ||
31 | { | ||
32 | pmu_dev = open("/dev/r1Pmu", O_RDONLY); | ||
33 | if (pmu_dev < 0) | ||
34 | panicf("/dev/r1Pmu open error!"); | ||
35 | } | ||
36 | |||
37 | void pmu_close(void) | ||
38 | { | ||
39 | if (pmu_dev >= 0) | ||
40 | close(pmu_dev); | ||
41 | } | ||
42 | |||
43 | int pmu_get_dev(void) | ||
44 | { | ||
45 | return pmu_dev; | ||
46 | } | ||
47 | |||
48 | int pmu_ioctl(int request, int *data) | ||
49 | { | ||
50 | return ioctl(pmu_dev, request, data); | ||
51 | } | ||