• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2020 Rockchip Electronics Co. Ltd.
4  *
5  * Author: Zorro Liu <zorro.liu@rock-chips.com>
6  */
7 
8 #ifndef __EBC_DEV_H__
9 #define __EBC_DEV_H__
10 
11 #include <linux/notifier.h>
12 
13 /*
14 * max support panel size 2232x1680
15 * ebc module display buf use 4bit per pixel
16 * eink module display buf use 8bit per pixel
17 * ebc module direct mode display buf use 2bit per pixel
18 */
19 #define EBC_FB_SIZE		0x200000 /* 2M */
20 #define EINK_FB_SIZE		0x400000 /* 4M */
21 #define DIRECT_FB_SIZE		0x100000 /* 1M */
22 
23 #define MAX_FB_NUM		4
24 
25 #define EBC_SUCCESS		(0)
26 #define EBC_ERROR		(-1)
27 
28 /*
29  * ebc status notify
30  */
31 #define EBC_OFF			(0)
32 #define EBC_ON			(1)
33 #define EBC_FB_BLANK		(2)
34 #define EBC_FB_UNBLANK		(3)
35 
36 /*
37  * ebc system ioctl command
38  */
39 #define EBC_GET_BUFFER		(0x7000)
40 #define EBC_SEND_BUFFER		(0x7001)
41 #define EBC_GET_BUFFER_INFO	(0x7002)
42 #define EBC_SET_FULL_MODE_NUM	(0x7003)
43 #define EBC_ENABLE_OVERLAY	(0x7004)
44 #define EBC_DISABLE_OVERLAY	(0x7005)
45 #define EBC_GET_OSD_BUFFER	(0x7006)
46 #define EBC_SEND_OSD_BUFFER	(0x7007)
47 
48 /*
49  * IMPORTANT: Those values is corresponding to android hardware program,
50  * so *FORBID* to changes bellow values, unless you know what you're doing.
51  * And if you want to add new refresh modes, please appended to the tail.
52  */
53 enum panel_refresh_mode {
54 	EPD_AUTO		= 0,
55 	EPD_OVERLAY		= 1,
56 	EPD_FULL_GC16		= 2,
57 	EPD_FULL_GL16		= 3,
58 	EPD_FULL_GLR16		= 4,
59 	EPD_FULL_GLD16		= 5,
60 	EPD_FULL_GCC16		= 6,
61 	EPD_PART_GC16		= 7,
62 	EPD_PART_GL16		= 8,
63 	EPD_PART_GLR16		= 9,
64 	EPD_PART_GLD16		= 10,
65 	EPD_PART_GCC16		= 11,
66 	EPD_A2			= 12,
67 	EPD_DU			= 13,
68 	EPD_RESET		= 14,
69 	EPD_SUSPEND		= 15,
70 	EPD_RESUME		= 16,
71 	EPD_POWER_OFF		= 17,
72 	EPD_PART_EINK		= 18,
73 	EPD_FULL_EINK		= 19,
74 };
75 
76 /*
77  * IMPORTANT: android hardware use struct, so *FORBID* to changes this, unless you know what you're doing.
78  */
79 struct ebc_buf_info {
80 	int offset;
81 	int epd_mode;
82 	int height;
83 	int width;
84 	int panel_color;
85 	int win_x1;
86 	int win_y1;
87 	int win_x2;
88 	int win_y2;
89 	int width_mm;
90 	int height_mm;
91 };
92 
93 #if IS_ENABLED(CONFIG_ROCKCHIP_EBC_DEV)
94 int ebc_register_notifier(struct notifier_block *nb);
95 int ebc_unregister_notifier(struct notifier_block *nb);
96 int ebc_notify(unsigned long event);
97 #else
ebc_register_notifier(struct notifier_block * nb)98 static inline int ebc_register_notifier(struct notifier_block *nb)
99 {
100 	return 0;
101 }
102 
ebc_unregister_notifier(struct notifier_block * nb)103 static inline int ebc_unregister_notifier(struct notifier_block *nb)
104 {
105 	return 0;
106 }
107 
ebc_notify(unsigned long event)108 static inline int ebc_notify(unsigned long event)
109 {
110 	return 0;
111 }
112 #endif
113 
114 #endif
115