videomode.c 915 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. int videomode_from_timing(const struct display_timings *disp,
  13. struct videomode *vm, unsigned int index)
  14. {
  15. struct display_timing *dt;
  16. dt = display_timings_get(disp, index);
  17. if (!dt)
  18. return -EINVAL;
  19. vm->pixelclock = dt->pixelclock.typ;
  20. vm->hactive = dt->hactive.typ;
  21. vm->hfront_porch = dt->hfront_porch.typ;
  22. vm->hback_porch = dt->hback_porch.typ;
  23. vm->hsync_len = dt->hsync_len.typ;
  24. vm->vactive = dt->vactive.typ;
  25. vm->vfront_porch = dt->vfront_porch.typ;
  26. vm->vback_porch = dt->vback_porch.typ;
  27. vm->vsync_len = dt->vsync_len.typ;
  28. vm->flags = dt->flags;
  29. return 0;
  30. }
  31. EXPORT_SYMBOL_GPL(videomode_from_timing);