dcu.c 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2014 Freescale Semiconductor, Inc.
  4. *
  5. * FSL DCU Framebuffer driver
  6. */
  7. #include <common.h>
  8. #include <fsl_dcu_fb.h>
  9. #include "div64.h"
  10. #include "../common/dcu_sii9022a.h"
  11. DECLARE_GLOBAL_DATA_PTR;
  12. unsigned int dcu_set_pixel_clock(unsigned int pixclock)
  13. {
  14. unsigned long long div;
  15. div = (unsigned long long)(gd->bus_clk / 1000);
  16. div *= (unsigned long long)pixclock;
  17. do_div(div, 1000000000);
  18. return div;
  19. }
  20. int platform_dcu_init(unsigned int xres, unsigned int yres,
  21. const char *port,
  22. struct fb_videomode *dcu_fb_videomode)
  23. {
  24. const char *name;
  25. unsigned int pixel_format;
  26. if (strncmp(port, "twr_lcd", 4) == 0) {
  27. name = "TWR_LCD_RGB card";
  28. } else {
  29. name = "HDMI";
  30. dcu_set_dvi_encoder(dcu_fb_videomode);
  31. }
  32. printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres);
  33. pixel_format = 32;
  34. fsl_dcu_init(xres, yres, pixel_format);
  35. return 0;
  36. }