tc358743.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * tc358743 - Toshiba HDMI to CSI-2 bridge
  4. *
  5. * Copyright 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
  6. */
  7. /*
  8. * References (c = chapter, p = page):
  9. * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60
  10. * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls
  11. */
  12. #ifndef _TC358743_
  13. #define _TC358743_
  14. enum tc358743_ddc5v_delays {
  15. DDC5V_DELAY_0_MS,
  16. DDC5V_DELAY_50_MS,
  17. DDC5V_DELAY_100_MS,
  18. DDC5V_DELAY_200_MS,
  19. };
  20. enum tc358743_hdmi_detection_delay {
  21. HDMI_MODE_DELAY_0_MS,
  22. HDMI_MODE_DELAY_25_MS,
  23. HDMI_MODE_DELAY_50_MS,
  24. HDMI_MODE_DELAY_100_MS,
  25. };
  26. struct tc358743_platform_data {
  27. /* System clock connected to REFCLK (pin H5) */
  28. u32 refclk_hz; /* 26 MHz, 27 MHz or 42 MHz */
  29. /* DDC +5V debounce delay to avoid spurious interrupts when the cable
  30. * is connected.
  31. * Sets DDC5V_MODE in register DDC_CTL.
  32. * Default: DDC5V_DELAY_0_MS
  33. */
  34. enum tc358743_ddc5v_delays ddc5v_delay;
  35. bool enable_hdcp;
  36. /*
  37. * The FIFO size is 512x32, so Toshiba recommend to set the default FIFO
  38. * level to somewhere in the middle (e.g. 300), so it can cover speed
  39. * mismatches in input and output ports.
  40. */
  41. u16 fifo_level;
  42. /* Bps pr lane is (refclk_hz / pll_prd) * pll_fbd */
  43. u16 pll_prd;
  44. u16 pll_fbd;
  45. /* CSI
  46. * Calculate CSI parameters with REF_02 for the highest resolution your
  47. * CSI interface can handle. The driver will adjust the number of CSI
  48. * lanes in use according to the pixel clock.
  49. *
  50. * The values in brackets are calculated with REF_02 when the number of
  51. * bps pr lane is 823.5 MHz, and can serve as a starting point.
  52. */
  53. u32 lineinitcnt; /* (0x00001770) */
  54. u32 lptxtimecnt; /* (0x00000005) */
  55. u32 tclk_headercnt; /* (0x00001d04) */
  56. u32 tclk_trailcnt; /* (0x00000000) */
  57. u32 ths_headercnt; /* (0x00000505) */
  58. u32 twakeup; /* (0x00004650) */
  59. u32 tclk_postcnt; /* (0x00000000) */
  60. u32 ths_trailcnt; /* (0x00000004) */
  61. u32 hstxvregcnt; /* (0x00000005) */
  62. /* DVI->HDMI detection delay to avoid unnecessary switching between DVI
  63. * and HDMI mode.
  64. * Sets HDMI_DET_V in register HDMI_DET.
  65. * Default: HDMI_MODE_DELAY_0_MS
  66. */
  67. enum tc358743_hdmi_detection_delay hdmi_detection_delay;
  68. /* Reset PHY automatically when TMDS clock goes from DC to AC.
  69. * Sets PHY_AUTO_RST2 in register PHY_CTL2.
  70. * Default: false
  71. */
  72. bool hdmi_phy_auto_reset_tmds_detected;
  73. /* Reset PHY automatically when TMDS clock passes 21 MHz.
  74. * Sets PHY_AUTO_RST3 in register PHY_CTL2.
  75. * Default: false
  76. */
  77. bool hdmi_phy_auto_reset_tmds_in_range;
  78. /* Reset PHY automatically when TMDS clock is detected.
  79. * Sets PHY_AUTO_RST4 in register PHY_CTL2.
  80. * Default: false
  81. */
  82. bool hdmi_phy_auto_reset_tmds_valid;
  83. /* Reset HDMI PHY automatically when hsync period is out of range.
  84. * Sets H_PI_RST in register HV_RST.
  85. * Default: false
  86. */
  87. bool hdmi_phy_auto_reset_hsync_out_of_range;
  88. /* Reset HDMI PHY automatically when vsync period is out of range.
  89. * Sets V_PI_RST in register HV_RST.
  90. * Default: false
  91. */
  92. bool hdmi_phy_auto_reset_vsync_out_of_range;
  93. };
  94. /* custom controls */
  95. /* Audio sample rate in Hz */
  96. #define TC358743_CID_AUDIO_SAMPLING_RATE (V4L2_CID_USER_TC358743_BASE + 0)
  97. /* Audio present status */
  98. #define TC358743_CID_AUDIO_PRESENT (V4L2_CID_USER_TC358743_BASE + 1)
  99. #endif