tc358743.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * tc358743 - Toshiba HDMI to CSI-2 bridge
  3. *
  4. * Copyright 2015 Cisco Systems, Inc. and/or its affiliates. All rights
  5. * reserved.
  6. *
  7. * This program is free software; you may redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  12. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  14. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  15. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  16. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. * SOFTWARE.
  19. *
  20. */
  21. /*
  22. * References (c = chapter, p = page):
  23. * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60
  24. * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls
  25. */
  26. #ifndef _TC358743_
  27. #define _TC358743_
  28. enum tc358743_ddc5v_delays {
  29. DDC5V_DELAY_0_MS,
  30. DDC5V_DELAY_50_MS,
  31. DDC5V_DELAY_100_MS,
  32. DDC5V_DELAY_200_MS,
  33. };
  34. enum tc358743_hdmi_detection_delay {
  35. HDMI_MODE_DELAY_0_MS,
  36. HDMI_MODE_DELAY_25_MS,
  37. HDMI_MODE_DELAY_50_MS,
  38. HDMI_MODE_DELAY_100_MS,
  39. };
  40. struct tc358743_platform_data {
  41. /* System clock connected to REFCLK (pin H5) */
  42. u32 refclk_hz; /* 26 MHz, 27 MHz or 42 MHz */
  43. /* DDC +5V debounce delay to avoid spurious interrupts when the cable
  44. * is connected.
  45. * Sets DDC5V_MODE in register DDC_CTL.
  46. * Default: DDC5V_DELAY_0_MS
  47. */
  48. enum tc358743_ddc5v_delays ddc5v_delay;
  49. bool enable_hdcp;
  50. /*
  51. * The FIFO size is 512x32, so Toshiba recommend to set the default FIFO
  52. * level to somewhere in the middle (e.g. 300), so it can cover speed
  53. * mismatches in input and output ports.
  54. */
  55. u16 fifo_level;
  56. /* Bps pr lane is (refclk_hz / pll_prd) * pll_fbd */
  57. u16 pll_prd;
  58. u16 pll_fbd;
  59. /* CSI
  60. * Calculate CSI parameters with REF_02 for the highest resolution your
  61. * CSI interface can handle. The driver will adjust the number of CSI
  62. * lanes in use according to the pixel clock.
  63. *
  64. * The values in brackets are calculated with REF_02 when the number of
  65. * bps pr lane is 823.5 MHz, and can serve as a starting point.
  66. */
  67. u32 lineinitcnt; /* (0x00001770) */
  68. u32 lptxtimecnt; /* (0x00000005) */
  69. u32 tclk_headercnt; /* (0x00001d04) */
  70. u32 tclk_trailcnt; /* (0x00000000) */
  71. u32 ths_headercnt; /* (0x00000505) */
  72. u32 twakeup; /* (0x00004650) */
  73. u32 tclk_postcnt; /* (0x00000000) */
  74. u32 ths_trailcnt; /* (0x00000004) */
  75. u32 hstxvregcnt; /* (0x00000005) */
  76. /* DVI->HDMI detection delay to avoid unnecessary switching between DVI
  77. * and HDMI mode.
  78. * Sets HDMI_DET_V in register HDMI_DET.
  79. * Default: HDMI_MODE_DELAY_0_MS
  80. */
  81. enum tc358743_hdmi_detection_delay hdmi_detection_delay;
  82. /* Reset PHY automatically when TMDS clock goes from DC to AC.
  83. * Sets PHY_AUTO_RST2 in register PHY_CTL2.
  84. * Default: false
  85. */
  86. bool hdmi_phy_auto_reset_tmds_detected;
  87. /* Reset PHY automatically when TMDS clock passes 21 MHz.
  88. * Sets PHY_AUTO_RST3 in register PHY_CTL2.
  89. * Default: false
  90. */
  91. bool hdmi_phy_auto_reset_tmds_in_range;
  92. /* Reset PHY automatically when TMDS clock is detected.
  93. * Sets PHY_AUTO_RST4 in register PHY_CTL2.
  94. * Default: false
  95. */
  96. bool hdmi_phy_auto_reset_tmds_valid;
  97. /* Reset HDMI PHY automatically when hsync period is out of range.
  98. * Sets H_PI_RST in register HV_RST.
  99. * Default: false
  100. */
  101. bool hdmi_phy_auto_reset_hsync_out_of_range;
  102. /* Reset HDMI PHY automatically when vsync period is out of range.
  103. * Sets V_PI_RST in register HV_RST.
  104. * Default: false
  105. */
  106. bool hdmi_phy_auto_reset_vsync_out_of_range;
  107. };
  108. /* custom controls */
  109. /* Audio sample rate in Hz */
  110. #define TC358743_CID_AUDIO_SAMPLING_RATE (V4L2_CID_USER_TC358743_BASE + 0)
  111. /* Audio present status */
  112. #define TC358743_CID_AUDIO_PRESENT (V4L2_CID_USER_TC358743_BASE + 1)
  113. #endif