summaryrefstree
path: root/kernel/drivers/media/platform/exynos/fimc-is2/fimc-is-debug.h
blob: 08b49c1c7e2a8a982efdc28305b83d06791a01f0 (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
/*
 * 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_DEBUG_H
#define FIMC_IS_DEBUG_H

#define DEBUG_SENTENCE_MAX		300

#ifdef DBG_DRAW_DIGIT
#define DBG_DIGIT_CNT		20	/* Max count of total digit */
#define DBG_DIGIT_W		16
#define DBG_DIGIT_H		32
#define DBG_DIGIT_MARGIN_W_INIT	128
#define DBG_DIGIT_MARGIN_H_INIT	64
#define DBG_DIGIT_MARGIN_W	8
#define DBG_DIGIT_MARGIN_H	2
#define DBG_DIGIT_TAG(row, col, queue, frame, digit)	\
	do {		\
		ulong addr;	\
		u32 width, height, pixelformat, bitwidth;		\
		addr = queue->buf_kva[frame->index][0];			\
		width = queue->framecfg.width;				\
		height = queue->framecfg.height;			\
		pixelformat = queue->framecfg.format->pixelformat;	\
		bitwidth = queue->framecfg.format->bitwidth;		\
		fimc_is_draw_digit(addr, width, height, pixelformat, bitwidth,	\
				row, col, digit);			\
	} while(0)
#else
#define DBG_DIGIT_TAG(row, col, queue, frame, digit)
#endif

enum fimc_is_debug_state {
	FIMC_IS_DEBUG_OPEN
};

struct fimc_is_debug {
	struct dentry		*root;
	struct dentry		*logfile;
	struct dentry		*imgfile;

	/* log dump */
	size_t			read_vptr;
	struct fimc_is_minfo	*minfo;

	/* image dump */
	u32			dump_count;
	ulong			img_cookie;
	ulong			img_kvaddr;
	size_t			size;

	/* debug message */
	size_t			dsentence_pos;
	char			dsentence[DEBUG_SENTENCE_MAX];

	unsigned long		state;
};

extern struct fimc_is_debug fimc_is_debug;

int fimc_is_debug_probe(void);
int fimc_is_debug_open(struct fimc_is_minfo *minfo);
int fimc_is_debug_close(void);

void fimc_is_dmsg_init(void);
void fimc_is_dmsg_concate(const char *fmt, ...);
char *fimc_is_dmsg_print(void);
void fimc_is_print_buffer(char *buffer, size_t len);
#ifdef DBG_DRAW_DIGIT
void fimc_is_draw_digit(ulong addr, int width, int height, u32 pixelformat,
		u32 bitwidth, int row_index, int col_index, u64 digit);
#endif

int imgdump_request(ulong cookie, ulong kvaddr, size_t size);

#endif