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.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/firmware/drivers/audio/tsc2100.c b/firmware/drivers/audio/tsc2100.c
index 6479f84b34..41327ae3d7 100644
--- a/firmware/drivers/audio/tsc2100.c
+++ b/firmware/drivers/audio/tsc2100.c
@@ -29,18 +29,9 @@
29#include "sound.h" 29#include "sound.h"
30#include "tsc2100.h" 30#include "tsc2100.h"
31 31
32const struct sound_settings_info audiohw_settings[] = {
33 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, -25},
34 /* HAVE_SW_TONE_CONTROLS */
35 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
36 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
37 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
38 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
39 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
40};
41static bool is_muted = false; 32static bool is_muted = false;
42/* convert tenth of dB volume to master volume register value */ 33/* convert tenth of dB volume to volume register value */
43int tenthdb2master(int db) 34static int vol_tenthdb2hw(int db)
44{ 35{
45 /* 0 to -63.0dB in 1dB steps, tsc2100 can goto -63.5 in 0.5dB steps */ 36 /* 0 to -63.0dB in 1dB steps, tsc2100 can goto -63.5 in 0.5dB steps */
46 if (db < VOLUME_MIN) { 37 if (db < VOLUME_MIN) {
@@ -52,27 +43,6 @@ int tenthdb2master(int db)
52 } 43 }
53} 44}
54 45
55int sound_val2phys(int setting, int value)
56{
57 int result;
58
59 switch(setting)
60 {
61#if 0
62 case SOUND_LEFT_GAIN:
63 case SOUND_RIGHT_GAIN:
64 case SOUND_MIC_GAIN:
65 result = (value - 23) * 15;
66 break;
67#endif
68 default:
69 result = value;
70 break;
71 }
72
73 return result;
74}
75
76void audiohw_init(void) 46void audiohw_init(void)
77{ 47{
78 short val = tsc2100_readreg(TSAC4_PAGE, TSAC4_ADDRESS); 48 short val = tsc2100_readreg(TSAC4_PAGE, TSAC4_ADDRESS);
@@ -104,9 +74,12 @@ void audiohw_postinit(void)
104 audiohw_mute(false); 74 audiohw_mute(false);
105} 75}
106 76
107void audiohw_set_master_vol(int vol_l, int vol_r) 77void audiohw_set_master_volume(int vol_l, int vol_r)
108{ 78{
109 tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, (short)((vol_l<<8) | vol_r) ); 79 vol_l = vol_tenthdb2hw(vol_l);
80 vol_r = vol_tenthdb2hw(vol_r);
81 tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS,
82 (short)((vol_l<<8) | vol_r) );
110} 83}
111 84
112void audiohw_close(void) 85void audiohw_close(void)