mt_logo.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. #include <debug.h>
  2. #include <platform/mt_typedefs.h>
  3. #include <platform/mt_disp_drv.h>
  4. #include <platform/disp_drv.h>
  5. #include <platform/lcd_drv.h>
  6. #include <platform/mt_logo.h>
  7. #include <platform/disp_drv_platform.h>
  8. #include <target/board.h>
  9. #include "lcm_drv.h"
  10. #include <string.h>
  11. /* show logo header file */
  12. #include <show_logo_common.h>
  13. #include <decompress_common.h>
  14. #include <show_animation_common.h>
  15. LCM_SCREEN_T phical_screen;
  16. void *logo_addr = NULL;
  17. static LOGO_CUST_IF *logo_cust_if = NULL;
  18. /********** show_animationm_ver: charging animation version ************/
  19. /* */
  20. /* version 0: show 4 recatangle growing animation without battery number */
  21. /* version 1: show wave animation with battery number */
  22. /* */
  23. /*** ***/
  24. int show_animationm_ver = VERION_OLD_ANIMATION;
  25. /*
  26. * Get the defined charging animation version
  27. *
  28. */
  29. void sync_anim_version()
  30. {
  31. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  32. #ifdef ANIMATION_NEW
  33. show_animationm_ver = VERION_NEW_ANIMATION;
  34. #else
  35. show_animationm_ver = VERION_OLD_ANIMATION;
  36. dprintf(INFO, "[lk logo %s %d]not define ANIMATION_NEW:show old animation \n",__FUNCTION__,__LINE__);
  37. #endif
  38. }
  39. /*
  40. * Initliaze charging animation parameters
  41. *
  42. */
  43. void init_fb_screen()
  44. {
  45. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  46. unsigned int fb_size = mt_get_fb_size();
  47. logo_addr = mt_get_logo_db_addr();
  48. phical_screen.width = CFG_DISPLAY_WIDTH;
  49. phical_screen.height = CFG_DISPLAY_HEIGHT;
  50. phical_screen.fb_size = fb_size;
  51. phical_screen.fill_dst_bits = CFG_DISPLAY_BPP;
  52. phical_screen.bits_per_pixel = CFG_DISPLAY_BPP;
  53. // in JB2.MP need to allign width and height to 32 ,but jb5.mp needn't
  54. phical_screen.needAllign = 1;
  55. phical_screen.allignWidth = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT);
  56. /* In GB, no need to adjust 180 showing logo ,for fb driver dealing the change */
  57. /* but in JB, need adjust it for screen 180 roration */
  58. phical_screen.need180Adjust = 0; // need sync with chip driver
  59. dprintf(INFO, "[lk logo: %s %d]MTK_LCM_PHYSICAL_ROTATION = %s\n",__FUNCTION__,__LINE__, MTK_LCM_PHYSICAL_ROTATION);
  60. if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3)) {
  61. phical_screen.rotation = 270;
  62. } else if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2)) {
  63. phical_screen.rotation = 90;
  64. } else if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3) && (phical_screen.need180Adjust == 1)) {
  65. phical_screen.rotation = 180;
  66. } else {
  67. phical_screen.rotation = 0;
  68. }
  69. sync_anim_version();
  70. if (show_animationm_ver == 1) {
  71. unsigned int logonum;
  72. unsigned int *db_addr = logo_addr;
  73. unsigned int *pinfo = (unsigned int*)db_addr;
  74. logonum = pinfo[0];
  75. dprintf(INFO, "[lk logo: %s %d]pinfo[0]=0x%08x, pinfo[1]=0x%08x, pinfo[2]=%d\n", __FUNCTION__,__LINE__,
  76. pinfo[0], pinfo[1], pinfo[2]);
  77. dprintf(INFO, "[lk logo: %s %d]define ANIMATION_NEW:show new animation with capacity num\n",__FUNCTION__,__LINE__);
  78. dprintf(INFO, "[lk logo: %s %d]CAPACITY_LEFT =%d, CAPACITY_TOP =%d \n",__FUNCTION__,__LINE__,(CAPACITY_LEFT) ,(CAPACITY_TOP) );
  79. dprintf(INFO, "[lk logo: %s %d]LCM_HEIGHT=%d, LCM_WIDTH=%d \n",__FUNCTION__,__LINE__,(CAPACITY_RIGHT),(CAPACITY_BOTTOM));
  80. if (logonum < 6) {
  81. show_animationm_ver = 0 ;
  82. } else {
  83. show_animationm_ver = 1 ;
  84. }
  85. }
  86. }
  87. /*
  88. * Custom interface
  89. *
  90. */
  91. void mt_logo_get_custom_if(void)
  92. {
  93. if (logo_cust_if == NULL) {
  94. logo_cust_if = (LOGO_CUST_IF *)LOGO_GetCustomIF();
  95. }
  96. }
  97. /*
  98. * Show first boot logo when phone boot up
  99. *
  100. */
  101. void mt_disp_show_boot_logo(void)
  102. {
  103. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  104. mt_logo_get_custom_if();
  105. if (logo_cust_if->show_boot_logo) {
  106. logo_cust_if->show_boot_logo();
  107. } else {
  108. ///show_logo(0);
  109. init_fb_screen();
  110. fill_animation_logo(BOOT_LOGO_INDEX, mt_get_fb_addr(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  111. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  112. }
  113. return;
  114. }
  115. /*
  116. * Custom interface : charging state
  117. *
  118. */
  119. void mt_disp_enter_charging_state(void)
  120. {
  121. mt_logo_get_custom_if();
  122. if (logo_cust_if->enter_charging_state) {
  123. logo_cust_if->enter_charging_state();
  124. } else {
  125. dprintf(INFO, "[lk logo: %s %d]do nothing \n",__FUNCTION__,__LINE__);
  126. }
  127. return;
  128. }
  129. /*
  130. * Show full battery when poweroff charging
  131. *
  132. */
  133. void mt_disp_show_battery_full(void)
  134. {
  135. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  136. mt_disp_show_battery_capacity(100);
  137. }
  138. /*
  139. * Show animation when poweroff charging
  140. *
  141. */
  142. void mt_disp_show_battery_capacity(UINT32 capacity)
  143. {
  144. dprintf(INFO, "[lk logo: %s %d]capacity =%d\n",__FUNCTION__,__LINE__, capacity);
  145. mt_logo_get_custom_if();
  146. if (logo_cust_if->show_battery_capacity) {
  147. logo_cust_if->show_battery_capacity(capacity);
  148. } else {
  149. init_fb_screen();
  150. fill_animation_battery_by_ver(capacity, mt_get_fb_addr(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen, show_animationm_ver);
  151. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  152. }
  153. }
  154. /*
  155. * Show charging over logo
  156. *
  157. */
  158. void mt_disp_show_charger_ov_logo(void)
  159. {
  160. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  161. mt_logo_get_custom_if();
  162. if (logo_cust_if->show_boot_logo) {
  163. logo_cust_if->show_boot_logo();
  164. } else {
  165. init_fb_screen();
  166. fill_animation_logo(CHARGER_OV_INDEX, mt_get_fb_addr(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  167. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  168. }
  169. return;
  170. }
  171. /*
  172. * Show low battery logo
  173. *
  174. */
  175. void mt_disp_show_low_battery(void)
  176. {
  177. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  178. mt_logo_get_custom_if();
  179. if (logo_cust_if->show_boot_logo) {
  180. logo_cust_if->show_boot_logo();
  181. } else {
  182. init_fb_screen();
  183. //show_logo(2);
  184. fill_animation_logo(LOW_BATTERY_INDEX, mt_get_fb_addr(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  185. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  186. }
  187. return;
  188. }
  189. /*
  190. * Fill rectangle region for with black or other color
  191. *
  192. */
  193. void mt_disp_fill_rect(UINT32 left, UINT32 top,
  194. UINT32 right, UINT32 bottom,
  195. UINT32 color)
  196. {
  197. dprintf(INFO, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  198. init_fb_screen();
  199. RECT_REGION_T rect = {left, top, right, bottom};
  200. fill_rect_with_color(mt_get_fb_addr(), rect, color, phical_screen);
  201. }