diff options
Diffstat (limited to 'firmware/drivers/audio/cs42l55.c')
-rw-r--r-- | firmware/drivers/audio/cs42l55.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/firmware/drivers/audio/cs42l55.c b/firmware/drivers/audio/cs42l55.c index 38380d5a54..75fcd80b77 100644 --- a/firmware/drivers/audio/cs42l55.c +++ b/firmware/drivers/audio/cs42l55.c | |||
@@ -29,27 +29,15 @@ | |||
29 | #include "cscodec.h" | 29 | #include "cscodec.h" |
30 | #include "cs42l55.h" | 30 | #include "cs42l55.h" |
31 | 31 | ||
32 | const struct sound_settings_info audiohw_settings[] = { | ||
33 | [SOUND_VOLUME] = {"dB", 0, 1, -60, 12, -25}, | ||
34 | [SOUND_BASS] = {"dB", 1, 15,-105, 120, 0}, | ||
35 | [SOUND_TREBLE] = {"dB", 1, 15,-105, 120, 0}, | ||
36 | [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, | ||
37 | [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, | ||
38 | [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, | ||
39 | [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 2}, | ||
40 | [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1}, | ||
41 | }; | ||
42 | |||
43 | static int bass, treble; | 32 | static int bass, treble; |
44 | 33 | ||
45 | /* convert tenth of dB volume (-600..120) to master volume register value */ | 34 | /* convert tenth of dB volume (-600..120) to volume register value */ |
46 | int tenthdb2master(int db) | 35 | static int vol_tenthdb2hw(int db) |
47 | { | 36 | { |
48 | /* -60dB to +12dB in 1dB steps */ | 37 | /* -60dB to +12dB in 1dB steps */ |
49 | /* 0001100 == +12dB (0xc) */ | 38 | /* 0001100 == +12dB (0xc) */ |
50 | /* 0000000 == 0dB (0x0) */ | 39 | /* 0000000 == 0dB (0x0) */ |
51 | /* 1000100 == -60dB (0x44, this is actually -58dB) */ | 40 | /* 1000100 == -60dB (0x44, this is actually -58dB) */ |
52 | |||
53 | if (db < VOLUME_MIN) return HPACTL_HPAMUTE; | 41 | if (db < VOLUME_MIN) return HPACTL_HPAMUTE; |
54 | return (db / 10) & HPACTL_HPAVOL_MASK; | 42 | return (db / 10) & HPACTL_HPAVOL_MASK; |
55 | } | 43 | } |
@@ -125,11 +113,8 @@ void audiohw_postinit(void) | |||
125 | 113 | ||
126 | void audiohw_set_master_vol(int vol_l, int vol_r) | 114 | void audiohw_set_master_vol(int vol_l, int vol_r) |
127 | { | 115 | { |
128 | /* -60dB to +12dB in 1dB steps */ | 116 | vol_l = vol_tenthdb2hw(vol_l); |
129 | /* 0001100 == +12dB (0xc) */ | 117 | vol_r = vol_tenthdb2hw(vol_r); |
130 | /* 0000000 == 0dB (0x0) */ | ||
131 | /* 1000100 == -60dB (0x44, this is actually -58dB) */ | ||
132 | |||
133 | cscodec_setbits(HPACTL, HPACTL_HPAVOL_MASK | HPACTL_HPAMUTE, | 118 | cscodec_setbits(HPACTL, HPACTL_HPAVOL_MASK | HPACTL_HPAMUTE, |
134 | vol_l << HPACTL_HPAVOL_SHIFT); | 119 | vol_l << HPACTL_HPAVOL_SHIFT); |
135 | cscodec_setbits(HPBCTL, HPBCTL_HPBVOL_MASK | HPBCTL_HPBMUTE, | 120 | cscodec_setbits(HPBCTL, HPBCTL_HPBVOL_MASK | HPBCTL_HPBMUTE, |
@@ -138,11 +123,8 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
138 | 123 | ||
139 | void audiohw_set_lineout_vol(int vol_l, int vol_r) | 124 | void audiohw_set_lineout_vol(int vol_l, int vol_r) |
140 | { | 125 | { |
141 | /* -60dB to +12dB in 1dB steps */ | 126 | vol_l = vol_tenthdb2hw(vol_l); |
142 | /* 0001100 == +12dB (0xc) */ | 127 | vol_r = vol_tenthdb2hw(vol_r); |
143 | /* 0000000 == 0dB (0x0) */ | ||
144 | /* 1000100 == -60dB (0x44, this is actually -58dB) */ | ||
145 | |||
146 | cscodec_setbits(LINEACTL, LINEACTL_LINEAVOL_MASK | LINEACTL_LINEAMUTE, | 128 | cscodec_setbits(LINEACTL, LINEACTL_LINEAVOL_MASK | LINEACTL_LINEAMUTE, |
147 | vol_l << LINEACTL_LINEAVOL_SHIFT); | 129 | vol_l << LINEACTL_LINEAVOL_SHIFT); |
148 | cscodec_setbits(LINEBCTL, LINEBCTL_LINEBVOL_MASK | LINEBCTL_LINEBMUTE, | 130 | cscodec_setbits(LINEBCTL, LINEBCTL_LINEBVOL_MASK | LINEBCTL_LINEBMUTE, |