summaryrefstree
path: root/kernel/drivers/media/platform/exynos/fimc-is2/fimc-is-time.h
blob: 071e35bed4c39112820f7ec067e9e3cae2906479 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Samsung Exynos5 SoC series FIMC-IS driver
 *
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef FIMC_IS_TIME_H
#define FIMC_IS_TIME_H

#include <linux/time.h>

/* #define MEASURE_TIME */
/* #define MONITOR_TIME */
#define MONITOR_TIMEOUT 5000 /* 5ms */
/* #define MONITOR_REPORT */
/* #define EXTERNAL_TIME */
/* #define INTERFACE_TIME */

#define INSTANCE_MASK   0x3

#define TM_FLITE_STR	0
#define TM_FLITE_END	1
#define TM_SHOT		2
#define TM_SHOT_D	3
#define TM_META_D	4
#define TM_MAX_INDEX	5

#define TMM_QUEUE	0
#define TMM_START	1
#define TMM_SCALL	7
#define TMM_SHOT1	11
#define TMM_ECALL	12
#define TMM_SDONE	13
#define TMM_DEQUE	15
#define TMM_SHOT2	16
#define TMM_END		17

struct fimc_is_monitor {
	struct timeval		time;
	u32			pcount;
	bool			check;
};

struct fimc_is_time {
	u32 report_period;
	u32 time_count;
	u32 time1_min;
	u32 time1_max;
	u32 time1_tot;
	u32 time2_min;
	u32 time2_max;
	u32 time2_tot;
	u32 time3_min;
	u32 time3_max;
	u32 time3_tot;
	u32 time4_cur;
	u32 time4_old;
	u32 time4_tot;
};

struct fimc_is_interface_time {
	u32 cmd;
	u32 time_tot;
	u32 time_min;
	u32 time_max;
	u32 time_cnt;
};

void TIME_STR(unsigned int index);
void TIME_END(unsigned int index, const char *name);
void fimc_is_jitter(u64 timestamp);
u64 fimc_is_get_timestamp(void);
u64 fimc_is_get_timestamp_boot(void);
#define PROGRAM_COUNT(count) monitor_point(group, frame, count)
void monitor_point(void *group_data, void *frame_data, u32 mpoint);

#ifdef MEASURE_TIME
#ifdef MONITOR_TIME
void monitor_init(struct fimc_is_time *time);
void monitor_period(struct fimc_is_time *time, u32 report_period);
#endif
#ifdef INTERFACE_TIME
void measure_init(struct fimc_is_interface_time *time, u32 cmd);
void measure_time(struct fimc_is_interface_time *time,
	u32 instance,
	u32 group,
	struct timeval *start,
	struct timeval *end);
#endif
#endif

#endif