tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / linux / mali_osk_time.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_osk_time.c
13  * Implementation of the OS abstraction layer for the kernel device driver
14  */
15
16 #include "mali_osk.h"
17 #include <linux/jiffies.h>
18 #include <linux/time.h>
19 #include <asm/delay.h>
20
21 int     _mali_osk_time_after( u32 ticka, u32 tickb )
22 {
23     return time_after((unsigned long)ticka, (unsigned long)tickb);
24 }
25
26 u32     _mali_osk_time_mstoticks( u32 ms )
27 {
28     return msecs_to_jiffies(ms);
29 }
30
31 u32     _mali_osk_time_tickstoms( u32 ticks )
32 {
33     return jiffies_to_msecs(ticks);
34 }
35
36 u32     _mali_osk_time_tickcount( void )
37 {
38     return jiffies;
39 }
40
41 void _mali_osk_time_ubusydelay( u32 usecs )
42 {
43     udelay(usecs);
44 }
45
46 u64 _mali_osk_time_get_ns( void )
47 {
48         struct timespec tsval;
49         getnstimeofday(&tsval);
50         return (u64)timespec_to_ns(&tsval);
51 }