omap3isp.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * omap3isp.h
  3. *
  4. * TI OMAP3 ISP - Platform data
  5. *
  6. * Copyright (C) 2011 Nokia Corporation
  7. *
  8. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  9. * Sakari Ailus <sakari.ailus@iki.fi>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  23. * 02110-1301 USA
  24. */
  25. #ifndef __MEDIA_OMAP3ISP_H__
  26. #define __MEDIA_OMAP3ISP_H__
  27. struct i2c_board_info;
  28. struct isp_device;
  29. enum isp_interface_type {
  30. ISP_INTERFACE_PARALLEL,
  31. ISP_INTERFACE_CSI2A_PHY2,
  32. ISP_INTERFACE_CCP2B_PHY1,
  33. ISP_INTERFACE_CCP2B_PHY2,
  34. ISP_INTERFACE_CSI2C_PHY1,
  35. };
  36. enum {
  37. ISP_LANE_SHIFT_0 = 0,
  38. ISP_LANE_SHIFT_2 = 1,
  39. ISP_LANE_SHIFT_4 = 2,
  40. ISP_LANE_SHIFT_6 = 3,
  41. };
  42. /**
  43. * struct isp_parallel_cfg - Parallel interface configuration
  44. * @data_lane_shift: Data lane shifter
  45. * ISP_LANE_SHIFT_0 - CAMEXT[13:0] -> CAM[13:0]
  46. * ISP_LANE_SHIFT_2 - CAMEXT[13:2] -> CAM[11:0]
  47. * ISP_LANE_SHIFT_4 - CAMEXT[13:4] -> CAM[9:0]
  48. * ISP_LANE_SHIFT_6 - CAMEXT[13:6] -> CAM[7:0]
  49. * @clk_pol: Pixel clock polarity
  50. * 0 - Sample on rising edge, 1 - Sample on falling edge
  51. * @hs_pol: Horizontal synchronization polarity
  52. * 0 - Active high, 1 - Active low
  53. * @vs_pol: Vertical synchronization polarity
  54. * 0 - Active high, 1 - Active low
  55. * @fld_pol: Field signal polarity
  56. * 0 - Positive, 1 - Negative
  57. * @data_pol: Data polarity
  58. * 0 - Normal, 1 - One's complement
  59. */
  60. struct isp_parallel_cfg {
  61. unsigned int data_lane_shift:2;
  62. unsigned int clk_pol:1;
  63. unsigned int hs_pol:1;
  64. unsigned int vs_pol:1;
  65. unsigned int fld_pol:1;
  66. unsigned int data_pol:1;
  67. };
  68. enum {
  69. ISP_CCP2_PHY_DATA_CLOCK = 0,
  70. ISP_CCP2_PHY_DATA_STROBE = 1,
  71. };
  72. enum {
  73. ISP_CCP2_MODE_MIPI = 0,
  74. ISP_CCP2_MODE_CCP2 = 1,
  75. };
  76. /**
  77. * struct isp_csiphy_lane: CCP2/CSI2 lane position and polarity
  78. * @pos: position of the lane
  79. * @pol: polarity of the lane
  80. */
  81. struct isp_csiphy_lane {
  82. u8 pos;
  83. u8 pol;
  84. };
  85. #define ISP_CSIPHY1_NUM_DATA_LANES 1
  86. #define ISP_CSIPHY2_NUM_DATA_LANES 2
  87. /**
  88. * struct isp_csiphy_lanes_cfg - CCP2/CSI2 lane configuration
  89. * @data: Configuration of one or two data lanes
  90. * @clk: Clock lane configuration
  91. */
  92. struct isp_csiphy_lanes_cfg {
  93. struct isp_csiphy_lane data[ISP_CSIPHY2_NUM_DATA_LANES];
  94. struct isp_csiphy_lane clk;
  95. };
  96. /**
  97. * struct isp_ccp2_cfg - CCP2 interface configuration
  98. * @strobe_clk_pol: Strobe/clock polarity
  99. * 0 - Non Inverted, 1 - Inverted
  100. * @crc: Enable the cyclic redundancy check
  101. * @ccp2_mode: Enable CCP2 compatibility mode
  102. * ISP_CCP2_MODE_MIPI - MIPI-CSI1 mode
  103. * ISP_CCP2_MODE_CCP2 - CCP2 mode
  104. * @phy_layer: Physical layer selection
  105. * ISP_CCP2_PHY_DATA_CLOCK - Data/clock physical layer
  106. * ISP_CCP2_PHY_DATA_STROBE - Data/strobe physical layer
  107. * @vpclk_div: Video port output clock control
  108. */
  109. struct isp_ccp2_cfg {
  110. unsigned int strobe_clk_pol:1;
  111. unsigned int crc:1;
  112. unsigned int ccp2_mode:1;
  113. unsigned int phy_layer:1;
  114. unsigned int vpclk_div:2;
  115. struct isp_csiphy_lanes_cfg lanecfg;
  116. };
  117. /**
  118. * struct isp_csi2_cfg - CSI2 interface configuration
  119. * @crc: Enable the cyclic redundancy check
  120. */
  121. struct isp_csi2_cfg {
  122. unsigned crc:1;
  123. struct isp_csiphy_lanes_cfg lanecfg;
  124. };
  125. struct isp_bus_cfg {
  126. enum isp_interface_type interface;
  127. union {
  128. struct isp_parallel_cfg parallel;
  129. struct isp_ccp2_cfg ccp2;
  130. struct isp_csi2_cfg csi2;
  131. } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
  132. };
  133. struct isp_platform_subdev {
  134. struct i2c_board_info *board_info;
  135. int i2c_adapter_id;
  136. struct isp_bus_cfg *bus;
  137. };
  138. struct isp_platform_data {
  139. struct isp_platform_subdev *subdevs;
  140. void (*set_constraints)(struct isp_device *isp, bool enable);
  141. };
  142. #endif /* __MEDIA_OMAP3ISP_H__ */