mx51evk_video.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  3. * Fabio Estevam <fabio.estevam@freescale.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <linux/list.h>
  25. #include <asm/gpio.h>
  26. #include <asm/arch/iomux-mx51.h>
  27. #include <linux/fb.h>
  28. #include <ipu_pixfmt.h>
  29. #define MX51EVK_LCD_3V3 IMX_GPIO_NR(4, 9)
  30. #define MX51EVK_LCD_5V IMX_GPIO_NR(4, 10)
  31. #define MX51EVK_LCD_BACKLIGHT IMX_GPIO_NR(3, 4)
  32. static struct fb_videomode const claa_wvga = {
  33. .name = "CLAA07LC0ACW",
  34. .refresh = 57,
  35. .xres = 800,
  36. .yres = 480,
  37. .pixclock = 37037,
  38. .left_margin = 40,
  39. .right_margin = 60,
  40. .upper_margin = 10,
  41. .lower_margin = 10,
  42. .hsync_len = 20,
  43. .vsync_len = 10,
  44. .sync = 0,
  45. .vmode = FB_VMODE_NONINTERLACED
  46. };
  47. static struct fb_videomode const dvi = {
  48. .name = "DVI panel",
  49. .refresh = 60,
  50. .xres = 1024,
  51. .yres = 768,
  52. .pixclock = 15385,
  53. .left_margin = 220,
  54. .right_margin = 40,
  55. .upper_margin = 21,
  56. .lower_margin = 7,
  57. .hsync_len = 60,
  58. .vsync_len = 10,
  59. .sync = 0,
  60. .vmode = FB_VMODE_NONINTERLACED
  61. };
  62. void setup_iomux_lcd(void)
  63. {
  64. /* DI2_PIN15 */
  65. imx_iomux_v3_setup_pad(MX51_PAD_DI_GP4__DI2_PIN15);
  66. /* Pad settings for DI2_DISP_CLK */
  67. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK,
  68. PAD_CTL_PKE | PAD_CTL_DSE_MAX | PAD_CTL_SRE_SLOW));
  69. /* Turn on 3.3V voltage for LCD */
  70. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D12__GPIO4_9,
  71. NO_PAD_CTRL));
  72. gpio_direction_output(MX51EVK_LCD_3V3, 1);
  73. /* Turn on 5V voltage for LCD */
  74. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D13__GPIO4_10,
  75. NO_PAD_CTRL));
  76. gpio_direction_output(MX51EVK_LCD_5V, 1);
  77. /* Turn on GPIO backlight */
  78. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI1_D1_CS__GPIO3_4,
  79. NO_PAD_CTRL));
  80. gpio_direction_output(MX51EVK_LCD_BACKLIGHT, 1);
  81. }
  82. int board_video_skip(void)
  83. {
  84. int ret;
  85. char const *e = getenv("panel");
  86. if (e) {
  87. if (strcmp(e, "claa") == 0) {
  88. ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
  89. if (ret)
  90. printf("claa cannot be configured: %d\n", ret);
  91. return ret;
  92. }
  93. }
  94. /*
  95. * 'panel' env variable not found or has different value than 'claa'
  96. * Defaulting to dvi output.
  97. */
  98. ret = ipuv3_fb_init(&dvi, 0, IPU_PIX_FMT_RGB24);
  99. if (ret)
  100. printf("dvi cannot be configured: %d\n", ret);
  101. return ret;
  102. }