v4l2-of.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. */
  29. struct v4l2_of_bus_mipi_csi2 {
  30. unsigned int flags;
  31. unsigned char data_lanes[4];
  32. unsigned char clock_lane;
  33. unsigned short num_data_lanes;
  34. };
  35. /**
  36. * struct v4l2_of_bus_parallel - parallel data bus data structure
  37. * @flags: media bus (V4L2_MBUS_*) flags
  38. * @bus_width: bus width in bits
  39. * @data_shift: data shift in bits
  40. */
  41. struct v4l2_of_bus_parallel {
  42. unsigned int flags;
  43. unsigned char bus_width;
  44. unsigned char data_shift;
  45. };
  46. /**
  47. * struct v4l2_of_endpoint - the endpoint data structure
  48. * @base: struct of_endpoint containing port, id, and local of_node
  49. * @bus_type: bus type
  50. * @bus: bus configuration data structure
  51. * @head: list head for this structure
  52. */
  53. struct v4l2_of_endpoint {
  54. struct of_endpoint base;
  55. enum v4l2_mbus_type bus_type;
  56. union {
  57. struct v4l2_of_bus_parallel parallel;
  58. struct v4l2_of_bus_mipi_csi2 mipi_csi2;
  59. } bus;
  60. struct list_head head;
  61. };
  62. #ifdef CONFIG_OF
  63. int v4l2_of_parse_endpoint(const struct device_node *node,
  64. struct v4l2_of_endpoint *endpoint);
  65. #else /* CONFIG_OF */
  66. static inline int v4l2_of_parse_endpoint(const struct device_node *node,
  67. struct v4l2_of_endpoint *link)
  68. {
  69. return -ENOSYS;
  70. }
  71. #endif /* CONFIG_OF */
  72. #endif /* _V4L2_OF_H */