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