tda10071_priv.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
  3. *
  4. * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. */
  20. #ifndef TDA10071_PRIV
  21. #define TDA10071_PRIV
  22. #include "dvb_frontend.h"
  23. #include "tda10071.h"
  24. #include <linux/firmware.h>
  25. #define LOG_PREFIX "tda10071"
  26. #undef dbg
  27. #define dbg(f, arg...) \
  28. if (tda10071_debug) \
  29. printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
  30. #undef err
  31. #define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
  32. #undef info
  33. #define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
  34. #undef warn
  35. #define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
  36. struct tda10071_priv {
  37. struct i2c_adapter *i2c;
  38. struct dvb_frontend fe;
  39. struct tda10071_config cfg;
  40. u8 meas_count[2];
  41. u32 ber;
  42. u32 ucb;
  43. fe_status_t fe_status;
  44. fe_delivery_system_t delivery_system;
  45. bool warm; /* FW running */
  46. };
  47. static struct tda10071_modcod {
  48. fe_delivery_system_t delivery_system;
  49. fe_modulation_t modulation;
  50. fe_code_rate_t fec;
  51. u8 val;
  52. } TDA10071_MODCOD[] = {
  53. /* NBC-QPSK */
  54. { SYS_DVBS2, QPSK, FEC_AUTO, 0x00 },
  55. { SYS_DVBS2, QPSK, FEC_1_2, 0x04 },
  56. { SYS_DVBS2, QPSK, FEC_3_5, 0x05 },
  57. { SYS_DVBS2, QPSK, FEC_2_3, 0x06 },
  58. { SYS_DVBS2, QPSK, FEC_3_4, 0x07 },
  59. { SYS_DVBS2, QPSK, FEC_4_5, 0x08 },
  60. { SYS_DVBS2, QPSK, FEC_5_6, 0x09 },
  61. { SYS_DVBS2, QPSK, FEC_8_9, 0x0a },
  62. { SYS_DVBS2, QPSK, FEC_9_10, 0x0b },
  63. /* 8PSK */
  64. { SYS_DVBS2, PSK_8, FEC_3_5, 0x0c },
  65. { SYS_DVBS2, PSK_8, FEC_2_3, 0x0d },
  66. { SYS_DVBS2, PSK_8, FEC_3_4, 0x0e },
  67. { SYS_DVBS2, PSK_8, FEC_5_6, 0x0f },
  68. { SYS_DVBS2, PSK_8, FEC_8_9, 0x10 },
  69. { SYS_DVBS2, PSK_8, FEC_9_10, 0x11 },
  70. /* QPSK */
  71. { SYS_DVBS, QPSK, FEC_AUTO, 0x2d },
  72. { SYS_DVBS, QPSK, FEC_1_2, 0x2e },
  73. { SYS_DVBS, QPSK, FEC_2_3, 0x2f },
  74. { SYS_DVBS, QPSK, FEC_3_4, 0x30 },
  75. { SYS_DVBS, QPSK, FEC_5_6, 0x31 },
  76. { SYS_DVBS, QPSK, FEC_7_8, 0x32 },
  77. };
  78. struct tda10071_reg_val_mask {
  79. u8 reg;
  80. u8 val;
  81. u8 mask;
  82. };
  83. /* firmware filename */
  84. #define TDA10071_DEFAULT_FIRMWARE "dvb-fe-tda10071.fw"
  85. /* firmware commands */
  86. #define CMD_DEMOD_INIT 0x10
  87. #define CMD_CHANGE_CHANNEL 0x11
  88. #define CMD_MPEG_CONFIG 0x13
  89. #define CMD_TUNER_INIT 0x15
  90. #define CMD_GET_AGCACC 0x1a
  91. #define CMD_LNB_CONFIG 0x20
  92. #define CMD_LNB_SEND_DISEQC 0x21
  93. #define CMD_LNB_SET_DC_LEVEL 0x22
  94. #define CMD_LNB_PCB_CONFIG 0x23
  95. #define CMD_LNB_SEND_TONEBURST 0x24
  96. #define CMD_LNB_UPDATE_REPLY 0x25
  97. #define CMD_GET_FW_VERSION 0x35
  98. #define CMD_SET_SLEEP_MODE 0x36
  99. #define CMD_BER_CONTROL 0x3e
  100. #define CMD_BER_UPDATE_COUNTERS 0x3f
  101. /* firmare command struct */
  102. #define TDA10071_ARGLEN 0x1e
  103. struct tda10071_cmd {
  104. u8 args[TDA10071_ARGLEN];
  105. u8 len;
  106. };
  107. #endif /* TDA10071_PRIV */