aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/ext_disp/mt6735/extd_utils.c
blob: 4a29119751d20abbf558652bde18d3cc50f44328 (plain) (blame)
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
#include <linux/semaphore.h>
#include <linux/mutex.h>
#include <linux/time.h>
#include <linux/delay.h>


#include "extd_utils.h"
#include "extd_drv_log.h"

static DEFINE_SEMAPHORE(extd_mutex);

int extd_mutex_init(struct mutex *m)
{
	EXT_DISP_LOG("mutex init:\n");
	mutex_init(m);
	return 0;
}

int extd_sw_mutex_lock(struct mutex*m)
{
	///mutex_lock(m);
	down_interruptible(&extd_mutex);
	//EXT_DISP_LOG("mutex: lock\n");
	return 0;
}

int extd_mutex_trylock(struct mutex*m)
{
	int ret = 0;
	///ret = mutex_trylock(m);
	EXT_DISP_LOG("mutex: trylock\n");
	return ret;
}


int extd_sw_mutex_unlock(struct mutex*m)
{
	///mutex_unlock(m);
	up(&extd_mutex);
	//EXT_DISP_LOG("mutex: unlock\n");
	return 0;
}

int extd_msleep(unsigned int ms)
{
	EXT_DISP_LOG("sleep %dms\n", ms);
	msleep(ms);
	return 0;
}

long int extd_get_time_us(void)
{
    struct timeval t;
    do_gettimeofday(&t);
    return (t.tv_sec & 0xFFF) * 1000000 + t.tv_usec;
}