diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-03-03 18:05:22 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-03-03 18:05:22 +0000 |
commit | 096eb687a68c5ff90436ee0c65b2a1674813b633 (patch) | |
tree | 4242f97b91d2c925ac8d4d4ad9f4d2554e1fb3b7 /firmware/drivers/audio | |
parent | 1fb8242d968a3ee7091ef86db37b3e8f593eaeeb (diff) | |
download | rockbox-096eb687a68c5ff90436ee0c65b2a1674813b633.tar.gz rockbox-096eb687a68c5ff90436ee0c65b2a1674813b633.zip |
Get the volume controls working on the M:Robe 500 along with some minor code changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20194 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio')
-rw-r--r-- | firmware/drivers/audio/tsc2100.c | 25 |
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 | ||
31 | const struct sound_settings_info audiohw_settings[] = { | 31 | const 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 | }; |
47 | static bool is_muted = false; | 40 | static 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 | ||
96 | void audiohw_set_master_vol(int vol_l, int vol_r) | 89 | void 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 | |||
104 | void audiohw_set_lineout_vol(int vol_l, int vol_r) | ||
105 | { | ||
106 | audiohw_set_master_vol(vol_l, vol_r); | ||
107 | } | 92 | } |
108 | 93 | ||
109 | void audiohw_mute(bool mute) | 94 | void audiohw_mute(bool mute) |