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