stv0367_priv.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * stv0367_priv.h
  4. *
  5. * Driver for ST STV0367 DVB-T & DVB-C demodulator IC.
  6. *
  7. * Copyright (C) ST Microelectronics.
  8. * Copyright (C) 2010,2011 NetUP Inc.
  9. * Copyright (C) 2010,2011 Igor M. Liplianin <liplianin@netup.ru>
  10. */
  11. /* Common driver error constants */
  12. #ifndef STV0367_PRIV_H
  13. #define STV0367_PRIV_H
  14. #ifndef TRUE
  15. #define TRUE (1 == 1)
  16. #endif
  17. #ifndef FALSE
  18. #define FALSE (!TRUE)
  19. #endif
  20. #ifndef NULL
  21. #define NULL 0
  22. #endif
  23. /* MACRO definitions */
  24. #define MAX(X, Y) ((X) >= (Y) ? (X) : (Y))
  25. #define MIN(X, Y) ((X) <= (Y) ? (X) : (Y))
  26. #define INRANGE(X, Y, Z) \
  27. ((((X) <= (Y)) && ((Y) <= (Z))) || \
  28. (((Z) <= (Y)) && ((Y) <= (X))) ? 1 : 0)
  29. #ifndef MAKEWORD
  30. #define MAKEWORD(X, Y) (((X) << 8) + (Y))
  31. #endif
  32. #define LSB(X) (((X) & 0xff))
  33. #define MSB(Y) (((Y) >> 8) & 0xff)
  34. #define MMSB(Y)(((Y) >> 16) & 0xff)
  35. enum stv0367_ter_signal_type {
  36. FE_TER_NOAGC = 0,
  37. FE_TER_AGCOK = 5,
  38. FE_TER_NOTPS = 6,
  39. FE_TER_TPSOK = 7,
  40. FE_TER_NOSYMBOL = 8,
  41. FE_TER_BAD_CPQ = 9,
  42. FE_TER_PRFOUNDOK = 10,
  43. FE_TER_NOPRFOUND = 11,
  44. FE_TER_LOCKOK = 12,
  45. FE_TER_NOLOCK = 13,
  46. FE_TER_SYMBOLOK = 15,
  47. FE_TER_CPAMPOK = 16,
  48. FE_TER_NOCPAMP = 17,
  49. FE_TER_SWNOK = 18
  50. };
  51. enum stv0367_ts_mode {
  52. STV0367_OUTPUTMODE_DEFAULT,
  53. STV0367_SERIAL_PUNCT_CLOCK,
  54. STV0367_SERIAL_CONT_CLOCK,
  55. STV0367_PARALLEL_PUNCT_CLOCK,
  56. STV0367_DVBCI_CLOCK
  57. };
  58. enum stv0367_clk_pol {
  59. STV0367_CLOCKPOLARITY_DEFAULT,
  60. STV0367_RISINGEDGE_CLOCK,
  61. STV0367_FALLINGEDGE_CLOCK
  62. };
  63. enum stv0367_ter_bw {
  64. FE_TER_CHAN_BW_6M = 6,
  65. FE_TER_CHAN_BW_7M = 7,
  66. FE_TER_CHAN_BW_8M = 8
  67. };
  68. #if 0
  69. enum FE_TER_Rate_TPS {
  70. FE_TER_TPS_1_2 = 0,
  71. FE_TER_TPS_2_3 = 1,
  72. FE_TER_TPS_3_4 = 2,
  73. FE_TER_TPS_5_6 = 3,
  74. FE_TER_TPS_7_8 = 4
  75. };
  76. #endif
  77. enum stv0367_ter_mode {
  78. FE_TER_MODE_2K,
  79. FE_TER_MODE_8K,
  80. FE_TER_MODE_4K
  81. };
  82. #if 0
  83. enum FE_TER_Hierarchy_Alpha {
  84. FE_TER_HIER_ALPHA_NONE, /* Regular modulation */
  85. FE_TER_HIER_ALPHA_1, /* Hierarchical modulation a = 1*/
  86. FE_TER_HIER_ALPHA_2, /* Hierarchical modulation a = 2*/
  87. FE_TER_HIER_ALPHA_4 /* Hierarchical modulation a = 4*/
  88. };
  89. #endif
  90. enum stv0367_ter_hierarchy {
  91. FE_TER_HIER_NONE, /*Hierarchy None*/
  92. FE_TER_HIER_LOW_PRIO, /*Hierarchy : Low Priority*/
  93. FE_TER_HIER_HIGH_PRIO, /*Hierarchy : High Priority*/
  94. FE_TER_HIER_PRIO_ANY /*Hierarchy :Any*/
  95. };
  96. #if 0
  97. enum fe_stv0367_ter_spec {
  98. FE_TER_INVERSION_NONE = 0,
  99. FE_TER_INVERSION = 1,
  100. FE_TER_INVERSION_AUTO = 2,
  101. FE_TER_INVERSION_UNK = 4
  102. };
  103. #endif
  104. enum stv0367_ter_if_iq_mode {
  105. FE_TER_NORMAL_IF_TUNER = 0,
  106. FE_TER_LONGPATH_IF_TUNER = 1,
  107. FE_TER_IQ_TUNER = 2
  108. };
  109. #if 0
  110. enum FE_TER_FECRate {
  111. FE_TER_FEC_NONE = 0x00, /* no FEC rate specified */
  112. FE_TER_FEC_ALL = 0xFF, /* Logical OR of all FECs */
  113. FE_TER_FEC_1_2 = 1,
  114. FE_TER_FEC_2_3 = (1 << 1),
  115. FE_TER_FEC_3_4 = (1 << 2),
  116. FE_TER_FEC_4_5 = (1 << 3),
  117. FE_TER_FEC_5_6 = (1 << 4),
  118. FE_TER_FEC_6_7 = (1 << 5),
  119. FE_TER_FEC_7_8 = (1 << 6),
  120. FE_TER_FEC_8_9 = (1 << 7)
  121. };
  122. enum FE_TER_Rate {
  123. FE_TER_FE_1_2 = 0,
  124. FE_TER_FE_2_3 = 1,
  125. FE_TER_FE_3_4 = 2,
  126. FE_TER_FE_5_6 = 3,
  127. FE_TER_FE_6_7 = 4,
  128. FE_TER_FE_7_8 = 5
  129. };
  130. #endif
  131. enum stv0367_ter_force {
  132. FE_TER_FORCENONE = 0,
  133. FE_TER_FORCE_M_G = 1
  134. };
  135. enum stv0367cab_mod {
  136. FE_CAB_MOD_QAM4,
  137. FE_CAB_MOD_QAM16,
  138. FE_CAB_MOD_QAM32,
  139. FE_CAB_MOD_QAM64,
  140. FE_CAB_MOD_QAM128,
  141. FE_CAB_MOD_QAM256,
  142. FE_CAB_MOD_QAM512,
  143. FE_CAB_MOD_QAM1024
  144. };
  145. #if 0
  146. enum {
  147. FE_CAB_FEC_A = 1, /* J83 Annex A */
  148. FE_CAB_FEC_B = (1 << 1),/* J83 Annex B */
  149. FE_CAB_FEC_C = (1 << 2) /* J83 Annex C */
  150. } FE_CAB_FECType_t;
  151. #endif
  152. struct stv0367_cab_signal_info {
  153. int locked;
  154. u32 frequency; /* kHz */
  155. u32 symbol_rate; /* Mbds */
  156. enum stv0367cab_mod modulation;
  157. enum fe_spectral_inversion spect_inv;
  158. s32 Power_dBmx10; /* Power of the RF signal (dBm x 10) */
  159. u32 CN_dBx10; /* Carrier to noise ratio (dB x 10) */
  160. u32 BER; /* Bit error rate (x 10000000) */
  161. };
  162. enum stv0367_cab_signal_type {
  163. FE_CAB_NOTUNER,
  164. FE_CAB_NOAGC,
  165. FE_CAB_NOSIGNAL,
  166. FE_CAB_NOTIMING,
  167. FE_CAB_TIMINGOK,
  168. FE_CAB_NOCARRIER,
  169. FE_CAB_CARRIEROK,
  170. FE_CAB_NOBLIND,
  171. FE_CAB_BLINDOK,
  172. FE_CAB_NODEMOD,
  173. FE_CAB_DEMODOK,
  174. FE_CAB_DATAOK
  175. };
  176. #endif