diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-08-20 21:28:50 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-12-12 12:15:24 +0100 |
commit | af81cc4a935753d3ba6c692b7e928691f0155355 (patch) | |
tree | 8fcfa1c0f27545256a7c305d4fb73d6f9ef7feac /firmware | |
parent | bfd3b0831268b24a1f3e54fbc1d5978409882a91 (diff) | |
download | rockbox-af81cc4a935753d3ba6c692b7e928691f0155355.tar.gz rockbox-af81cc4a935753d3ba6c692b7e928691f0155355.zip |
imx233: slightly rework 3D audio setting
The old code made the setting appear as 0dB, 1.5dB, 3dB and 4.5dB when
in fact it is 0dB, 3dB, 4.5dB and 6dB. This commit clarifies the code and
also fix this at the same time. This imx233 3D enhancement is complete crap anyway
but now you can satisfy yourself with 6 dB of pure crap, clearly an enhancement.
Change-Id: Ia3e088987c1ff0cdde228905ff70f46476a499a2
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/audio/imx233-codec.c | 4 | ||||
-rw-r--r-- | firmware/export/imx233-codec.h | 19 | ||||
-rw-r--r-- | firmware/target/arm/imx233/audioout-imx233.h | 2 |
3 files changed, 16 insertions, 9 deletions
diff --git a/firmware/drivers/audio/imx233-codec.c b/firmware/drivers/audio/imx233-codec.c index 357aa33bb5..d56eb44d57 100644 --- a/firmware/drivers/audio/imx233-codec.c +++ b/firmware/drivers/audio/imx233-codec.c | |||
@@ -93,9 +93,7 @@ void audiohw_set_recvol(int left, int right, int type) | |||
93 | 93 | ||
94 | void audiohw_set_depth_3d(int val) | 94 | void audiohw_set_depth_3d(int val) |
95 | { | 95 | { |
96 | /* input is raw value ranging from 0dB to 6dB in tenth of dB | 96 | imx233_audioout_set_3d_effect(val); |
97 | * convert to value in 1.5dB steps */ | ||
98 | imx233_audioout_set_3d_effect(val / 15); | ||
99 | } | 97 | } |
100 | 98 | ||
101 | void audiohw_set_monitor(bool enable) | 99 | void audiohw_set_monitor(bool enable) |
diff --git a/firmware/export/imx233-codec.h b/firmware/export/imx233-codec.h index 10500f15b9..040a829284 100644 --- a/firmware/export/imx233-codec.h +++ b/firmware/export/imx233-codec.h | |||
@@ -21,12 +21,12 @@ | |||
21 | #ifndef __IMX233_CODEC_H_ | 21 | #ifndef __IMX233_CODEC_H_ |
22 | #define __IMX233_CODEC_H_ | 22 | #define __IMX233_CODEC_H_ |
23 | 23 | ||
24 | /* i.MX233 can boost up to 6dB in DAC mode and 12dB in line mode. Since mic/line | ||
25 | * already have adjustable gain, keep lowest of both. With chained DAC volume | ||
26 | * and headphone volume, the i.MX233 can achieve < -100dB but stay at -100dB. */ | ||
27 | #define AUDIOHW_CAPS (DEPTH_3D_CAP | BASS_CAP | TREBLE_CAP | \ | 24 | #define AUDIOHW_CAPS (DEPTH_3D_CAP | BASS_CAP | TREBLE_CAP | \ |
28 | LIN_GAIN_CAP | MIC_GAIN_CAP) | 25 | LIN_GAIN_CAP | MIC_GAIN_CAP) |
29 | 26 | ||
27 | /* i.MX233 can boost up to 6dB in DAC mode and 12dB in line mode. Pretend we can | ||
28 | * do 12dB (but we cap at 6dB in DAC mode). With chained DAC volume | ||
29 | * and headphone volume, the i.MX233 can achieve < -100dB but stay at -100dB. */ | ||
30 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 12, -25) | 30 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 12, -25) |
31 | /* HAVE_SW_TONE_CONTROLS */ | 31 | /* HAVE_SW_TONE_CONTROLS */ |
32 | #ifdef HAVE_RECORDING | 32 | #ifdef HAVE_RECORDING |
@@ -38,7 +38,16 @@ AUDIOHW_SETTING(LEFT_GAIN, "dB", 0, 1, -100, 22, 0) | |||
38 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 0, 1, -100, 22, 0) | 38 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 0, 1, -100, 22, 0) |
39 | AUDIOHW_SETTING(MIC_GAIN, "dB", 0, 1, -100, 60, 20) | 39 | AUDIOHW_SETTING(MIC_GAIN, "dB", 0, 1, -100, 60, 20) |
40 | #endif /* HAVE_RECORDING */ | 40 | #endif /* HAVE_RECORDING */ |
41 | /* i.MX233 has four settings: 0dB, 3dB, 4.5dB, 6dB so fake 1.5dB steps */ | 41 | /* i.MX233 has four settings: 0dB, 3dB, 4.5dB, 6dB */ |
42 | AUDIOHW_SETTING(DEPTH_3D, "dB", 1,15, 0, 60, 0) | 42 | /* depth_3d setting: 0=0dB, 1=3dB, 2=4.5dB, 3=6dB. Return value in tenth of dB */ |
43 | static inline int imx233_depth_3d_val2phys(int val) | ||
44 | { | ||
45 | if(val == 0) | ||
46 | return 0; /* 0dB */ | ||
47 | else | ||
48 | return 15 * (val + 1); /* 3dB + 1.5dB per step */ | ||
49 | } | ||
50 | AUDIOHW_SETTING(DEPTH_3D, "dB", 1, 1, 0, 3, 0, imx233_depth_3d_val2phys(val)) | ||
51 | |||
43 | 52 | ||
44 | #endif /* __IMX233_CODEC_H_ */ | 53 | #endif /* __IMX233_CODEC_H_ */ |
diff --git a/firmware/target/arm/imx233/audioout-imx233.h b/firmware/target/arm/imx233/audioout-imx233.h index c819fdb294..4c27ae2375 100644 --- a/firmware/target/arm/imx233/audioout-imx233.h +++ b/firmware/target/arm/imx233/audioout-imx233.h | |||
@@ -60,7 +60,7 @@ void imx233_audioout_set_hp_vol(int vol_l, int vol_r); | |||
60 | void imx233_audioout_set_freq(int fsel); | 60 | void imx233_audioout_set_freq(int fsel); |
61 | /* select between DAC and Line1 */ | 61 | /* select between DAC and Line1 */ |
62 | void imx233_audioout_select_hp_input(bool line1); | 62 | void imx233_audioout_select_hp_input(bool line1); |
63 | /* value in 1.5dB steps, from 0dB to 6dB */ | 63 | /* value is uses register encoding: 0=Off, 1=3dB, 2=4.5dB, 3=6dB */ |
64 | void imx233_audioout_set_3d_effect(int val); | 64 | void imx233_audioout_set_3d_effect(int val); |
65 | /* enable/disable speaker amplifier */ | 65 | /* enable/disable speaker amplifier */ |
66 | void imx233_audioout_enable_spkr(bool en); | 66 | void imx233_audioout_enable_spkr(bool en); |