e4000_priv.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Elonics E4000 silicon tuner driver
  3. *
  4. * Copyright (C) 2012 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 E4000_PRIV_H
  21. #define E4000_PRIV_H
  22. #include "e4000.h"
  23. struct e4000_priv {
  24. const struct e4000_config *cfg;
  25. struct i2c_adapter *i2c;
  26. };
  27. struct e4000_pll {
  28. u32 freq;
  29. u8 div;
  30. u8 mul;
  31. };
  32. static const struct e4000_pll e4000_pll_lut[] = {
  33. /* VCO min VCO max */
  34. { 72400000, 0x0f, 48 }, /* .......... 3475200000 */
  35. { 81200000, 0x0e, 40 }, /* 2896000000 3248000000 */
  36. { 108300000, 0x0d, 32 }, /* 2598400000 3465600000 */
  37. { 162500000, 0x0c, 24 }, /* 2599200000 3900000000 */
  38. { 216600000, 0x0b, 16 }, /* 2600000000 3465600000 */
  39. { 325000000, 0x0a, 12 }, /* 2599200000 3900000000 */
  40. { 350000000, 0x09, 8 }, /* 2600000000 2800000000 */
  41. { 432000000, 0x03, 8 }, /* 2800000000 3456000000 */
  42. { 667000000, 0x02, 6 }, /* 2592000000 4002000000 */
  43. { 1200000000, 0x01, 4 }, /* 2668000000 4800000000 */
  44. { 0xffffffff, 0x00, 2 }, /* 2400000000 .......... */
  45. };
  46. struct e4000_lna_filter {
  47. u32 freq;
  48. u8 val;
  49. };
  50. static const struct e4000_lna_filter e400_lna_filter_lut[] = {
  51. { 370000000, 0 },
  52. { 392500000, 1 },
  53. { 415000000, 2 },
  54. { 437500000, 3 },
  55. { 462500000, 4 },
  56. { 490000000, 5 },
  57. { 522500000, 6 },
  58. { 557500000, 7 },
  59. { 595000000, 8 },
  60. { 642500000, 9 },
  61. { 695000000, 10 },
  62. { 740000000, 11 },
  63. { 800000000, 12 },
  64. { 865000000, 13 },
  65. { 930000000, 14 },
  66. { 1000000000, 15 },
  67. { 1310000000, 0 },
  68. { 1340000000, 1 },
  69. { 1385000000, 2 },
  70. { 1427500000, 3 },
  71. { 1452500000, 4 },
  72. { 1475000000, 5 },
  73. { 1510000000, 6 },
  74. { 1545000000, 7 },
  75. { 1575000000, 8 },
  76. { 1615000000, 9 },
  77. { 1650000000, 10 },
  78. { 1670000000, 11 },
  79. { 1690000000, 12 },
  80. { 1710000000, 13 },
  81. { 1735000000, 14 },
  82. { 0xffffffff, 15 },
  83. };
  84. struct e4000_band {
  85. u32 freq;
  86. u8 reg07_val;
  87. u8 reg78_val;
  88. };
  89. static const struct e4000_band e4000_band_lut[] = {
  90. { 140000000, 0x01, 0x03 },
  91. { 350000000, 0x03, 0x03 },
  92. { 1000000000, 0x05, 0x03 },
  93. { 0xffffffff, 0x07, 0x00 },
  94. };
  95. struct e4000_if_filter {
  96. u32 freq;
  97. u8 reg11_val;
  98. u8 reg12_val;
  99. };
  100. static const struct e4000_if_filter e4000_if_filter_lut[] = {
  101. { 4300000, 0xfd, 0x1f },
  102. { 4400000, 0xfd, 0x1e },
  103. { 4480000, 0xfc, 0x1d },
  104. { 4560000, 0xfc, 0x1c },
  105. { 4600000, 0xfc, 0x1b },
  106. { 4800000, 0xfc, 0x1a },
  107. { 4900000, 0xfc, 0x19 },
  108. { 5000000, 0xfc, 0x18 },
  109. { 5100000, 0xfc, 0x17 },
  110. { 5200000, 0xfc, 0x16 },
  111. { 5400000, 0xfc, 0x15 },
  112. { 5500000, 0xfc, 0x14 },
  113. { 5600000, 0xfc, 0x13 },
  114. { 5800000, 0xfb, 0x12 },
  115. { 5900000, 0xfb, 0x11 },
  116. { 6000000, 0xfb, 0x10 },
  117. { 6200000, 0xfb, 0x0f },
  118. { 6400000, 0xfa, 0x0e },
  119. { 6600000, 0xfa, 0x0d },
  120. { 6800000, 0xf9, 0x0c },
  121. { 7200000, 0xf9, 0x0b },
  122. { 7400000, 0xf9, 0x0a },
  123. { 7600000, 0xf8, 0x09 },
  124. { 7800000, 0xf8, 0x08 },
  125. { 8200000, 0xf8, 0x07 },
  126. { 8600000, 0xf7, 0x06 },
  127. { 8800000, 0xf7, 0x05 },
  128. { 9200000, 0xf7, 0x04 },
  129. { 9600000, 0xf6, 0x03 },
  130. { 10000000, 0xf6, 0x02 },
  131. { 10600000, 0xf5, 0x01 },
  132. { 11000000, 0xf5, 0x00 },
  133. { 0xffffffff, 0x00, 0x20 },
  134. };
  135. #endif