v4l2-fwnode.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * V4L2 fwnode binding parsing library
  3. *
  4. * Copyright (c) 2016 Intel Corporation.
  5. * Author: Sakari Ailus <sakari.ailus@linux.intel.com>
  6. *
  7. * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
  8. * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
  9. *
  10. * Copyright (C) 2012 Renesas Electronics Corp.
  11. * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of version 2 of the GNU General Public License as
  15. * published by the Free Software Foundation.
  16. */
  17. #ifndef _V4L2_FWNODE_H
  18. #define _V4L2_FWNODE_H
  19. #include <linux/errno.h>
  20. #include <linux/fwnode.h>
  21. #include <linux/list.h>
  22. #include <linux/types.h>
  23. #include <media/v4l2-mediabus.h>
  24. struct fwnode_handle;
  25. /**
  26. * struct v4l2_fwnode_bus_mipi_csi2 - MIPI CSI-2 bus data structure
  27. * @flags: media bus (V4L2_MBUS_*) flags
  28. * @data_lanes: an array of physical data lane indexes
  29. * @clock_lane: physical lane index of the clock lane
  30. * @num_data_lanes: number of data lanes
  31. * @lane_polarities: polarity of the lanes. The order is the same of
  32. * the physical lanes.
  33. */
  34. struct v4l2_fwnode_bus_mipi_csi2 {
  35. unsigned int flags;
  36. unsigned char data_lanes[4];
  37. unsigned char clock_lane;
  38. unsigned short num_data_lanes;
  39. bool lane_polarities[5];
  40. };
  41. /**
  42. * struct v4l2_fwnode_bus_parallel - parallel data bus data structure
  43. * @flags: media bus (V4L2_MBUS_*) flags
  44. * @bus_width: bus width in bits
  45. * @data_shift: data shift in bits
  46. */
  47. struct v4l2_fwnode_bus_parallel {
  48. unsigned int flags;
  49. unsigned char bus_width;
  50. unsigned char data_shift;
  51. };
  52. /**
  53. * struct v4l2_fwnode_endpoint - the endpoint data structure
  54. * @base: fwnode endpoint of the v4l2_fwnode
  55. * @bus_type: bus type
  56. * @bus: bus configuration data structure
  57. * @link_frequencies: array of supported link frequencies
  58. * @nr_of_link_frequencies: number of elements in link_frequenccies array
  59. */
  60. struct v4l2_fwnode_endpoint {
  61. struct fwnode_endpoint base;
  62. /*
  63. * Fields below this line will be zeroed by
  64. * v4l2_fwnode_parse_endpoint()
  65. */
  66. enum v4l2_mbus_type bus_type;
  67. union {
  68. struct v4l2_fwnode_bus_parallel parallel;
  69. struct v4l2_fwnode_bus_mipi_csi2 mipi_csi2;
  70. } bus;
  71. u64 *link_frequencies;
  72. unsigned int nr_of_link_frequencies;
  73. };
  74. /**
  75. * struct v4l2_fwnode_link - a link between two endpoints
  76. * @local_node: pointer to device_node of this endpoint
  77. * @local_port: identifier of the port this endpoint belongs to
  78. * @remote_node: pointer to device_node of the remote endpoint
  79. * @remote_port: identifier of the port the remote endpoint belongs to
  80. */
  81. struct v4l2_fwnode_link {
  82. struct fwnode_handle *local_node;
  83. unsigned int local_port;
  84. struct fwnode_handle *remote_node;
  85. unsigned int remote_port;
  86. };
  87. int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
  88. struct v4l2_fwnode_endpoint *vep);
  89. struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(
  90. struct fwnode_handle *fwnode);
  91. void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
  92. int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
  93. struct v4l2_fwnode_link *link);
  94. void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link);
  95. #endif /* _V4L2_FWNODE_H */