tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / linux / mali_pmu_power_up_down.c
1 /*
2  * Copyright (C) 2011-2012 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10
11 /**
12  * @file mali_pmu_power_up_down.c
13  */
14
15 #include <linux/version.h>
16 #include <linux/sched.h>
17 #include <linux/module.h>
18 #include "mali_osk.h"
19 #include "mali_kernel_common.h"
20 #include "mali_pmu.h"
21 #include "linux/mali/mali_utgard.h"
22
23 /* Mali PMU power up/down APIs */
24
25 int mali_pmu_powerup(void)
26 {
27         struct mali_pmu_core *pmu = mali_pmu_get_global_pmu_core();
28
29         MALI_DEBUG_PRINT(5, ("Mali PMU: Power up\n"));
30
31         if (NULL == pmu)
32         {
33                 return -ENXIO;
34         }
35
36         if (_MALI_OSK_ERR_OK != mali_pmu_powerup_all(pmu))
37         {
38                 return -EFAULT;
39         }
40
41         return 0;
42 }
43
44 EXPORT_SYMBOL(mali_pmu_powerup);
45
46 int mali_pmu_powerdown(void)
47 {
48         struct mali_pmu_core *pmu = mali_pmu_get_global_pmu_core();
49
50         MALI_DEBUG_PRINT(5, ("Mali PMU: Power down\n"));
51
52         if (NULL == pmu)
53         {
54                 return -ENXIO;
55         }
56
57         if (_MALI_OSK_ERR_OK != mali_pmu_powerdown_all(pmu))
58         {
59                 return -EFAULT;
60         }
61
62         return 0;
63 }
64
65 EXPORT_SYMBOL(mali_pmu_powerdown);