xref: /rk3399_rockchip-uboot/drivers/video/rk_eink/rk_ebc.h (revision d50ae2019e8c020d508dcfe7bf68a933dbd70e9e)
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 rearrange;
36 	u32 sdoe_mode;
37 	u32 sdce_width;
38 	u32 disp_pbuf;
39 	u32 disp_pbuf_size;
40 	u32 *lut_pbuf;
41 	u32 lut_pbuf_size;
42 	struct epd_lut_data lut_data;
43 	struct epd_lut_ops lut_ops;
44 };
45 
46 struct rk_ebc_tcon_ops {
47 	int (*enable)(struct udevice *dev, struct ebc_panel *panel);
48 	int (*disable)(struct udevice *dev);
49 	int (*dsp_mode_set)(struct udevice *dev, int update_mode,
50 			    int display_mode, int three_win_mode,
51 			    int eink_mode);
52 	int (*image_addr_set)(struct udevice *dev, u32 pre_image_addr,
53 			      u32 cur_image_addr);
54 	int (*frame_addr_set)(struct udevice *dev, u32 frame_addr);
55 	int (*lut_data_set)(struct udevice *dev, unsigned int *lut_data,
56 			    int frame_count, int lut_32);
57 	int (*frame_start)(struct udevice *dev, int frame_total);
58 	int (*wait_for_last_frame_complete)(struct udevice *dev);
59 };
60 
61 #define ebc_tcon_get_ops(dev)	((struct rk_ebc_tcon_ops *)(dev)->driver->ops)
62 
63 /*
64  *interface for ebc power control
65  */
66 struct rk_ebc_pwr_ops {
67 	int (*power_on)(struct udevice *dev);
68 	int (*power_down)(struct udevice *dev);
69 	int (*temp_get)(struct udevice *dev, u32 *temp);
70 	int (*vcom_set)(struct udevice *dev, u32 vcom);
71 };
72 
73 #define ebc_pwr_get_ops(dev)	((struct rk_ebc_pwr_ops *)(dev)->driver->ops)
74 
75 //display mode define
76 #define DIRECT_MODE		0
77 #define LUT_MODE		1
78 #define THREE_WIN_MODE		1
79 #define EINK_MODE		1
80 
81 #endif
82