xref: /rk3399_rockchip-uboot/drivers/video/rk_eink/rk_ebc.h (revision 2a7051be6cb4eddfbb7c8a7288750ec77adc42f3)
1 /*
2  * (C) Copyright 2020 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  * Author: Wenping Zhang <wenping.zhang@rock-chips.com>
6  */
7 
8 #ifndef RK_EBC_H
9 #define RK_EBC_H
10 
11 #include "epdlut/epd_lut.h"
12 
13 struct ebc_panel {
14 	u32 width;
15 	u32 height;
16 	u32 width_mm;
17 	u32 height_mm;
18 
19 	u32 sdck;
20 	u32 lsl;
21 	u32 lbl;
22 	u32 ldl;
23 	u32 lel;
24 	u32 gdck_sta;
25 	u32 lgonl;
26 	u32 fsl;
27 	u32 fbl;
28 	u32 fdl;
29 	u32 fel;
30 	u32 panel_16bit;
31 	u32 panel_color;
32 	u32 mirror;
33 	u32 disp_pbuf;
34 	u32 disp_pbuf_size;
35 	u32 *lut_pbuf;
36 	u32 lut_pbuf_size;
37 	struct epd_lut_data lut_data;
38 	struct epd_lut_ops lut_ops;
39 };
40 
41 struct rk_ebc_tcon_ops {
42 	int (*enable)(struct udevice *dev, struct ebc_panel *panel);
43 	int (*disable)(struct udevice *dev);
44 	int (*dsp_mode_set)(struct udevice *dev, int update_mode,
45 			    int display_mode, int three_win_mode,
46 			    int eink_mode);
47 	int (*image_addr_set)(struct udevice *dev, u32 pre_image_addr,
48 			      u32 cur_image_addr);
49 	int (*frame_addr_set)(struct udevice *dev, u32 frame_addr);
50 	int (*lut_data_set)(struct udevice *dev, unsigned int *lut_data,
51 			    int frame_count, int lut_32);
52 	int (*frame_start)(struct udevice *dev, int frame_total);
53 	int (*wait_for_last_frame_complete)(struct udevice *dev);
54 };
55 
56 #define ebc_tcon_get_ops(dev)	((struct rk_ebc_tcon_ops *)(dev)->driver->ops)
57 
58 /*
59  *interface for ebc power control
60  */
61 struct rk_ebc_pwr_ops {
62 	int (*power_on)(struct udevice *dev);
63 	int (*power_down)(struct udevice *dev);
64 	int (*temp_get)(struct udevice *dev, u32 *temp);
65 	int (*vcom_set)(struct udevice *dev, u32 vcom);
66 };
67 
68 #define ebc_pwr_get_ops(dev)	((struct rk_ebc_pwr_ops *)(dev)->driver->ops)
69 
70 //display mode define
71 #define DIRECT_MODE		0
72 #define LUT_MODE		1
73 #define THREE_WIN_MODE		1
74 #define EINK_MODE		1
75 
76 #endif
77