videomode.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * generic display timing functions
  4. *
  5. * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix
  6. */
  7. #include <linux/errno.h>
  8. #include <linux/export.h>
  9. #include <video/display_timing.h>
  10. #include <video/videomode.h>
  11. void videomode_from_timing(const struct display_timing *dt,
  12. struct videomode *vm)
  13. {
  14. vm->pixelclock = dt->pixelclock.typ;
  15. vm->hactive = dt->hactive.typ;
  16. vm->hfront_porch = dt->hfront_porch.typ;
  17. vm->hback_porch = dt->hback_porch.typ;
  18. vm->hsync_len = dt->hsync_len.typ;
  19. vm->vactive = dt->vactive.typ;
  20. vm->vfront_porch = dt->vfront_porch.typ;
  21. vm->vback_porch = dt->vback_porch.typ;
  22. vm->vsync_len = dt->vsync_len.typ;
  23. vm->flags = dt->flags;
  24. }
  25. EXPORT_SYMBOL_GPL(videomode_from_timing);
  26. int videomode_from_timings(const struct display_timings *disp,
  27. struct videomode *vm, unsigned int index)
  28. {
  29. struct display_timing *dt;
  30. dt = display_timings_get(disp, index);
  31. if (!dt)
  32. return -EINVAL;
  33. videomode_from_timing(dt, vm);
  34. return 0;
  35. }
  36. EXPORT_SYMBOL_GPL(videomode_from_timings);