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