move screen、transmitter、tve to rockchip
[firefly-linux-kernel-4.4.55.git] / drivers / video / rockchip / transmitter / mipi_dsi.h
1
2 //drivers/video/display/transmitter/mipi_dsi.h
3
4 #ifndef MIPI_DSI_H_
5 #define MIPI_DSI_H_
6
7 #include <linux/fb.h>
8 #include <linux/delay.h>
9 #include <linux/rk_fb.h>
10 #include <linux/rk_screen.h>
11 #include <linux/ktime.h>
12
13
14 //DSI DATA TYPE
15 #define DTYPE_DCS_SWRITE_0P             0X05 
16 #define DTYPE_DCS_SWRITE_1P             0X15 
17 #define DTYPE_DCS_LWRITE                0X39 
18 #define DTYPE_GEN_LWRITE                0X29 
19 #define DTYPE_GEN_SWRITE_2P             0X23 
20 #define DTYPE_GEN_SWRITE_1P             0X13
21 #define DTYPE_GEN_SWRITE_0P             0X03
22
23 //Video Mode
24 #define VM_NBMWSP               0X00  //Non burst mode with sync pulses
25 #define VM_NBMWSE               0X01  //Non burst mode with sync events
26 #define VM_BM                   0X02  //Burst mode
27
28 //Video Pixel Format
29 #define VPF_16BPP               0X00
30 #define VPF_18BPP               0X01     //packed
31 #define VPF_18BPPL              0X02     //loosely packed
32 #define VPF_24BPP               0X03
33
34 //iomux
35 #define OLD_RK_IOMUX 0
36
37 struct spi_t {
38         int cs;
39 #if OLD_RK_IOMUX        
40         char* cs_mux_name;
41 #endif  
42         int sck;
43 #if OLD_RK_IOMUX        
44         char* sck_mux_name;
45 #endif  
46         int miso;
47 #if OLD_RK_IOMUX        
48         char* miso_mux_name;
49 #endif  
50         int mosi;
51 #if OLD_RK_IOMUX        
52         char* mosi_mux_name;
53 #endif  
54 };
55
56 struct power_t {
57         int     enable_pin;    //gpio that control power
58 #if OLD_RK_IOMUX        
59         char* mux_name;
60         u32 mux_mode;
61 #endif  
62         u32 effect_value;
63         
64         char *name;
65         u32 voltage;
66         int (*enable)(void *);
67         int (*disable)(void *);
68 };
69
70 struct reset_t {
71         int     reset_pin;    //gpio that control reset
72 #if OLD_RK_IOMUX        
73         char* mux_name;
74         u32 mux_mode;
75 #endif  
76         u32 effect_value;
77         
78         u32 time_before_reset;    //ms
79         u32 time_after_reset;
80         
81         int (*do_reset)(void *);
82 };
83
84 struct tc358768_t {
85         u32 id;
86         struct reset_t reset;
87         struct power_t vddc;
88         struct power_t vddio;
89         struct power_t vdd_mipi;
90         struct i2c_client *client;
91         int (*gpio_init)(void *);
92         int (*gpio_deinit)(void *);
93         int (*power_up)(void);
94         int (*power_down)(void);
95 };
96
97
98 struct ssd2828_t {
99         u32 id;
100         struct reset_t reset;
101         struct power_t shut;
102         struct power_t vddio;
103         struct power_t vdd_mipi;
104         
105         struct spi_t spi;
106         int (*gpio_init)(void *);
107         int (*gpio_deinit)(void *);
108         int (*power_up)(void);
109         int (*power_down)(void);
110 };
111
112 struct mipi_dsi_ops {
113         u32 id;
114         char *name;
115         int (*get_id)(void);
116         int (*dsi_init)(void *, int n);
117         int (*dsi_set_regs)(void *, int n);
118         int (*dsi_send_dcs_packet)(unsigned char *, int n);
119         int (*dsi_read_dcs_packet)(unsigned char *, int n);
120         int (*dsi_send_packet)(void *, int n);
121         int (*power_up)(void);
122         int (*power_down)(void);        
123 };
124
125
126 int register_dsi_ops(struct mipi_dsi_ops *ops);
127 int del_dsi_ops(struct mipi_dsi_ops *ops);
128 int dsi_power_up(void);
129 int dsi_power_off(void);
130 int dsi_probe_current_chip(void);
131 int dsi_init(void *array, int n);
132 int dsi_set_regs(void *array, int n);
133 int dsi_send_dcs_packet(unsigned char *packet, int n);
134 int dsi_read_dcs_packet(unsigned char *packet, int n);
135 int dsi_send_packet(void *packet, int n);
136 #endif /* end of MIPI_DSI_H_ */