xref: /rk3399_rockchip-uboot/drivers/video/rk_eink/rk_ebc.h (revision e091b6c996a68a6a0faa2bd3ffdd90b3ba5f44ce)
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 vir_width;
17 	u32 vir_height;
18 	u32 width_mm;
19 	u32 height_mm;
20 
21 	u32 sdck;
22 	u32 lsl;
23 	u32 lbl;
24 	u32 ldl;
25 	u32 lel;
26 	u32 gdck_sta;
27 	u32 lgonl;
28 	u32 fsl;
29 	u32 fbl;
30 	u32 fdl;
31 	u32 fel;
32 	u32 panel_16bit;
33 	u32 panel_color;
34 	u32 mirror;
35 	u32 disp_pbuf;
36 	u32 disp_pbuf_size;
37 	u32 *lut_pbuf;
38 	u32 lut_pbuf_size;
39 	struct epd_lut_data lut_data;
40 	struct epd_lut_ops lut_ops;
41 };
42 
43 struct rk_ebc_tcon_ops {
44 	int (*enable)(struct udevice *dev, struct ebc_panel *panel);
45 	int (*disable)(struct udevice *dev);
46 	int (*dsp_mode_set)(struct udevice *dev, int update_mode,
47 			    int display_mode, int three_win_mode,
48 			    int eink_mode);
49 	int (*image_addr_set)(struct udevice *dev, u32 pre_image_addr,
50 			      u32 cur_image_addr);
51 	int (*frame_addr_set)(struct udevice *dev, u32 frame_addr);
52 	int (*lut_data_set)(struct udevice *dev, unsigned int *lut_data,
53 			    int frame_count, int lut_32);
54 	int (*frame_start)(struct udevice *dev, int frame_total);
55 	int (*wait_for_last_frame_complete)(struct udevice *dev);
56 };
57 
58 #define ebc_tcon_get_ops(dev)	((struct rk_ebc_tcon_ops *)(dev)->driver->ops)
59 
60 /*
61  *interface for ebc power control
62  */
63 struct rk_ebc_pwr_ops {
64 	int (*power_on)(struct udevice *dev);
65 	int (*power_down)(struct udevice *dev);
66 	int (*temp_get)(struct udevice *dev, u32 *temp);
67 	int (*vcom_set)(struct udevice *dev, u32 vcom);
68 };
69 
70 #define ebc_pwr_get_ops(dev)	((struct rk_ebc_pwr_ops *)(dev)->driver->ops)
71 
72 //display mode define
73 #define DIRECT_MODE		0
74 #define LUT_MODE		1
75 #define THREE_WIN_MODE		1
76 #define EINK_MODE		1
77 
78 #endif
79