[ARM] 3454/1: ARM: OMAP: 6/8 Update framebuffer low-level init code, take 2

Patch from Tony Lindgren

Update OMAP framebuffer low-level init code from linux-omap tree
by Imre Deak.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Tony Lindgren and committed by Russell King 0dc5e77c 670c104a

+172 -27
+6
arch/arm/plat-omap/dma.c
··· 1258 1258 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 1259 1259 } 1260 1260 1261 + int omap_lcd_dma_ext_running(void) 1262 + { 1263 + return lcd_dma.ext_ctrl && lcd_dma.active; 1264 + } 1265 + 1261 1266 /*----------------------------------------------------------------------------*/ 1262 1267 1263 1268 static int __init omap_init_dma(void) ··· 1394 1389 EXPORT_SYMBOL(omap_enable_lcd_dma); 1395 1390 EXPORT_SYMBOL(omap_setup_lcd_dma); 1396 1391 EXPORT_SYMBOL(omap_stop_lcd_dma); 1392 + EXPORT_SYMBOL(omap_lcd_dma_ext_running); 1397 1393 EXPORT_SYMBOL(omap_set_lcd_dma_b1); 1398 1394 EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); 1399 1395 EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
+80
arch/arm/plat-omap/fb.c
··· 1 + #include <linux/config.h> 2 + #include <linux/module.h> 3 + #include <linux/kernel.h> 4 + #include <linux/init.h> 5 + #include <linux/platform_device.h> 6 + #include <linux/bootmem.h> 7 + 8 + #include <asm/hardware.h> 9 + #include <asm/io.h> 10 + #include <asm/mach-types.h> 11 + #include <asm/mach/map.h> 12 + 13 + #include <asm/arch/board.h> 14 + #include <asm/arch/sram.h> 15 + #include <asm/arch/omapfb.h> 16 + 17 + #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 18 + 19 + static struct omapfb_platform_data omapfb_config; 20 + 21 + static u64 omap_fb_dma_mask = ~(u32)0; 22 + 23 + static struct platform_device omap_fb_device = { 24 + .name = "omapfb", 25 + .id = -1, 26 + .dev = { 27 + .dma_mask = &omap_fb_dma_mask, 28 + .coherent_dma_mask = ~(u32)0, 29 + .platform_data = &omapfb_config, 30 + }, 31 + .num_resources = 0, 32 + }; 33 + 34 + /* called from map_io */ 35 + void omapfb_reserve_mem(void) 36 + { 37 + const struct omap_fbmem_config *fbmem_conf; 38 + 39 + omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start; 40 + omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size; 41 + 42 + fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config); 43 + 44 + if (fbmem_conf != NULL) { 45 + /* indicate that the bootloader already initialized the 46 + * fb device, so we'll skip that part in the fb driver 47 + */ 48 + omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start; 49 + omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size; 50 + if (fbmem_conf->fb_sdram_size) { 51 + pr_info("Reserving %u bytes SDRAM for frame buffer\n", 52 + fbmem_conf->fb_sdram_size); 53 + reserve_bootmem(fbmem_conf->fb_sdram_start, 54 + fbmem_conf->fb_sdram_size); 55 + } 56 + } 57 + } 58 + 59 + static inline int omap_init_fb(void) 60 + { 61 + const struct omap_lcd_config *conf; 62 + 63 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config); 64 + if (conf == NULL) 65 + return 0; 66 + 67 + omapfb_config.lcd = *conf; 68 + 69 + return platform_device_register(&omap_fb_device); 70 + } 71 + 72 + arch_initcall(omap_init_fb); 73 + 74 + #else 75 + 76 + void omapfb_reserve_mem(void) {} 77 + 78 + #endif 79 + 80 +
+1
include/asm-arm/arch-omap/dma.h
··· 404 404 extern void omap_setup_lcd_dma(void); 405 405 extern void omap_enable_lcd_dma(void); 406 406 extern void omap_stop_lcd_dma(void); 407 + extern int omap_lcd_dma_ext_running(void); 407 408 extern void omap_set_lcd_dma_ext_controller(int external); 408 409 extern void omap_set_lcd_dma_single_transfer(int single); 409 410 extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
+14
include/asm-arm/arch-omap/lcd_lph8923.h
··· 1 + #ifndef __LCD_LPH8923_H 2 + #define __LCD_LPH8923_H 3 + 4 + enum lcd_lph8923_test_num { 5 + LCD_LPH8923_TEST_RGB_LINES, 6 + }; 7 + 8 + enum lcd_lph8923_test_result { 9 + LCD_LPH8923_TEST_SUCCESS, 10 + LCD_LPH8923_TEST_INVALID, 11 + LCD_LPH8923_TEST_FAILED, 12 + }; 13 + 14 + #endif
+71 -27
include/asm-arm/arch-omap/omapfb.h
··· 34 34 #define OMAPFB_MIRROR OMAP_IOW(31, int) 35 35 #define OMAPFB_SYNC_GFX OMAP_IO(37) 36 36 #define OMAPFB_VSYNC OMAP_IO(38) 37 - #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, enum omapfb_update_mode) 37 + #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) 38 + #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(41, struct omapfb_update_window_old) 38 39 #define OMAPFB_GET_CAPS OMAP_IOR(42, unsigned long) 39 - #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, enum omapfb_update_mode) 40 + #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) 40 41 #define OMAPFB_LCD_TEST OMAP_IOW(45, int) 41 42 #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) 42 43 #define OMAPFB_UPDATE_WINDOW OMAP_IOW(47, struct omapfb_update_window) ··· 67 66 }; 68 67 69 68 struct omapfb_update_window { 70 - u32 x, y; 71 - u32 width, height; 72 - u32 format; 69 + __u32 x, y; 70 + __u32 width, height; 71 + __u32 format; 72 + }; 73 + 74 + struct omapfb_update_window_old { 75 + __u32 x, y; 76 + __u32 width, height; 73 77 }; 74 78 75 79 enum omapfb_plane { ··· 89 83 }; 90 84 91 85 struct omapfb_setup_plane { 92 - u8 plane; 93 - u8 channel_out; 94 - u32 offset; 95 - u32 pos_x, pos_y; 96 - u32 width, height; 97 - u32 color_mode; 86 + __u8 plane; 87 + __u8 channel_out; 88 + __u32 offset; 89 + __u32 pos_x, pos_y; 90 + __u32 width, height; 91 + __u32 color_mode; 98 92 }; 99 93 100 94 struct omapfb_enable_plane { 101 - u8 plane; 102 - u8 enable; 95 + __u8 plane; 96 + __u8 enable; 103 97 }; 104 98 105 99 enum omapfb_color_key_type { ··· 109 103 }; 110 104 111 105 struct omapfb_color_key { 112 - u8 channel_out; 113 - u32 background; 114 - u32 trans_key; 115 - u8 key_type; 106 + __u8 channel_out; 107 + __u32 background; 108 + __u32 trans_key; 109 + __u8 key_type; 116 110 }; 117 111 118 112 enum omapfb_update_mode { ··· 126 120 #include <linux/completion.h> 127 121 #include <linux/interrupt.h> 128 122 #include <linux/fb.h> 123 + #include <linux/mutex.h> 124 + 125 + #include <asm/arch/board.h> 129 126 130 127 #define OMAP_LCDC_INV_VSYNC 0x0001 131 128 #define OMAP_LCDC_INV_HSYNC 0x0002 ··· 193 184 int re_cycle_time; 194 185 int cs_pulse_width; 195 186 int access_time; 187 + 188 + int clk_div; 189 + 190 + u32 tim[5]; /* set by extif->convert_timings */ 191 + 192 + int converted; 196 193 }; 197 194 198 195 struct lcd_ctrl_extif { 199 196 int (*init) (void); 200 197 void (*cleanup) (void); 198 + void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div); 199 + int (*convert_timings) (struct extif_timings *timings); 201 200 void (*set_timings) (const struct extif_timings *timings); 202 - void (*write_command) (u32 cmd); 203 - u32 (*read_data) (void); 204 - void (*write_data) (u32 data); 201 + void (*set_bits_per_cycle)(int bpc); 202 + void (*write_command) (const void *buf, unsigned int len); 203 + void (*read_data) (void *buf, unsigned int len); 204 + void (*write_data) (const void *buf, unsigned int len); 205 205 void (*transfer_area) (int width, int height, 206 206 void (callback)(void * data), void *data); 207 + unsigned long max_transmit_size; 207 208 }; 209 + 210 + struct omapfb_notifier_block { 211 + struct notifier_block nb; 212 + void *data; 213 + }; 214 + 215 + typedef int (*omapfb_notifier_callback_t)(struct omapfb_notifier_block *, 216 + unsigned long event, 217 + struct omapfb_device *fbdev); 208 218 209 219 struct lcd_ctrl { 210 220 const char *name; ··· 232 204 int (*init) (struct omapfb_device *fbdev, 233 205 int ext_mode, int req_vram_size); 234 206 void (*cleanup) (void); 207 + void (*bind_client) (struct omapfb_notifier_block *nb); 235 208 void (*get_vram_layout)(unsigned long *size, 236 209 void **virt_base, 237 210 dma_addr_t *phys_base); 211 + int (*mmap) (struct vm_area_struct *vma); 238 212 unsigned long (*get_caps) (void); 239 213 int (*set_update_mode)(enum omapfb_update_mode mode); 240 214 enum omapfb_update_mode (*get_update_mode)(void); ··· 270 240 int state; 271 241 int ext_lcdc; /* Using external 272 242 LCD controller */ 273 - struct semaphore rqueue_sema; 243 + struct mutex rqueue_mutex; 274 244 275 245 void *vram_virt_base; 276 246 dma_addr_t vram_phys_base; ··· 291 261 struct device *dev; 292 262 }; 293 263 294 - extern struct lcd_panel h3_panel; 295 - extern struct lcd_panel h2_panel; 296 - extern struct lcd_panel p2_panel; 297 - extern struct lcd_panel osk_panel; 298 - extern struct lcd_panel innovator1610_panel; 299 - extern struct lcd_panel innovator1510_panel; 264 + struct omapfb_platform_data { 265 + struct omap_lcd_config lcd; 266 + struct omap_fbmem_config fbmem; 267 + }; 268 + 269 + #define OMAPFB_EVENT_READY 1 270 + #define OMAPFB_EVENT_DISABLED 2 300 271 301 272 #ifdef CONFIG_ARCH_OMAP1 302 273 extern struct lcd_ctrl omap1_lcd_ctrl; ··· 305 274 extern struct lcd_ctrl omap2_disp_ctrl; 306 275 #endif 307 276 277 + extern void omapfb_register_panel(struct lcd_panel *panel); 308 278 extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval); 279 + extern void omapfb_notify_clients(struct omapfb_device *fbdev, 280 + unsigned long event); 281 + extern int omapfb_register_client(struct omapfb_notifier_block *nb, 282 + omapfb_notifier_callback_t callback, 283 + void *callback_data); 284 + extern int omapfb_unregister_client(struct omapfb_notifier_block *nb); 285 + extern int omapfb_update_window_async(struct omapfb_update_window *win, 286 + void (*callback)(void *), 287 + void *callback_data); 288 + 289 + /* in arch/arm/plat-omap/devices.c */ 290 + extern void omapfb_reserve_mem(void); 309 291 310 292 #endif /* __KERNEL__ */ 311 293