hc
2023-03-21 4b55d97acc464242bcd6a8ae77b8ff37c22dec58
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2020 Rockchip Electronics Co. Ltd.
 *
 * Author: Zorro Liu <zorro.liu@rock-chips.com>
 */
 
#ifndef __EBC_DEV_H__
#define __EBC_DEV_H__
 
#include <linux/notifier.h>
 
/*
* max support panel size 2232x1680
* ebc module display buf use 4bit per pixel
* eink module display buf use 8bit per pixel
* ebc module direct mode display buf use 2bit per pixel
*/
#define EBC_FB_SIZE        0x200000 /* 2M */
#define EINK_FB_SIZE        0x400000 /* 4M */
#define DIRECT_FB_SIZE        0x200000 /* 2M */
#define LUT_TABLE_SIZE        0x100000 /* 1M */
#define FRAME_COUNT_SIZE 0x500000 /* 5M */
 
#define MAX_FB_NUM        4
 
#define EBC_SUCCESS        (0)
#define EBC_ERROR        (-1)
 
#define WF_4BIT        16
#define WF_5BIT        32
 
/*
 * ebc status notify
 */
#define EBC_OFF            (0)
#define EBC_ON            (1)
#define EBC_FB_BLANK        (2)
#define EBC_FB_UNBLANK        (3)
 
/*
 * ebc system ioctl command
 */
#define EBC_GET_BUFFER        (0x7000)
#define EBC_SEND_BUFFER        (0x7001)
#define EBC_GET_BUFFER_INFO    (0x7002)
#define EBC_SET_FULL_MODE_NUM    (0x7003)
#define EBC_ENABLE_OVERLAY    (0x7004)
#define EBC_DISABLE_OVERLAY    (0x7005)
#define EBC_GET_OSD_BUFFER    (0x7006)
#define EBC_SEND_OSD_BUFFER    (0x7007)
#define EBC_NEW_BUF_PREPARE    (0x7008)
#define EBC_SET_DIFF_PERCENT    (0x7009)
#define EBC_WAIT_NEW_BUF_TIME (0x700a)
#define EBC_GET_OVERLAY_STATUS    (0x700b)
#define EBC_ENABLE_BG_CONTROL (0x700c)
#define EBC_DISABLE_BG_CONTROL (0x700d)
#define EBC_ENABLE_RESUME_COUNT (0x700e)
#define EBC_DISABLE_RESUME_COUNT (0x700f)
 
/*
 * IMPORTANT: Those values is corresponding to android hardware program,
 * so *FORBID* to changes bellow values, unless you know what you're doing.
 * And if you want to add new refresh modes, please appended to the tail.
 */
enum panel_refresh_mode {
   EPD_AUTO        = 0,
   EPD_OVERLAY        = 1,
   EPD_FULL_GC16        = 2,
   EPD_FULL_GL16        = 3,
   EPD_FULL_GLR16        = 4,
   EPD_FULL_GLD16        = 5,
   EPD_FULL_GCC16        = 6,
   EPD_PART_GC16        = 7,
   EPD_PART_GL16        = 8,
   EPD_PART_GLR16        = 9,
   EPD_PART_GLD16        = 10,
   EPD_PART_GCC16        = 11,
   EPD_A2            = 12,
   EPD_A2_DITHER            = 13,
   EPD_DU            = 14,
   EPD_DU4            = 15,
   EPD_A2_ENTER        = 16,
   EPD_RESET        = 17,
   EPD_SUSPEND        = 18,
   EPD_RESUME        = 19,
   EPD_POWER_OFF        = 20,
   EPD_FORCE_FULL        = 21,
   EPD_AUTO_DU        = 22,
   EPD_AUTO_DU4        = 23,
};
 
/*
 * IMPORTANT: android hardware use struct, so *FORBID* to changes this, unless you know what you're doing.
 */
struct ebc_buf_info {
   int offset;
   int epd_mode;
   int height;
   int width;
   int panel_color;
   int win_x1;
   int win_y1;
   int win_x2;
   int win_y2;
   int width_mm;
   int height_mm;
   int needpic;
   char tid_name[16];
};
 
#if IS_ENABLED(CONFIG_ROCKCHIP_EBC_DEV)
int ebc_register_notifier(struct notifier_block *nb);
int ebc_unregister_notifier(struct notifier_block *nb);
int ebc_notify(unsigned long event);
#else
static inline int ebc_register_notifier(struct notifier_block *nb)
{
   return 0;
}
 
static inline int ebc_unregister_notifier(struct notifier_block *nb)
{
   return 0;
}
 
static inline int ebc_notify(unsigned long event)
{
   return 0;
}
#endif
 
#endif