dcu.c 976 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2016 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(struct fb_info *fbinfo,
  21. 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(fbinfo, xres, yres, pixel_format);
  36. return 0;
  37. }