mx51evk_video.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  4. * Fabio Estevam <fabio.estevam@freescale.com>
  5. */
  6. #include <common.h>
  7. #include <linux/list.h>
  8. #include <asm/gpio.h>
  9. #include <asm/arch/iomux-mx51.h>
  10. #include <linux/fb.h>
  11. #include <ipu_pixfmt.h>
  12. #define MX51EVK_LCD_3V3 IMX_GPIO_NR(4, 9)
  13. #define MX51EVK_LCD_5V IMX_GPIO_NR(4, 10)
  14. #define MX51EVK_LCD_BACKLIGHT IMX_GPIO_NR(3, 4)
  15. static struct fb_videomode const claa_wvga = {
  16. .name = "CLAA07LC0ACW",
  17. .refresh = 57,
  18. .xres = 800,
  19. .yres = 480,
  20. .pixclock = 37037,
  21. .left_margin = 40,
  22. .right_margin = 60,
  23. .upper_margin = 10,
  24. .lower_margin = 10,
  25. .hsync_len = 20,
  26. .vsync_len = 10,
  27. .sync = 0,
  28. .vmode = FB_VMODE_NONINTERLACED
  29. };
  30. static struct fb_videomode const dvi = {
  31. .name = "DVI panel",
  32. .refresh = 60,
  33. .xres = 1024,
  34. .yres = 768,
  35. .pixclock = 15385,
  36. .left_margin = 220,
  37. .right_margin = 40,
  38. .upper_margin = 21,
  39. .lower_margin = 7,
  40. .hsync_len = 60,
  41. .vsync_len = 10,
  42. .sync = 0,
  43. .vmode = FB_VMODE_NONINTERLACED
  44. };
  45. void setup_iomux_lcd(void)
  46. {
  47. /* DI2_PIN15 */
  48. imx_iomux_v3_setup_pad(MX51_PAD_DI_GP4__DI2_PIN15);
  49. /* Pad settings for DI2_DISP_CLK */
  50. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK,
  51. PAD_CTL_PKE | PAD_CTL_DSE_MAX | PAD_CTL_SRE_SLOW));
  52. /* Turn on 3.3V voltage for LCD */
  53. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D12__GPIO4_9,
  54. NO_PAD_CTRL));
  55. gpio_direction_output(MX51EVK_LCD_3V3, 1);
  56. /* Turn on 5V voltage for LCD */
  57. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D13__GPIO4_10,
  58. NO_PAD_CTRL));
  59. gpio_direction_output(MX51EVK_LCD_5V, 1);
  60. /* Turn on GPIO backlight */
  61. imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI1_D1_CS__GPIO3_4,
  62. NO_PAD_CTRL));
  63. gpio_direction_output(MX51EVK_LCD_BACKLIGHT, 1);
  64. }
  65. int board_video_skip(void)
  66. {
  67. int ret;
  68. char const *e = env_get("panel");
  69. if (e) {
  70. if (strcmp(e, "claa") == 0) {
  71. ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
  72. if (ret)
  73. printf("claa cannot be configured: %d\n", ret);
  74. return ret;
  75. }
  76. }
  77. /*
  78. * 'panel' env variable not found or has different value than 'claa'
  79. * Defaulting to dvi output.
  80. */
  81. ret = ipuv3_fb_init(&dvi, 0, IPU_PIX_FMT_RGB24);
  82. if (ret)
  83. printf("dvi cannot be configured: %d\n", ret);
  84. return ret;
  85. }