tas-basstreble.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * This file is only included exactly once!
  3. *
  4. * The tables here are derived from the tas3004 datasheet,
  5. * modulo typo corrections and some smoothing...
  6. */
  7. #define TAS3004_TREBLE_MIN 0
  8. #define TAS3004_TREBLE_MAX 72
  9. #define TAS3004_BASS_MIN 0
  10. #define TAS3004_BASS_MAX 72
  11. #define TAS3004_TREBLE_ZERO 36
  12. #define TAS3004_BASS_ZERO 36
  13. static u8 tas3004_treble_table[] = {
  14. 150, /* -18 dB */
  15. 149,
  16. 148,
  17. 147,
  18. 146,
  19. 145,
  20. 144,
  21. 143,
  22. 142,
  23. 141,
  24. 140,
  25. 139,
  26. 138,
  27. 137,
  28. 136,
  29. 135,
  30. 134,
  31. 133,
  32. 132,
  33. 131,
  34. 130,
  35. 129,
  36. 128,
  37. 127,
  38. 126,
  39. 125,
  40. 124,
  41. 123,
  42. 122,
  43. 121,
  44. 120,
  45. 119,
  46. 118,
  47. 117,
  48. 116,
  49. 115,
  50. 114, /* 0 dB */
  51. 113,
  52. 112,
  53. 111,
  54. 109,
  55. 108,
  56. 107,
  57. 105,
  58. 104,
  59. 103,
  60. 101,
  61. 99,
  62. 98,
  63. 96,
  64. 93,
  65. 91,
  66. 89,
  67. 86,
  68. 83,
  69. 81,
  70. 77,
  71. 74,
  72. 71,
  73. 67,
  74. 63,
  75. 59,
  76. 54,
  77. 49,
  78. 44,
  79. 38,
  80. 32,
  81. 26,
  82. 19,
  83. 10,
  84. 4,
  85. 2,
  86. 1, /* +18 dB */
  87. };
  88. static inline u8 tas3004_treble(int idx)
  89. {
  90. return tas3004_treble_table[idx];
  91. }
  92. /* I only save the difference here to the treble table
  93. * so that the binary is smaller...
  94. * I have also ignored completely differences of
  95. * +/- 1
  96. */
  97. static s8 tas3004_bass_diff_to_treble[] = {
  98. 2, /* 7 dB, offset 50 */
  99. 2,
  100. 2,
  101. 2,
  102. 2,
  103. 1,
  104. 2,
  105. 2,
  106. 2,
  107. 3,
  108. 4,
  109. 4,
  110. 5,
  111. 6,
  112. 7,
  113. 8,
  114. 9,
  115. 10,
  116. 11,
  117. 14,
  118. 13,
  119. 8,
  120. 1, /* 18 dB */
  121. };
  122. static inline u8 tas3004_bass(int idx)
  123. {
  124. u8 result = tas3004_treble_table[idx];
  125. if (idx >= 50)
  126. result += tas3004_bass_diff_to_treble[idx-50];
  127. return result;
  128. }