adv7604.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * adv7604 - Analog Devices ADV7604 video decoder driver
  3. *
  4. * Copyright 2012 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 _ADV7604_
  21. #define _ADV7604_
  22. #include <linux/types.h>
  23. /* Analog input muxing modes (AFE register 0x02, [2:0]) */
  24. enum adv7604_ain_sel {
  25. ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
  26. ADV7604_AIN4_5_6_NC_SYNC_2_1 = 1,
  27. ADV7604_AIN7_8_9_NC_SYNC_3_1 = 2,
  28. ADV7604_AIN10_11_12_NC_SYNC_4_1 = 3,
  29. ADV7604_AIN9_4_5_6_SYNC_2_1 = 4,
  30. };
  31. /*
  32. * Bus rotation and reordering. This is used to specify component reordering on
  33. * the board and describes the components order on the bus when the ADV7604
  34. * outputs RGB.
  35. */
  36. enum adv7604_bus_order {
  37. ADV7604_BUS_ORDER_RGB, /* No operation */
  38. ADV7604_BUS_ORDER_GRB, /* Swap 1-2 */
  39. ADV7604_BUS_ORDER_RBG, /* Swap 2-3 */
  40. ADV7604_BUS_ORDER_BGR, /* Swap 1-3 */
  41. ADV7604_BUS_ORDER_BRG, /* Rotate right */
  42. ADV7604_BUS_ORDER_GBR, /* Rotate left */
  43. };
  44. /* Input Color Space (IO register 0x02, [7:4]) */
  45. enum adv7604_inp_color_space {
  46. ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
  47. ADV7604_INP_COLOR_SPACE_FULL_RGB = 1,
  48. ADV7604_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
  49. ADV7604_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
  50. ADV7604_INP_COLOR_SPACE_XVYCC_601 = 4,
  51. ADV7604_INP_COLOR_SPACE_XVYCC_709 = 5,
  52. ADV7604_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
  53. ADV7604_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
  54. ADV7604_INP_COLOR_SPACE_AUTO = 0xf,
  55. };
  56. /* Select output format (IO register 0x03, [4:2]) */
  57. enum adv7604_op_format_mode_sel {
  58. ADV7604_OP_FORMAT_MODE0 = 0x00,
  59. ADV7604_OP_FORMAT_MODE1 = 0x04,
  60. ADV7604_OP_FORMAT_MODE2 = 0x08,
  61. };
  62. enum adv7604_drive_strength {
  63. ADV7604_DR_STR_MEDIUM_LOW = 1,
  64. ADV7604_DR_STR_MEDIUM_HIGH = 2,
  65. ADV7604_DR_STR_HIGH = 3,
  66. };
  67. enum adv7604_int1_config {
  68. ADV7604_INT1_CONFIG_OPEN_DRAIN,
  69. ADV7604_INT1_CONFIG_ACTIVE_LOW,
  70. ADV7604_INT1_CONFIG_ACTIVE_HIGH,
  71. ADV7604_INT1_CONFIG_DISABLED,
  72. };
  73. enum adv7604_page {
  74. ADV7604_PAGE_IO,
  75. ADV7604_PAGE_AVLINK,
  76. ADV7604_PAGE_CEC,
  77. ADV7604_PAGE_INFOFRAME,
  78. ADV7604_PAGE_ESDP,
  79. ADV7604_PAGE_DPP,
  80. ADV7604_PAGE_AFE,
  81. ADV7604_PAGE_REP,
  82. ADV7604_PAGE_EDID,
  83. ADV7604_PAGE_HDMI,
  84. ADV7604_PAGE_TEST,
  85. ADV7604_PAGE_CP,
  86. ADV7604_PAGE_VDP,
  87. ADV7604_PAGE_MAX,
  88. };
  89. /* Platform dependent definition */
  90. struct adv7604_platform_data {
  91. /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
  92. unsigned disable_pwrdnb:1;
  93. /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
  94. unsigned disable_cable_det_rst:1;
  95. int default_input;
  96. /* Analog input muxing mode */
  97. enum adv7604_ain_sel ain_sel;
  98. /* Bus rotation and reordering */
  99. enum adv7604_bus_order bus_order;
  100. /* Select output format mode */
  101. enum adv7604_op_format_mode_sel op_format_mode_sel;
  102. /* Configuration of the INT1 pin */
  103. enum adv7604_int1_config int1_config;
  104. /* IO register 0x02 */
  105. unsigned alt_gamma:1;
  106. unsigned op_656_range:1;
  107. unsigned alt_data_sat:1;
  108. /* IO register 0x05 */
  109. unsigned blank_data:1;
  110. unsigned insert_av_codes:1;
  111. unsigned replicate_av_codes:1;
  112. /* IO register 0x06 */
  113. unsigned inv_vs_pol:1;
  114. unsigned inv_hs_pol:1;
  115. unsigned inv_llc_pol:1;
  116. /* IO register 0x14 */
  117. enum adv7604_drive_strength dr_str_data;
  118. enum adv7604_drive_strength dr_str_clk;
  119. enum adv7604_drive_strength dr_str_sync;
  120. /* IO register 0x30 */
  121. unsigned output_bus_lsb_to_msb:1;
  122. /* Free run */
  123. unsigned hdmi_free_run_mode;
  124. /* i2c addresses: 0 == use default */
  125. u8 i2c_addresses[ADV7604_PAGE_MAX];
  126. };
  127. enum adv7604_pad {
  128. ADV7604_PAD_HDMI_PORT_A = 0,
  129. ADV7604_PAD_HDMI_PORT_B = 1,
  130. ADV7604_PAD_HDMI_PORT_C = 2,
  131. ADV7604_PAD_HDMI_PORT_D = 3,
  132. ADV7604_PAD_VGA_RGB = 4,
  133. ADV7604_PAD_VGA_COMP = 5,
  134. /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */
  135. ADV7604_PAD_SOURCE = 6,
  136. ADV7611_PAD_SOURCE = 1,
  137. ADV7604_PAD_MAX = 7,
  138. };
  139. #define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
  140. #define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
  141. #define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
  142. /* notify events */
  143. #define ADV7604_HOTPLUG 1
  144. #define ADV7604_FMT_CHANGE 2
  145. #endif