A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

h300, Others Bugfix Bootloader backlight_init()

backlight_init needs to be called after lcd_init when using
lcd_enable()

Change-Id: Id034835c903801fea49e2b972c110c1ec5106976

authored by

William Wilgus and committed by
William Wilgus
f65fb2a6 8ac46f84

+46 -66
+1 -1
bootloader/creativezvm.c
··· 57 57 /* Now enable interrupts */ 58 58 set_irq_level(IRQ_ENABLED); 59 59 set_fiq_status(FIQ_ENABLED); 60 - backlight_init(); 61 60 lcd_init(); 61 + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 62 62 font_init(); 63 63 button_init(); 64 64 usb_init();
+2 -2
bootloader/iriver_h300.c
··· 202 202 adc_init(); 203 203 button_init(); 204 204 205 - backlight_init(); 206 - 207 205 lcd_init(); 208 206 lcd_remote_init(); 209 207 font_init(); 210 208 211 209 lcd_setfont(FONT_SYSFIXED); 210 + 211 + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 212 212 213 213 printf("Rockbox boot loader"); 214 214 printf("Version %s", rbversion);
+1 -1
bootloader/meizu_m3.c
··· 147 147 system_init(); 148 148 kernel_init(); 149 149 150 - backlight_init(); 151 150 lcd_init(); 151 + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 152 152 lcd_update(); 153 153 154 154 i2c_init();
+1 -1
bootloader/mini2440.c
··· 62 62 /* system_init(); */ 63 63 kernel_init(); 64 64 /* enable_interrupt(IRQ_FIQ_STATUS); */ 65 - backlight_init(); 66 65 lcd_init(); 66 + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 67 67 lcd_setfont(FONT_SYSFIXED); 68 68 button_init(); 69 69 dma_init();
+1 -1
bootloader/sansaconnect.c
··· 52 52 /* Now enable interrupts */ 53 53 set_irq_level(IRQ_ENABLED); 54 54 set_fiq_status(FIQ_ENABLED); 55 - backlight_init(); 56 55 lcd_init(); 56 + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 57 57 font_init(); 58 58 button_init(); 59 59
+40 -60
firmware/target/coldfire/iriver/h300/lcd-h300.c
··· 32 32 #include "font.h" 33 33 #include "bidi.h" 34 34 35 - static bool display_on = false; /* Is the display turned on? */ 36 - static bool display_flipped = false; 37 - static int xoffset = 0; /* Needed for flip */ 38 35 #ifndef BOOTLOADER 36 + #define LCD_MUTEX_INIT() mutex_init(&lcd_mtx) 37 + #define LCD_MUTEX_LOCK() mutex_lock(&lcd_mtx) 38 + #define LCD_MUTEX_UNLOCK() mutex_unlock(&lcd_mtx) 39 39 static struct mutex lcd_mtx; /* The update functions use DMA and yield */ 40 - 41 40 unsigned long dma_addr IBSS_ATTR; 42 41 unsigned int dma_len IBSS_ATTR; 43 42 volatile int dma_count IBSS_ATTR; 44 - #endif 43 + #else 44 + #define LCD_MUTEX_INIT() 45 + #define LCD_MUTEX_LOCK() 46 + #define LCD_MUTEX_UNLOCK() 47 + #endif /* def BOOTLOADER */ 48 + 49 + static bool display_on = false; /* Is the display turned on? */ 50 + static bool display_flipped = false; 51 + static int xoffset = 0; /* Needed for flip */ 45 52 46 53 /* register defines */ 47 54 #define R_START_OSC 0x00 ··· 141 148 142 149 if (display_on) 143 150 { 144 - #ifndef BOOTLOADER 145 - mutex_lock(&lcd_mtx); 146 - #endif 151 + LCD_MUTEX_LOCK(); 147 152 flip_lcd(yesno); 148 - #ifndef BOOTLOADER 149 - mutex_unlock(&lcd_mtx); 150 - #endif 153 + LCD_MUTEX_UNLOCK(); 151 154 } 152 155 } 153 156 ··· 270 273 271 274 #ifndef BOOTLOADER 272 275 DAR3 = 0xf0000002; /* Configure DMA channel 3 */ 273 - DSR3 = 1; 276 + DSR3 = 1; /* Clear all bits in the status register */ 274 277 DIVR3 = 57; /* DMA3 is mapped into vector 57 in system.c */ 275 278 ICR9 = (6 << 2); /* Enable DMA3 interrupt at level 6, priority 0 */ 276 279 coldfire_imr_mod(0, 1 << 17); 277 - 278 - mutex_init(&lcd_mtx); 279 280 #endif 281 + LCD_MUTEX_INIT(); 280 282 _display_on(); 281 283 } 282 284 ··· 284 286 { 285 287 if (display_on != on) 286 288 { 287 - #ifndef BOOTLOADER 288 - mutex_lock(&lcd_mtx); 289 - #endif 289 + LCD_MUTEX_LOCK(); 290 290 if (on) 291 291 { 292 292 _display_on(); ··· 314 314 315 315 display_on=false; 316 316 } 317 - #ifndef BOOTLOADER 318 - mutex_unlock(&lcd_mtx); 319 - #endif 317 + LCD_MUTEX_UNLOCK(); 320 318 } 321 319 } 322 320 ··· 352 350 if (!display_on) 353 351 return; 354 352 355 - #ifndef BOOTLOADER 356 - mutex_lock(&lcd_mtx); 357 - #endif 353 + LCD_MUTEX_LOCK(); 358 354 width &= ~1; /* stay on the safe side */ 359 355 height &= ~1; 360 356 ··· 385 381 usrc += stride >> 1; 386 382 vsrc += stride >> 1; 387 383 } 388 - while (ysrc < ysrc_max); 389 - #ifndef BOOTLOADER 390 - mutex_unlock(&lcd_mtx); 391 - #endif 384 + while (ysrc < ysrc_max) 385 + ;; 386 + LCD_MUTEX_UNLOCK(); 392 387 } 393 388 394 389 #ifndef BOOTLOADER ··· 396 391 void DMA3(void) __attribute__ ((interrupt_handler, section(".icode"))); 397 392 void DMA3(void) 398 393 { 399 - DSR3 = 1; 394 + DSR3 = 1; /* Clear all bits in the status register */ 400 395 if (--dma_count > 0) 401 396 { 402 397 dma_addr += LCD_WIDTH*sizeof(fb_data); ··· 415 410 { 416 411 if (display_on) 417 412 { 418 - #ifndef BOOTLOADER 419 - mutex_lock(&lcd_mtx); 420 - #endif 413 + LCD_MUTEX_LOCK(); 421 414 422 415 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT); 423 416 /* set start position window */ ··· 437 430 438 431 while (dma_count > 0) 439 432 yield(); 440 - 441 - mutex_unlock(&lcd_mtx); 442 433 #else 443 434 DAR3 = 0xf0000002; 435 + DSR3 = 1; /* Clear all bits in the status register */ 444 436 SAR3 = (unsigned long)FBADDR(0, 0); 445 437 BCR3 = LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data); 446 438 DCR3 = DMA_AA | DMA_BWC(1) 447 439 | DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE) 448 440 | DMA_DSIZE(DMA_SIZE_WORD) | DMA_START; 449 441 450 - while (!(DSR3 & 1)); 451 - DSR3 = 1; 442 + while (!(DSR3 & 1)) 443 + ;; 444 + DSR3 = 1; /* Clear all bits in the status register */ 452 445 #endif 446 + LCD_MUTEX_UNLOCK(); 453 447 } 454 448 } 455 449 456 450 /* Update a fraction of the display. */ 457 451 void lcd_update_rect(int x, int y, int width, int height) 458 452 { 453 + #ifdef BOOTLOADER 454 + (void)x; 455 + (void)y; 456 + (void)width; 457 + (void)height; 458 + lcd_update(); /* in bootloader -- all or nothing */ 459 + #else 459 460 if (display_on) 460 461 { 461 462 if (x + width > LCD_WIDTH) ··· 466 467 if (width <= 0 || height <= 0) /* nothing to do */ 467 468 return; 468 469 469 - #ifndef BOOTLOADER 470 - mutex_lock(&lcd_mtx); 471 - #endif 470 + LCD_MUTEX_LOCK(); 472 471 473 472 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT); 474 473 /* set update window */ ··· 477 476 lcd_write_reg(R_RAM_ADDR_SET, ((x+xoffset) << 8) | y); 478 477 479 478 lcd_begin_write_gram(); 480 - 481 - #ifndef BOOTLOADER 479 + 482 480 if (width == LCD_WIDTH) 483 481 { 484 482 dma_count = 1; ··· 498 496 while (dma_count > 0) 499 497 yield(); 500 498 501 - mutex_unlock(&lcd_mtx); 502 - #else 503 - DAR3 = 0xf0000002; 504 - unsigned long dma_addr = (unsigned long)FBADDR(x, y); 505 - width *= sizeof(fb_data); 506 - 507 - for (; height > 0; height--) 508 - { 509 - SAR3 = dma_addr; 510 - BCR3 = width; 511 - DCR3 = DMA_AA | DMA_BWC(1) 512 - | DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE) 513 - | DMA_DSIZE(DMA_SIZE_WORD) | DMA_START; 514 - 515 - dma_addr += LCD_WIDTH*sizeof(fb_data); 516 - 517 - while (!(DSR3 & 1)); 518 - DSR3 = 1; 519 - } 520 - #endif 499 + LCD_MUTEX_UNLOCK(); 521 500 } 501 + #endif /* ndef BOOTLOADER */ 522 502 }