videomode.c 1.1 KB

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