summaryrefstree
path: root/kernel/drivers/video/fbdev/exynos/dpu30/disp_err.h
blob: 0b02a91ad0540dc3396950680b3972fb3fee6082 (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
/*
 * linux/drivers/video/fbdev/exynos/dpu_9810/disp_err.h
 *
 * Source file for display error info
 *
 * Copyright (c) 2017 Samsung Electronics
 *
 * 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 __DISP_ERR_H__
#define __DISP_ERR_H__

enum disp_error_type {
	/* DSIM */
	DSIM_UNKNOWN_ERROR,

	/* PANEL */
	PANEL_DISP_DET_ERROR,
	PANEL_UNKNOWN_ERROR,
	MAX_DISP_ERROR_TYPE,
};

typedef int (disp_check_cb)(void *data);
struct disp_check_cb_info {
	disp_check_cb *check_cb;
	void *data;
};

#define __DISP_CHECK_CB_INFO_INITIALIZER(cb_func, cb_data) \
		{ .check_cb = (disp_check_cb *)cb_func, .data = cb_data }
#define DEFINE_DISP_CHECK_CB_INFO(name, cb_func, cb_data) \
	struct disp_check_cb_info name = __DISP_CHECK_CB_INFO_INITIALIZER(cb_func, cb_data)

typedef int (disp_cb)(void *data, void *arg);
struct disp_cb_info {
	disp_cb *cb;
	void *data;
};

#define __DISP_CB_INFO_INITIALIZER(cb, cb_data) \
{ .cb = (disp_cb *)cb, .data = cb_data }
#define DEFINE_DISP_CB_INFO(name, cb_func, cb_data) \
	struct disp_cb_info name = __DISP_CB_INFO_INITIALIZER(cb_func, cb_data)

typedef int (disp_error_cb)(void *data,
		struct disp_check_cb_info *info);
typedef int (disp_powerdown_cb)(void *data,
		struct disp_check_cb_info *info);
struct disp_error_cb_info {
	disp_error_cb *error_cb;
	disp_powerdown_cb *powerdown_cb;
	void *data;
};

#define __DISP_ERROR_CB_INFO_INITIALIZER(cb, cb_data) \
		{ .error_cb = (disp_error_cb *)cb, .data = cb_data }
#define DEFINE_DISP_ERROR_CB_INFO(name, cb_func, cb_data) \
	struct disp_error_cb_info name = __DISP_ERROR_CB_INFO_INITIALIZER(cb_func, cb_data)

#define DISP_ERROR_CB_RETRY_CNT	(1)
#define DISP_CHECK_STATUS_OK	(0)
#define DISP_CHECK_STATUS_NODEV	(1 << 0)	/* UB_CON_DET */
#define DISP_CHECK_STATUS_ELOFF	(1 << 1)	/* DISP_DET */

#define IS_DISP_CHECK_STATUS_DISCONNECTED(_status_) ((_status_) & (DISP_CHECK_STATUS_NODEV))
#define IS_DISP_CHECK_STATUS_NOK(_status_) ((_status_) != (DISP_CHECK_STATUS_OK))

static inline int disp_check_status(struct disp_check_cb_info *info)
{
	if (!info || !info->check_cb)
		return -EINVAL;

	return info->check_cb(info->data);
}

#endif /* __DISP_ERR_H__ */