af9035.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Afatech AF9035 DVB USB driver
  3. *
  4. * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  5. * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. */
  21. #ifndef AF9035_H
  22. #define AF9035_H
  23. /* prefix for dvb-usb log writings */
  24. #define DVB_USB_LOG_PREFIX "af9035"
  25. #include "dvb-usb.h"
  26. struct reg_val {
  27. u32 reg;
  28. u8 val;
  29. };
  30. struct reg_val_mask {
  31. u32 reg;
  32. u8 val;
  33. u8 mask;
  34. };
  35. struct usb_req {
  36. u8 cmd;
  37. u8 mbox;
  38. u8 wlen;
  39. u8 *wbuf;
  40. u8 rlen;
  41. u8 *rbuf;
  42. };
  43. struct config {
  44. bool dual_mode;
  45. bool hw_not_supported;
  46. };
  47. u32 clock_lut[] = {
  48. 20480000, /* FPGA */
  49. 16384000, /* 16.38 MHz */
  50. 20480000, /* 20.48 MHz */
  51. 36000000, /* 36.00 MHz */
  52. 30000000, /* 30.00 MHz */
  53. 26000000, /* 26.00 MHz */
  54. 28000000, /* 28.00 MHz */
  55. 32000000, /* 32.00 MHz */
  56. 34000000, /* 34.00 MHz */
  57. 24000000, /* 24.00 MHz */
  58. 22000000, /* 22.00 MHz */
  59. 12000000, /* 12.00 MHz */
  60. };
  61. u32 clock_lut_it9135[] = {
  62. 12000000, /* 12.00 MHz */
  63. 20480000, /* 20.48 MHz */
  64. 36000000, /* 36.00 MHz */
  65. 30000000, /* 30.00 MHz */
  66. 26000000, /* 26.00 MHz */
  67. 28000000, /* 28.00 MHz */
  68. 32000000, /* 32.00 MHz */
  69. 34000000, /* 34.00 MHz */
  70. 24000000, /* 24.00 MHz */
  71. 22000000, /* 22.00 MHz */
  72. };
  73. /* EEPROM locations */
  74. #define EEPROM_IR_MODE 0x430d
  75. #define EEPROM_DUAL_MODE 0x4326
  76. #define EEPROM_IR_TYPE 0x4329
  77. #define EEPROM_1_IFFREQ_L 0x432d
  78. #define EEPROM_1_IFFREQ_H 0x432e
  79. #define EEPROM_1_TUNER_ID 0x4331
  80. #define EEPROM_2_IFFREQ_L 0x433d
  81. #define EEPROM_2_IFFREQ_H 0x433e
  82. #define EEPROM_2_TUNER_ID 0x4341
  83. /* USB commands */
  84. #define CMD_MEM_RD 0x00
  85. #define CMD_MEM_WR 0x01
  86. #define CMD_I2C_RD 0x02
  87. #define CMD_I2C_WR 0x03
  88. #define CMD_FW_DL 0x21
  89. #define CMD_FW_QUERYINFO 0x22
  90. #define CMD_FW_BOOT 0x23
  91. #define CMD_FW_DL_BEGIN 0x24
  92. #define CMD_FW_DL_END 0x25
  93. #define CMD_FW_SCATTER_WR 0x29
  94. #endif