1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of Code Aurora nor
11 * the names of its contributors may be used to endorse or promote
12 * products derived from this software without specific prior written
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <linux/kernel.h>
33 #include <linux/sched.h>
34 #include <linux/time.h>
35 #include <linux/init.h>
36 #include <linux/interrupt.h>
37 #include "linux/proc_fs.h"
38 #include <linux/types.h>
39 #include <linux/dma-mapping.h>
40 #include <linux/clk.h>
42 #include <mach/hardware.h>
45 #include <asm/system.h>
46 #include <asm/mach-types.h>
48 #include "msm_fb_panel.h"
50 #undef FEATURE_MDDI_MC4
51 #undef FEATURE_MDDI_S6D0142
52 #undef FEATURE_MDDI_HITACHI
53 #define FEATURE_MDDI_SHARP
54 #define FEATURE_MDDI_TOSHIBA
55 #undef FEATURE_MDDI_E751
56 #define FEATURE_MDDI_CORONA
57 #define FEATURE_MDDI_PRISM
79 MDDI_LCD_DEFAULT = MDDI_LCD_TOSHIBA
89 MDDI_DRIVER_RESET, /* host core registers have not been written. */
90 MDDI_DRIVER_DISABLED, /* registers written, interrupts disabled. */
91 MDDI_DRIVER_ENABLED /* registers written, interrupts enabled. */
92 } mddi_host_driver_state_type;
112 } mddi_gpio_int_type;
114 enum mddi_data_packet_size_type {
115 MDDI_DATA_PACKET_4_BYTES = 4,
116 MDDI_DATA_PACKET_8_BYTES = 8,
117 MDDI_DATA_PACKET_12_BYTES = 12,
118 MDDI_DATA_PACKET_16_BYTES = 16,
119 MDDI_DATA_PACKET_24_BYTES = 24
125 } mddi_reg_write_type;
127 boolean mddi_vsync_set_handler(msm_fb_vsync_handler_type handler, void *arg);
129 typedef void (*mddi_llist_done_cb_type) (void);
131 typedef void (*mddi_rev_handler_type) (void *);
133 boolean mddi_set_rev_handler(mddi_rev_handler_type handler, uint16 pkt_type);
135 #define MDDI_DEFAULT_PRIM_PIX_ATTR 0xC3
136 #define MDDI_DEFAULT_SECD_PIX_ATTR 0xC0
138 typedef int gpio_int_polarity_type;
139 typedef int gpio_int_handler_type;
142 void (*vsync_detected) (boolean);
143 } mddi_lcd_func_type;
145 extern mddi_lcd_func_type mddi_lcd;
146 void mddi_init(void);
148 void mddi_powerdown(void);
150 void mddi_host_start_ext_display(void);
151 void mddi_host_stop_ext_display(void);
153 extern spinlock_t mddi_host_spin_lock;
155 void mddi_reset(void);
156 #ifdef FEATURE_DUAL_PROC_MODEM_DISPLAY
157 void mddi_host_switch_proc_control(boolean on);
160 void mddi_host_exit_power_collapse(void);
162 void mddi_queue_splash_screen
166 int16 src_starting_row,
167 int16 src_starting_column,
169 int16 num_of_columns, int16 dst_starting_row, int16 dst_starting_column);
171 void mddi_queue_image
176 int16 src_starting_row,
177 int16 src_starting_column,
179 int16 num_of_columns, int16 dst_starting_row, int16 dst_starting_column);
181 int mddi_host_register_read
183 uint32 *reg_value_ptr, boolean wait, mddi_host_type host_idx);
184 int mddi_host_register_write
185 (uint32 reg_addr, uint32 reg_val,
186 enum mddi_data_packet_size_type packet_size,
187 boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host);
188 boolean mddi_host_register_write_int
190 uint32 reg_val, mddi_llist_done_cb_type done_cb, mddi_host_type host);
191 boolean mddi_host_register_read_int
192 (uint32 reg_addr, uint32 *reg_value_ptr, mddi_host_type host_idx);
193 void mddi_queue_register_write_static
195 uint32 reg_val, boolean wait, mddi_llist_done_cb_type done_cb);
196 void mddi_queue_static_window_adjust
197 (const mddi_reg_write_type *reg_write,
198 uint16 num_writes, mddi_llist_done_cb_type done_cb);
200 #define mddi_queue_register_read(reg, val_ptr, wait, sig) \
201 mddi_host_register_read(reg, val_ptr, wait, MDDI_HOST_PRIM)
202 #define mddi_queue_register_write(reg, val, wait, sig) \
203 mddi_host_register_write(reg, val, MDDI_DATA_PACKET_4_BYTES,\
204 wait, NULL, MDDI_HOST_PRIM)
205 #define mddi_queue_register_write_extn(reg, val, pkt_size, wait, sig) \
206 mddi_host_register_write(reg, val, pkt_size, \
207 wait, NULL, MDDI_HOST_PRIM)
208 #define mddi_queue_register_write_int(reg, val) \
209 mddi_host_register_write_int(reg, val, NULL, MDDI_HOST_PRIM)
210 #define mddi_queue_register_read_int(reg, val_ptr) \
211 mddi_host_register_read_int(reg, val_ptr, MDDI_HOST_PRIM)
212 #define mddi_queue_register_writes(reg_ptr, val, wait, sig) \
213 mddi_host_register_writes(reg_ptr, val, wait, sig, MDDI_HOST_PRIM)
215 void mddi_wait(uint16 time_ms);
216 void mddi_assign_max_pkt_dimensions(uint16 image_cols,
219 uint16 *max_cols, uint16 * max_rows);
220 uint16 mddi_assign_pkt_height(uint16 pkt_width, uint16 pkt_height, uint16 bpp);
221 void mddi_queue_reverse_encapsulation(boolean wait);
222 void mddi_disable(int lock);
223 #endif /* MDDIHOST_H */