diff options
Diffstat (limited to 'firmware/drivers/audio/as3514.c')
-rw-r--r-- | firmware/drivers/audio/as3514.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index e1c7f6575e..1f79277423 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c | |||
@@ -31,6 +31,16 @@ | |||
31 | #include "i2s.h" | 31 | #include "i2s.h" |
32 | #include "ascodec.h" | 32 | #include "ascodec.h" |
33 | 33 | ||
34 | #if CONFIG_CPU == AS3525v2 | ||
35 | /* Headphone volume goes from -81.0 ... +6dB */ | ||
36 | #define VOLUME_MIN -820 | ||
37 | #define VOLUME_MAX 60 | ||
38 | #else | ||
39 | /* Headphone volume goes from -73.5 ... +6dB */ | ||
40 | #define VOLUME_MIN -740 | ||
41 | #define VOLUME_MAX 60 | ||
42 | #endif | ||
43 | |||
34 | /* | 44 | /* |
35 | * This drivers supports: | 45 | * This drivers supports: |
36 | * as3514 , as used in the PP targets | 46 | * as3514 , as used in the PP targets |
@@ -99,13 +109,12 @@ static void as3514_write_masked(unsigned int reg, unsigned int bits, | |||
99 | /* convert tenth of dB volume to master volume register value */ | 109 | /* convert tenth of dB volume to master volume register value */ |
100 | static int vol_tenthdb2hw(int db) | 110 | static int vol_tenthdb2hw(int db) |
101 | { | 111 | { |
102 | /* +6 to -73.5dB (or -81.0 dB) in 1.5dB steps == 53 (or 58) levels */ | 112 | if (db <= VOLUME_MIN) { |
103 | if (db < VOLUME_MIN) { | ||
104 | return 0x0; | 113 | return 0x0; |
105 | } else if (db > VOLUME_MAX) { | 114 | } else if (db > VOLUME_MAX) { |
106 | return (VOLUME_MAX-VOLUME_MIN)/15; | 115 | return (VOLUME_MAX - VOLUME_MIN) / 15; |
107 | } else { | 116 | } else { |
108 | return((db-VOLUME_MIN)/15); /* VOLUME_MIN is negative */ | 117 | return (db - VOLUME_MIN) / 15; |
109 | } | 118 | } |
110 | } | 119 | } |
111 | 120 | ||