tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / common / mali_device_pause_resume.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_device_pause_resume.c
13  * Implementation of the Mali pause/resume functionality
14  */
15
16 #include "mali_gp_scheduler.h"
17 #include "mali_pp_scheduler.h"
18 #include "mali_group.h"
19
20 void mali_dev_pause(mali_bool *power_is_on)
21 {
22         mali_bool power_is_on_tmp;
23
24         /* Locking the current power state - so it will not switch from being ON to OFF, but it might remain OFF */
25         power_is_on_tmp = _mali_osk_pm_dev_ref_add_no_power_on();
26         if (NULL != power_is_on)
27         {
28                 *power_is_on = power_is_on_tmp;
29         }
30
31         mali_gp_scheduler_suspend();
32         mali_pp_scheduler_suspend();
33 }
34
35 void mali_dev_resume(void)
36 {
37         mali_gp_scheduler_resume();
38         mali_pp_scheduler_resume();
39
40         /* Release our PM reference, as it is now safe to turn of the GPU again */
41         _mali_osk_pm_dev_ref_dec_no_power_on();
42 }