saa7115.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. saa7115.h - definition for saa7111/3/4/5 inputs and frequency flags
  3. Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef _SAA7115_H_
  17. #define _SAA7115_H_
  18. /* s_routing inputs, outputs, and config */
  19. /* SAA7111/3/4/5 HW inputs */
  20. #define SAA7115_COMPOSITE0 0
  21. #define SAA7115_COMPOSITE1 1
  22. #define SAA7115_COMPOSITE2 2
  23. #define SAA7115_COMPOSITE3 3
  24. #define SAA7115_COMPOSITE4 4 /* not available for the saa7111/3 */
  25. #define SAA7115_COMPOSITE5 5 /* not available for the saa7111/3 */
  26. #define SAA7115_SVIDEO0 6
  27. #define SAA7115_SVIDEO1 7
  28. #define SAA7115_SVIDEO2 8
  29. #define SAA7115_SVIDEO3 9
  30. /* outputs */
  31. #define SAA7115_IPORT_ON 1
  32. #define SAA7115_IPORT_OFF 0
  33. /* SAA7111 specific outputs. */
  34. #define SAA7111_VBI_BYPASS 2
  35. #define SAA7111_FMT_YUV422 0x00
  36. #define SAA7111_FMT_RGB 0x40
  37. #define SAA7111_FMT_CCIR 0x80
  38. #define SAA7111_FMT_YUV411 0xc0
  39. /* config flags */
  40. /*
  41. * Register 0x85 should set bit 0 to 0 (it's 1 by default). This bit
  42. * controls the IDQ signal polarity which is set to 'inverted' if the bit
  43. * it 1 and to 'default' if it is 0.
  44. */
  45. #define SAA7115_IDQ_IS_DEFAULT (1 << 0)
  46. /* s_crystal_freq values and flags */
  47. /* SAA7115 v4l2_crystal_freq frequency values */
  48. #define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */
  49. #define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */
  50. /* SAA7115 v4l2_crystal_freq audio clock control flags */
  51. #define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
  52. #define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
  53. #define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
  54. #define SAA7115_FREQ_FL_DOUBLE_ASCLK (1 << 3) /* SA 39, LRDIV, SAA7114/5 only */
  55. /* ===== SAA7113 Config enums ===== */
  56. /* Register 0x08 "Horizontal time constant" [Bit 3..4]:
  57. * Should be set to "Fast Locking Mode" according to the datasheet,
  58. * and that is the default setting in the gm7113c_init table.
  59. * saa7113_init sets this value to "VTR Mode". */
  60. enum saa7113_r08_htc {
  61. SAA7113_HTC_TV_MODE = 0x00,
  62. SAA7113_HTC_VTR_MODE, /* Default for saa7113_init */
  63. SAA7113_HTC_FAST_LOCKING_MODE = 0x03 /* Default for gm7113c_init */
  64. };
  65. /* Register 0x10 "Output format selection" [Bit 6..7]:
  66. * Defaults to ITU_656 as specified in datasheet. */
  67. enum saa7113_r10_ofts {
  68. SAA7113_OFTS_ITU_656 = 0x0, /* Default */
  69. SAA7113_OFTS_VFLAG_BY_VREF,
  70. SAA7113_OFTS_VFLAG_BY_DATA_TYPE
  71. };
  72. /*
  73. * Register 0x12 "Output control" [Bit 0..3 Or Bit 4..7]:
  74. * This is used to select what data is output on the RTS0 and RTS1 pins.
  75. * RTS1 [Bit 4..7] Defaults to DOT_IN. (This value can not be set for RTS0)
  76. * RTS0 [Bit 0..3] Defaults to VIPB in gm7113c_init as specified
  77. * in the datasheet, but is set to HREF_HS in the saa7113_init table.
  78. */
  79. enum saa7113_r12_rts {
  80. SAA7113_RTS_DOT_IN = 0, /* OBS: Only for RTS1 (Default RTS1) */
  81. SAA7113_RTS_VIPB, /* Default RTS0 For gm7113c_init */
  82. SAA7113_RTS_GPSW,
  83. SAA7115_RTS_HL,
  84. SAA7113_RTS_VL,
  85. SAA7113_RTS_DL,
  86. SAA7113_RTS_PLIN,
  87. SAA7113_RTS_HREF_HS, /* Default RTS0 For saa7113_init */
  88. SAA7113_RTS_HS,
  89. SAA7113_RTS_HQ,
  90. SAA7113_RTS_ODD,
  91. SAA7113_RTS_VS,
  92. SAA7113_RTS_V123,
  93. SAA7113_RTS_VGATE,
  94. SAA7113_RTS_VREF,
  95. SAA7113_RTS_FID
  96. };
  97. /**
  98. * struct saa7115_platform_data - Allow overriding default initialization
  99. *
  100. * @saa7113_force_gm7113c_init: Force the use of the gm7113c_init table
  101. * instead of saa7113_init table
  102. * (saa7113 only)
  103. * @saa7113_r08_htc: [R_08 - Bit 3..4]
  104. * @saa7113_r10_vrln: [R_10 - Bit 3]
  105. * default: Disabled for gm7113c_init
  106. * Enabled for saa7113c_init
  107. * @saa7113_r10_ofts: [R_10 - Bit 6..7]
  108. * @saa7113_r12_rts0: [R_12 - Bit 0..3]
  109. * @saa7113_r12_rts1: [R_12 - Bit 4..7]
  110. * @saa7113_r13_adlsb: [R_13 - Bit 7] - default: disabled
  111. */
  112. struct saa7115_platform_data {
  113. bool saa7113_force_gm7113c_init;
  114. enum saa7113_r08_htc *saa7113_r08_htc;
  115. bool *saa7113_r10_vrln;
  116. enum saa7113_r10_ofts *saa7113_r10_ofts;
  117. enum saa7113_r12_rts *saa7113_r12_rts0;
  118. enum saa7113_r12_rts *saa7113_r12_rts1;
  119. bool *saa7113_r13_adlsb;
  120. };
  121. #endif