it913x-fe.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /*
  2. * Driver for it913x Frontend
  3. *
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. *
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
  19. */
  20. #ifndef IT913X_FE_H
  21. #define IT913X_FE_H
  22. #include <linux/dvb/frontend.h>
  23. #include "dvb_frontend.h"
  24. struct ite_config {
  25. u8 chip_ver;
  26. u16 chip_type;
  27. u32 firmware;
  28. u8 firmware_ver;
  29. u8 adc_x2;
  30. u8 tuner_id_0;
  31. u8 tuner_id_1;
  32. u8 dual_mode;
  33. u8 adf;
  34. };
  35. #if defined(CONFIG_DVB_IT913X_FE) || (defined(CONFIG_DVB_IT913X_FE_MODULE) && \
  36. defined(MODULE))
  37. extern struct dvb_frontend *it913x_fe_attach(struct i2c_adapter *i2c_adap,
  38. u8 i2c_addr, struct ite_config *config);
  39. #else
  40. static inline struct dvb_frontend *it913x_fe_attach(
  41. struct i2c_adapter *i2c_adap,
  42. u8 i2c_addr, struct ite_config *config)
  43. {
  44. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  45. return NULL;
  46. }
  47. #endif /* CONFIG_IT913X_FE */
  48. #define I2C_BASE_ADDR 0x10
  49. #define DEV_0 0x0
  50. #define DEV_1 0x10
  51. #define PRO_LINK 0x0
  52. #define PRO_DMOD 0x1
  53. #define DEV_0_DMOD (PRO_DMOD << 0x7)
  54. #define DEV_1_DMOD (DEV_0_DMOD | DEV_1)
  55. #define CHIP2_I2C_ADDR 0x3a
  56. #define AFE_MEM0 0xfb24
  57. #define MP2_SW_RST 0xf99d
  58. #define MP2IF2_SW_RST 0xf9a4
  59. #define PADODPU 0xd827
  60. #define THIRDODPU 0xd828
  61. #define AGC_O_D 0xd829
  62. #define EP0_TX_EN 0xdd11
  63. #define EP0_TX_NAK 0xdd13
  64. #define EP4_TX_LEN_LSB 0xdd88
  65. #define EP4_TX_LEN_MSB 0xdd89
  66. #define EP4_MAX_PKT 0xdd0c
  67. #define EP5_TX_LEN_LSB 0xdd8a
  68. #define EP5_TX_LEN_MSB 0xdd8b
  69. #define EP5_MAX_PKT 0xdd0d
  70. #define IO_MUX_POWER_CLK 0xd800
  71. #define CLK_O_EN 0xd81a
  72. #define I2C_CLK 0xf103
  73. #define I2C_CLK_100 0x7
  74. #define I2C_CLK_400 0x1a
  75. #define D_TPSD_LOCK 0xf5a9
  76. #define MP2IF2_EN 0xf9a3
  77. #define MP2IF_SERIAL 0xf985
  78. #define TSIS_ENABLE 0xf9cd
  79. #define MP2IF2_HALF_PSB 0xf9a5
  80. #define MP2IF_STOP_EN 0xf9b5
  81. #define MPEG_FULL_SPEED 0xf990
  82. #define TOP_HOSTB_SER_MODE 0xd91c
  83. #define PID_RST 0xf992
  84. #define PID_EN 0xf993
  85. #define PID_INX_EN 0xf994
  86. #define PID_INX 0xf995
  87. #define PID_LSB 0xf996
  88. #define PID_MSB 0xf997
  89. #define MP2IF_MPEG_PAR_MODE 0xf986
  90. #define DCA_UPPER_CHIP 0xf731
  91. #define DCA_LOWER_CHIP 0xf732
  92. #define DCA_PLATCH 0xf730
  93. #define DCA_FPGA_LATCH 0xf778
  94. #define DCA_STAND_ALONE 0xf73c
  95. #define DCA_ENABLE 0xf776
  96. #define DVBT_INTEN 0xf41f
  97. #define DVBT_ENABLE 0xf41a
  98. #define HOSTB_DCA_LOWER 0xd91f
  99. #define HOSTB_MPEG_PAR_MODE 0xd91b
  100. #define HOSTB_MPEG_SER_MODE 0xd91c
  101. #define HOSTB_MPEG_SER_DO7 0xd91d
  102. #define HOSTB_DCA_UPPER 0xd91e
  103. #define PADMISCDR2 0xd830
  104. #define PADMISCDR4 0xd831
  105. #define PADMISCDR8 0xd832
  106. #define PADMISCDRSR 0xd833
  107. #define LOCK3_OUT 0xd8fd
  108. #define GPIOH1_O 0xd8af
  109. #define GPIOH1_EN 0xd8b0
  110. #define GPIOH1_ON 0xd8b1
  111. #define GPIOH3_O 0xd8b3
  112. #define GPIOH3_EN 0xd8b4
  113. #define GPIOH3_ON 0xd8b5
  114. #define GPIOH5_O 0xd8bb
  115. #define GPIOH5_EN 0xd8bc
  116. #define GPIOH5_ON 0xd8bd
  117. #define AFE_MEM0 0xfb24
  118. #define REG_TPSD_TX_MODE 0xf900
  119. #define REG_TPSD_GI 0xf901
  120. #define REG_TPSD_HIER 0xf902
  121. #define REG_TPSD_CONST 0xf903
  122. #define REG_BW 0xf904
  123. #define REG_PRIV 0xf905
  124. #define REG_TPSD_HP_CODE 0xf906
  125. #define REG_TPSD_LP_CODE 0xf907
  126. #define MP2IF_SYNC_LK 0xf999
  127. #define ADC_FREQ 0xf1cd
  128. #define TRIGGER_OFSM 0x0000
  129. /* COEFF Registers start at 0x0001 to 0x0020 */
  130. #define COEFF_1_2048 0x0001
  131. #define XTAL_CLK 0x0025
  132. #define BFS_FCW 0x0029
  133. /* Error Regs */
  134. #define RSD_ABORT_PKT_LSB 0x0032
  135. #define RSD_ABORT_PKT_MSB 0x0033
  136. #define RSD_BIT_ERR_0_7 0x0034
  137. #define RSD_BIT_ERR_8_15 0x0035
  138. #define RSD_BIT_ERR_23_16 0x0036
  139. #define RSD_BIT_COUNT_LSB 0x0037
  140. #define RSD_BIT_COUNT_MSB 0x0038
  141. #define TPSD_LOCK 0x003c
  142. #define TRAINING_MODE 0x0040
  143. #define ADC_X_2 0x0045
  144. #define TUNER_ID 0x0046
  145. #define EMPTY_CHANNEL_STATUS 0x0047
  146. #define SIGNAL_LEVEL 0x0048
  147. #define SIGNAL_QUALITY 0x0049
  148. #define EST_SIGNAL_LEVEL 0x004a
  149. #define FREE_BAND 0x004b
  150. #define SUSPEND_FLAG 0x004c
  151. /* Build in tuner types */
  152. #define IT9137 0x38
  153. #define IT9135_38 0x38
  154. #define IT9135_51 0x51
  155. #define IT9135_52 0x52
  156. #define IT9135_60 0x60
  157. #define IT9135_61 0x61
  158. #define IT9135_62 0x62
  159. enum {
  160. CMD_DEMOD_READ = 0,
  161. CMD_DEMOD_WRITE,
  162. CMD_TUNER_READ,
  163. CMD_TUNER_WRITE,
  164. CMD_REG_EEPROM_READ,
  165. CMD_REG_EEPROM_WRITE,
  166. CMD_DATA_READ,
  167. CMD_VAR_READ = 8,
  168. CMD_VAR_WRITE,
  169. CMD_PLATFORM_GET,
  170. CMD_PLATFORM_SET,
  171. CMD_IP_CACHE,
  172. CMD_IP_ADD,
  173. CMD_IP_REMOVE,
  174. CMD_PID_ADD,
  175. CMD_PID_REMOVE,
  176. CMD_SIPSI_GET,
  177. CMD_SIPSI_MPE_RESET,
  178. CMD_H_PID_ADD = 0x15,
  179. CMD_H_PID_REMOVE,
  180. CMD_ABORT,
  181. CMD_IR_GET,
  182. CMD_IR_SET,
  183. CMD_FW_DOWNLOAD = 0x21,
  184. CMD_QUERYINFO,
  185. CMD_BOOT,
  186. CMD_FW_DOWNLOAD_BEGIN,
  187. CMD_FW_DOWNLOAD_END,
  188. CMD_RUN_CODE,
  189. CMD_SCATTER_READ = 0x28,
  190. CMD_SCATTER_WRITE,
  191. CMD_GENERIC_READ,
  192. CMD_GENERIC_WRITE
  193. };
  194. enum {
  195. READ_LONG,
  196. WRITE_LONG,
  197. READ_SHORT,
  198. WRITE_SHORT,
  199. READ_DATA,
  200. WRITE_DATA,
  201. WRITE_CMD,
  202. };
  203. enum {
  204. IT9135_AUTO = 0,
  205. IT9137_FW,
  206. IT9135_V1_FW,
  207. IT9135_V2_FW,
  208. };
  209. #endif /* IT913X_FE_H */