dcu.c 927 B

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