it913x-fe.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. /* option to read SIGNAL_LEVEL */
  35. u8 read_slevel;
  36. };
  37. #if defined(CONFIG_DVB_IT913X_FE) || (defined(CONFIG_DVB_IT913X_FE_MODULE) && \
  38. defined(MODULE))
  39. extern struct dvb_frontend *it913x_fe_attach(struct i2c_adapter *i2c_adap,
  40. u8 i2c_addr, struct ite_config *config);
  41. #else
  42. static inline struct dvb_frontend *it913x_fe_attach(
  43. struct i2c_adapter *i2c_adap,
  44. u8 i2c_addr, struct ite_config *config)
  45. {
  46. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  47. return NULL;
  48. }
  49. #endif /* CONFIG_IT913X_FE */
  50. #define I2C_BASE_ADDR 0x10
  51. #define DEV_0 0x0
  52. #define DEV_1 0x10
  53. #define PRO_LINK 0x0
  54. #define PRO_DMOD 0x1
  55. #define DEV_0_DMOD (PRO_DMOD << 0x7)
  56. #define DEV_1_DMOD (DEV_0_DMOD | DEV_1)
  57. #define CHIP2_I2C_ADDR 0x3a
  58. #define AFE_MEM0 0xfb24
  59. #define MP2_SW_RST 0xf99d
  60. #define MP2IF2_SW_RST 0xf9a4
  61. #define PADODPU 0xd827
  62. #define THIRDODPU 0xd828
  63. #define AGC_O_D 0xd829
  64. #define EP0_TX_EN 0xdd11
  65. #define EP0_TX_NAK 0xdd13
  66. #define EP4_TX_LEN_LSB 0xdd88
  67. #define EP4_TX_LEN_MSB 0xdd89
  68. #define EP4_MAX_PKT 0xdd0c
  69. #define EP5_TX_LEN_LSB 0xdd8a
  70. #define EP5_TX_LEN_MSB 0xdd8b
  71. #define EP5_MAX_PKT 0xdd0d
  72. #define IO_MUX_POWER_CLK 0xd800
  73. #define CLK_O_EN 0xd81a
  74. #define I2C_CLK 0xf103
  75. #define I2C_CLK_100 0x7
  76. #define I2C_CLK_400 0x1a
  77. #define D_TPSD_LOCK 0xf5a9
  78. #define MP2IF2_EN 0xf9a3
  79. #define MP2IF_SERIAL 0xf985
  80. #define TSIS_ENABLE 0xf9cd
  81. #define MP2IF2_HALF_PSB 0xf9a5
  82. #define MP2IF_STOP_EN 0xf9b5
  83. #define MPEG_FULL_SPEED 0xf990
  84. #define TOP_HOSTB_SER_MODE 0xd91c
  85. #define PID_RST 0xf992
  86. #define PID_EN 0xf993
  87. #define PID_INX_EN 0xf994
  88. #define PID_INX 0xf995
  89. #define PID_LSB 0xf996
  90. #define PID_MSB 0xf997
  91. #define MP2IF_MPEG_PAR_MODE 0xf986
  92. #define DCA_UPPER_CHIP 0xf731
  93. #define DCA_LOWER_CHIP 0xf732
  94. #define DCA_PLATCH 0xf730
  95. #define DCA_FPGA_LATCH 0xf778
  96. #define DCA_STAND_ALONE 0xf73c
  97. #define DCA_ENABLE 0xf776
  98. #define DVBT_INTEN 0xf41f
  99. #define DVBT_ENABLE 0xf41a
  100. #define HOSTB_DCA_LOWER 0xd91f
  101. #define HOSTB_MPEG_PAR_MODE 0xd91b
  102. #define HOSTB_MPEG_SER_MODE 0xd91c
  103. #define HOSTB_MPEG_SER_DO7 0xd91d
  104. #define HOSTB_DCA_UPPER 0xd91e
  105. #define PADMISCDR2 0xd830
  106. #define PADMISCDR4 0xd831
  107. #define PADMISCDR8 0xd832
  108. #define PADMISCDRSR 0xd833
  109. #define LOCK3_OUT 0xd8fd
  110. #define GPIOH1_O 0xd8af
  111. #define GPIOH1_EN 0xd8b0
  112. #define GPIOH1_ON 0xd8b1
  113. #define GPIOH3_O 0xd8b3
  114. #define GPIOH3_EN 0xd8b4
  115. #define GPIOH3_ON 0xd8b5
  116. #define GPIOH5_O 0xd8bb
  117. #define GPIOH5_EN 0xd8bc
  118. #define GPIOH5_ON 0xd8bd
  119. #define AFE_MEM0 0xfb24
  120. #define REG_TPSD_TX_MODE 0xf900
  121. #define REG_TPSD_GI 0xf901
  122. #define REG_TPSD_HIER 0xf902
  123. #define REG_TPSD_CONST 0xf903
  124. #define REG_BW 0xf904
  125. #define REG_PRIV 0xf905
  126. #define REG_TPSD_HP_CODE 0xf906
  127. #define REG_TPSD_LP_CODE 0xf907
  128. #define MP2IF_SYNC_LK 0xf999
  129. #define ADC_FREQ 0xf1cd
  130. #define TRIGGER_OFSM 0x0000
  131. /* COEFF Registers start at 0x0001 to 0x0020 */
  132. #define COEFF_1_2048 0x0001
  133. #define XTAL_CLK 0x0025
  134. #define BFS_FCW 0x0029
  135. /* Error Regs */
  136. #define RSD_ABORT_PKT_LSB 0x0032
  137. #define RSD_ABORT_PKT_MSB 0x0033
  138. #define RSD_BIT_ERR_0_7 0x0034
  139. #define RSD_BIT_ERR_8_15 0x0035
  140. #define RSD_BIT_ERR_23_16 0x0036
  141. #define RSD_BIT_COUNT_LSB 0x0037
  142. #define RSD_BIT_COUNT_MSB 0x0038
  143. #define TPSD_LOCK 0x003c
  144. #define TRAINING_MODE 0x0040
  145. #define ADC_X_2 0x0045
  146. #define TUNER_ID 0x0046
  147. #define EMPTY_CHANNEL_STATUS 0x0047
  148. #define SIGNAL_LEVEL 0x0048
  149. #define SIGNAL_QUALITY 0x0049
  150. #define EST_SIGNAL_LEVEL 0x004a
  151. #define FREE_BAND 0x004b
  152. #define SUSPEND_FLAG 0x004c
  153. #define VAR_P_INBAND 0x00f7
  154. /* Build in tuner types */
  155. #define IT9137 0x38
  156. #define IT9135_38 0x38
  157. #define IT9135_51 0x51
  158. #define IT9135_52 0x52
  159. #define IT9135_60 0x60
  160. #define IT9135_61 0x61
  161. #define IT9135_62 0x62
  162. enum {
  163. CMD_DEMOD_READ = 0,
  164. CMD_DEMOD_WRITE,
  165. CMD_TUNER_READ,
  166. CMD_TUNER_WRITE,
  167. CMD_REG_EEPROM_READ,
  168. CMD_REG_EEPROM_WRITE,
  169. CMD_DATA_READ,
  170. CMD_VAR_READ = 8,
  171. CMD_VAR_WRITE,
  172. CMD_PLATFORM_GET,
  173. CMD_PLATFORM_SET,
  174. CMD_IP_CACHE,
  175. CMD_IP_ADD,
  176. CMD_IP_REMOVE,
  177. CMD_PID_ADD,
  178. CMD_PID_REMOVE,
  179. CMD_SIPSI_GET,
  180. CMD_SIPSI_MPE_RESET,
  181. CMD_H_PID_ADD = 0x15,
  182. CMD_H_PID_REMOVE,
  183. CMD_ABORT,
  184. CMD_IR_GET,
  185. CMD_IR_SET,
  186. CMD_FW_DOWNLOAD = 0x21,
  187. CMD_QUERYINFO,
  188. CMD_BOOT,
  189. CMD_FW_DOWNLOAD_BEGIN,
  190. CMD_FW_DOWNLOAD_END,
  191. CMD_RUN_CODE,
  192. CMD_SCATTER_READ = 0x28,
  193. CMD_SCATTER_WRITE,
  194. CMD_GENERIC_READ,
  195. CMD_GENERIC_WRITE
  196. };
  197. enum {
  198. READ_LONG,
  199. WRITE_LONG,
  200. READ_SHORT,
  201. WRITE_SHORT,
  202. READ_DATA,
  203. WRITE_DATA,
  204. WRITE_CMD,
  205. };
  206. enum {
  207. IT9135_AUTO = 0,
  208. IT9137_FW,
  209. IT9135_V1_FW,
  210. IT9135_V2_FW,
  211. };
  212. #endif /* IT913X_FE_H */