mt_logo.c 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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(0, "[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(0, "[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(0, "[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 = 1; // need sync with chip driver
  59. dprintf(0, "[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. {
  62. phical_screen.rotation = 270;
  63. } else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2)){
  64. phical_screen.rotation = 90;
  65. } else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3) && (phical_screen.need180Adjust == 1)){
  66. phical_screen.rotation = 180;
  67. } else {
  68. phical_screen.rotation = 0;
  69. }
  70. sync_anim_version();
  71. if (show_animationm_ver == 1)
  72. {
  73. unsigned int logonum;
  74. unsigned int *db_addr = logo_addr;
  75. unsigned int *pinfo = (unsigned int*)db_addr;
  76. logonum = pinfo[0];
  77. dprintf(0, "[lk logo: %s %d]pinfo[0]=0x%08x, pinfo[1]=0x%08x, pinfo[2]=%d\n", __FUNCTION__,__LINE__,
  78. pinfo[0], pinfo[1], pinfo[2]);
  79. dprintf(0, "[lk logo: %s %d]define ANIMATION_NEW:show new animation with capacity num\n",__FUNCTION__,__LINE__);
  80. dprintf(0, "[lk logo: %s %d]CAPACITY_LEFT =%d, CAPACITY_TOP =%d \n",__FUNCTION__,__LINE__,(CAPACITY_LEFT) ,(CAPACITY_TOP) );
  81. dprintf(0, "[lk logo: %s %d]LCM_HEIGHT=%d, LCM_WIDTH=%d \n",__FUNCTION__,__LINE__,(CAPACITY_RIGHT),(CAPACITY_BOTTOM));
  82. if(logonum < 6)
  83. {
  84. show_animationm_ver = 0 ;
  85. } else {
  86. show_animationm_ver = 1 ;
  87. }
  88. }
  89. }
  90. /*
  91. * Custom interface
  92. *
  93. */
  94. void mt_logo_get_custom_if(void)
  95. {
  96. if(logo_cust_if == NULL)
  97. {
  98. logo_cust_if = (LOGO_CUST_IF *)LOGO_GetCustomIF();
  99. }
  100. }
  101. /*
  102. * Show first boot logo when phone boot up
  103. *
  104. */
  105. void mt_disp_show_boot_logo(void)
  106. {
  107. dprintf(0, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  108. mt_logo_get_custom_if();
  109. if(logo_cust_if->show_boot_logo)
  110. {
  111. logo_cust_if->show_boot_logo();
  112. }
  113. else
  114. {
  115. ///show_logo(0);
  116. init_fb_screen();
  117. fill_animation_logo(BOOT_LOGO_INDEX, mt_get_fb_buf(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  118. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  119. }
  120. return;
  121. }
  122. /*
  123. * Custom interface : charging state
  124. *
  125. */
  126. void mt_disp_enter_charging_state(void)
  127. {
  128. mt_logo_get_custom_if();
  129. if(logo_cust_if->enter_charging_state)
  130. {
  131. logo_cust_if->enter_charging_state();
  132. }
  133. else
  134. {
  135. dprintf(0, "[lk logo: %s %d]do nothing \n",__FUNCTION__,__LINE__);
  136. }
  137. return;
  138. }
  139. /*
  140. * Show full battery when poweroff charging
  141. *
  142. */
  143. void mt_disp_show_battery_full(void)
  144. {
  145. dprintf(0, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  146. mt_disp_show_battery_capacity(100);
  147. }
  148. /*
  149. * Show animation when poweroff charging
  150. *
  151. */
  152. void mt_disp_show_battery_capacity(UINT32 capacity)
  153. {
  154. dprintf(0, "[lk logo: %s %d]capacity =%d\n",__FUNCTION__,__LINE__, capacity);
  155. mt_logo_get_custom_if();
  156. if(logo_cust_if->show_battery_capacity)
  157. {
  158. logo_cust_if->show_battery_capacity(capacity);
  159. }
  160. else
  161. {
  162. init_fb_screen();
  163. fill_animation_battery_by_ver(capacity, mt_get_fb_buf(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen, show_animationm_ver);
  164. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  165. }
  166. }
  167. /*
  168. * Show charging over logo
  169. *
  170. */
  171. void mt_disp_show_charger_ov_logo(void)
  172. {
  173. dprintf(0, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  174. mt_logo_get_custom_if();
  175. if(logo_cust_if->show_boot_logo)
  176. {
  177. logo_cust_if->show_boot_logo();
  178. }
  179. else
  180. {
  181. init_fb_screen();
  182. fill_animation_logo(CHARGER_OV_INDEX, mt_get_fb_buf(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  183. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  184. }
  185. return;
  186. }
  187. /*
  188. * Show low battery logo
  189. *
  190. */
  191. void mt_disp_show_low_battery(void)
  192. {
  193. dprintf(0, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  194. mt_logo_get_custom_if();
  195. if(logo_cust_if->show_boot_logo)
  196. {
  197. logo_cust_if->show_boot_logo();
  198. }
  199. else
  200. {
  201. init_fb_screen();
  202. //show_logo(2);
  203. fill_animation_logo(LOW_BATTERY_INDEX, mt_get_fb_buf(), (void *)mt_get_tempfb_addr(), logo_addr, phical_screen);
  204. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  205. }
  206. return;
  207. }
  208. /*
  209. * Fill rectangle region for with black or other color
  210. *
  211. */
  212. void mt_disp_fill_rect(UINT32 left, UINT32 top,
  213. UINT32 right, UINT32 bottom,
  214. UINT32 color)
  215. {
  216. dprintf(0, "[lk logo: %s %d]\n",__FUNCTION__,__LINE__);
  217. init_fb_screen();
  218. RECT_REGION_T rect = {left, top, right, bottom};
  219. fill_rect_with_color(mt_get_fb_addr(), rect, color, phical_screen);
  220. }