summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/tsc2100.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/tsc2100.c')
-rw-r--r--firmware/drivers/audio/tsc2100.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/firmware/drivers/audio/tsc2100.c b/firmware/drivers/audio/tsc2100.c
index ca7f22d097..98a16f1fc1 100644
--- a/firmware/drivers/audio/tsc2100.c
+++ b/firmware/drivers/audio/tsc2100.c
@@ -29,20 +29,13 @@
29#include "tsc2100.h" 29#include "tsc2100.h"
30 30
31const struct sound_settings_info audiohw_settings[] = { 31const struct sound_settings_info audiohw_settings[] = {
32 [SOUND_VOLUME] = {"dB", 0, 1, -63, 0, -25}, 32 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, -25},
33#if 0
34 /* HAVE_SW_TONE_CONTROLS */ 33 /* HAVE_SW_TONE_CONTROLS */
35 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 34 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
36 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 35 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
37 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 36 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
38 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 37 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
39 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 38 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
40#ifdef HAVE_RECORDING
41 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23},
42 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23},
43 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23},
44#endif
45#endif
46}; 39};
47static bool is_muted = false; 40static bool is_muted = false;
48/* convert tenth of dB volume to master volume register value */ 41/* convert tenth of dB volume to master volume register value */
@@ -50,11 +43,11 @@ int tenthdb2master(int db)
50{ 43{
51 /* 0 to -63.0dB in 1dB steps, tsc2100 can goto -63.5 in 0.5dB steps */ 44 /* 0 to -63.0dB in 1dB steps, tsc2100 can goto -63.5 in 0.5dB steps */
52 if (db < VOLUME_MIN) { 45 if (db < VOLUME_MIN) {
53 return 0x0; 46 return 0x7E;
54 } else if (db >= VOLUME_MAX) { 47 } else if (db >= VOLUME_MAX) {
55 return 0x1f; 48 return 0x00;
56 } else { 49 } else {
57 return((db-VOLUME_MIN)/10); /* VOLUME_MIN is negative */ 50 return(-((db)/5)); /* VOLUME_MIN is negative */
58 } 51 }
59} 52}
60 53
@@ -95,15 +88,7 @@ void audiohw_postinit(void)
95 88
96void audiohw_set_master_vol(int vol_l, int vol_r) 89void audiohw_set_master_vol(int vol_l, int vol_r)
97{ 90{
98 short vol = (vol_l<<14)|(vol_r); 91 tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, (short)((vol_l<<8) | vol_r) );
99 if (is_muted)
100 vol |= (1<<15)|(1<<7);
101 tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, vol);
102}
103
104void audiohw_set_lineout_vol(int vol_l, int vol_r)
105{
106 audiohw_set_master_vol(vol_l, vol_r);
107} 92}
108 93
109void audiohw_mute(bool mute) 94void audiohw_mute(bool mute)