exynos_fb.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. *
  4. * Author: InKi Dae <inki.dae@samsung.com>
  5. * Author: Donghwa Lee <dh09.lee@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <config.h>
  23. #include <common.h>
  24. #include <lcd.h>
  25. #include <asm/io.h>
  26. #include <asm/arch/cpu.h>
  27. #include <asm/arch/clock.h>
  28. #include <asm/arch/clk.h>
  29. #include <asm/arch/mipi_dsim.h>
  30. #include <asm/arch/system.h>
  31. #include "exynos_fb.h"
  32. int lcd_line_length;
  33. int lcd_color_fg;
  34. int lcd_color_bg;
  35. void *lcd_base;
  36. void *lcd_console_address;
  37. short console_col;
  38. short console_row;
  39. static unsigned int panel_width, panel_height;
  40. static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
  41. {
  42. unsigned long palette_size;
  43. unsigned int fb_size;
  44. fb_size = vid->vl_row * vid->vl_col * (NBITS(vid->vl_bpix) >> 3);
  45. lcd_base = lcdbase;
  46. palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
  47. exynos_fimd_lcd_init_mem((unsigned long)lcd_base,
  48. (unsigned long)fb_size, palette_size);
  49. }
  50. static void exynos_lcd_init(vidinfo_t *vid)
  51. {
  52. exynos_fimd_lcd_init(vid);
  53. }
  54. static void draw_logo(void)
  55. {
  56. int x, y;
  57. ulong addr;
  58. x = ((panel_width - panel_info.logo_width) >> 1);
  59. y = ((panel_height - panel_info.logo_height) >> 1) - 4;
  60. addr = panel_info.logo_addr;
  61. bmp_display(addr, x, y);
  62. }
  63. static void lcd_panel_on(vidinfo_t *vid)
  64. {
  65. udelay(vid->init_delay);
  66. if (vid->backlight_reset)
  67. vid->backlight_reset();
  68. if (vid->cfg_gpio)
  69. vid->cfg_gpio();
  70. if (vid->lcd_power_on)
  71. vid->lcd_power_on();
  72. udelay(vid->power_on_delay);
  73. if (vid->reset_lcd) {
  74. vid->reset_lcd();
  75. udelay(vid->reset_delay);
  76. }
  77. if (vid->backlight_on)
  78. vid->backlight_on(1);
  79. if (vid->cfg_ldo)
  80. vid->cfg_ldo();
  81. if (vid->enable_ldo)
  82. vid->enable_ldo(1);
  83. if (vid->mipi_enabled)
  84. exynos_mipi_dsi_init();
  85. }
  86. void lcd_ctrl_init(void *lcdbase)
  87. {
  88. set_system_display_ctrl();
  89. set_lcd_clk();
  90. /* initialize parameters which is specific to panel. */
  91. init_panel_info(&panel_info);
  92. panel_width = panel_info.vl_width;
  93. panel_height = panel_info.vl_height;
  94. exynos_lcd_init_mem(lcdbase, &panel_info);
  95. exynos_lcd_init(&panel_info);
  96. }
  97. void lcd_enable(void)
  98. {
  99. if (panel_info.logo_on) {
  100. memset(lcd_base, 0, panel_width * panel_height *
  101. (NBITS(panel_info.vl_bpix) >> 3));
  102. draw_logo();
  103. }
  104. lcd_panel_on(&panel_info);
  105. }
  106. /* dummy function */
  107. void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
  108. {
  109. return;
  110. }