v4l2-dv-timings.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * v4l2-dv-timings - Internal header with dv-timings helper functions
  3. *
  4. * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
  5. *
  6. * This program is free software; you may redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  13. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  14. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  15. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. * SOFTWARE.
  18. *
  19. */
  20. #ifndef __V4L2_DV_TIMINGS_H
  21. #define __V4L2_DV_TIMINGS_H
  22. #include <linux/videodev2.h>
  23. /** v4l2_dv_valid_timings() - are these timings valid?
  24. * @t: the v4l2_dv_timings struct.
  25. * @cap: the v4l2_dv_timings_cap capabilities.
  26. *
  27. * Returns true if the given dv_timings struct is supported by the
  28. * hardware capabilities, returns false otherwise.
  29. */
  30. bool v4l2_dv_valid_timings(const struct v4l2_dv_timings *t,
  31. const struct v4l2_dv_timings_cap *cap);
  32. /** v4l2_enum_dv_timings_cap() - Helper function to enumerate possible DV timings based on capabilities
  33. * @t: the v4l2_enum_dv_timings struct.
  34. * @cap: the v4l2_dv_timings_cap capabilities.
  35. *
  36. * This enumerates dv_timings using the full list of possible CEA-861 and DMT
  37. * timings, filtering out any timings that are not supported based on the
  38. * hardware capabilities.
  39. *
  40. * If a valid timing for the given index is found, it will fill in @t and
  41. * return 0, otherwise it returns -EINVAL.
  42. */
  43. int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *t,
  44. const struct v4l2_dv_timings_cap *cap);
  45. /** v4l2_find_dv_timings_cap() - Find the closest timings struct
  46. * @t: the v4l2_enum_dv_timings struct.
  47. * @cap: the v4l2_dv_timings_cap capabilities.
  48. * @pclock_delta: maximum delta between t->pixelclock and the timing struct
  49. * under consideration.
  50. *
  51. * This function tries to map the given timings to an entry in the
  52. * full list of possible CEA-861 and DMT timings, filtering out any timings
  53. * that are not supported based on the hardware capabilities.
  54. *
  55. * On success it will fill in @t with the found timings and it returns true.
  56. * On failure it will return false.
  57. */
  58. bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
  59. const struct v4l2_dv_timings_cap *cap,
  60. unsigned pclock_delta);
  61. #endif