v4l2-of.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * V4L2 OF binding parsing library
  3. *
  4. * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
  5. * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
  6. *
  7. * Copyright (C) 2012 Renesas Electronics Corp.
  8. * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef _V4L2_OF_H
  15. #define _V4L2_OF_H
  16. #include <linux/list.h>
  17. #include <linux/types.h>
  18. #include <linux/errno.h>
  19. #include <linux/of_graph.h>
  20. #include <media/v4l2-mediabus.h>
  21. struct device_node;
  22. /**
  23. * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure
  24. * @flags: media bus (V4L2_MBUS_*) flags
  25. * @data_lanes: an array of physical data lane indexes
  26. * @clock_lane: physical lane index of the clock lane
  27. * @num_data_lanes: number of data lanes
  28. * @lane_polarities: polarity of the lanes. The order is the same of
  29. * the physical lanes.
  30. */
  31. struct v4l2_of_bus_mipi_csi2 {
  32. unsigned int flags;
  33. unsigned char data_lanes[4];
  34. unsigned char clock_lane;
  35. unsigned short num_data_lanes;
  36. bool lane_polarities[5];
  37. };
  38. /**
  39. * struct v4l2_of_bus_parallel - parallel data bus data structure
  40. * @flags: media bus (V4L2_MBUS_*) flags
  41. * @bus_width: bus width in bits
  42. * @data_shift: data shift in bits
  43. */
  44. struct v4l2_of_bus_parallel {
  45. unsigned int flags;
  46. unsigned char bus_width;
  47. unsigned char data_shift;
  48. };
  49. /**
  50. * struct v4l2_of_endpoint - the endpoint data structure
  51. * @base: struct of_endpoint containing port, id, and local of_node
  52. * @bus_type: bus type
  53. * @bus: bus configuration data structure
  54. * @head: list head for this structure
  55. */
  56. struct v4l2_of_endpoint {
  57. struct of_endpoint base;
  58. enum v4l2_mbus_type bus_type;
  59. union {
  60. struct v4l2_of_bus_parallel parallel;
  61. struct v4l2_of_bus_mipi_csi2 mipi_csi2;
  62. } bus;
  63. struct list_head head;
  64. };
  65. #ifdef CONFIG_OF
  66. int v4l2_of_parse_endpoint(const struct device_node *node,
  67. struct v4l2_of_endpoint *endpoint);
  68. #else /* CONFIG_OF */
  69. static inline int v4l2_of_parse_endpoint(const struct device_node *node,
  70. struct v4l2_of_endpoint *link)
  71. {
  72. return -ENOSYS;
  73. }
  74. #endif /* CONFIG_OF */
  75. #endif /* _V4L2_OF_H */