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
This commit is contained in:
Amaury Pouly 2016-08-20 21:28:50 +01:00
parent bfd3b08312
commit af81cc4a93
3 changed files with 16 additions and 9 deletions

View File

@ -93,9 +93,7 @@ void audiohw_set_recvol(int left, int right, int type)
void audiohw_set_depth_3d(int val)
{
/* input is raw value ranging from 0dB to 6dB in tenth of dB
* convert to value in 1.5dB steps */
imx233_audioout_set_3d_effect(val / 15);
imx233_audioout_set_3d_effect(val);
}
void audiohw_set_monitor(bool enable)

View File

@ -21,12 +21,12 @@
#ifndef __IMX233_CODEC_H_
#define __IMX233_CODEC_H_
/* i.MX233 can boost up to 6dB in DAC mode and 12dB in line mode. Since mic/line
* already have adjustable gain, keep lowest of both. With chained DAC volume
* and headphone volume, the i.MX233 can achieve < -100dB but stay at -100dB. */
#define AUDIOHW_CAPS (DEPTH_3D_CAP | BASS_CAP | TREBLE_CAP | \
LIN_GAIN_CAP | MIC_GAIN_CAP)
/* i.MX233 can boost up to 6dB in DAC mode and 12dB in line mode. Pretend we can
* do 12dB (but we cap at 6dB in DAC mode). With chained DAC volume
* and headphone volume, the i.MX233 can achieve < -100dB but stay at -100dB. */
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 12, -25)
/* HAVE_SW_TONE_CONTROLS */
#ifdef HAVE_RECORDING
@ -38,7 +38,16 @@ AUDIOHW_SETTING(LEFT_GAIN, "dB", 0, 1, -100, 22, 0)
AUDIOHW_SETTING(RIGHT_GAIN, "dB", 0, 1, -100, 22, 0)
AUDIOHW_SETTING(MIC_GAIN, "dB", 0, 1, -100, 60, 20)
#endif /* HAVE_RECORDING */
/* i.MX233 has four settings: 0dB, 3dB, 4.5dB, 6dB so fake 1.5dB steps */
AUDIOHW_SETTING(DEPTH_3D, "dB", 1,15, 0, 60, 0)
/* i.MX233 has four settings: 0dB, 3dB, 4.5dB, 6dB */
/* depth_3d setting: 0=0dB, 1=3dB, 2=4.5dB, 3=6dB. Return value in tenth of dB */
static inline int imx233_depth_3d_val2phys(int val)
{
if(val == 0)
return 0; /* 0dB */
else
return 15 * (val + 1); /* 3dB + 1.5dB per step */
}
AUDIOHW_SETTING(DEPTH_3D, "dB", 1, 1, 0, 3, 0, imx233_depth_3d_val2phys(val))
#endif /* __IMX233_CODEC_H_ */

View File

@ -60,7 +60,7 @@ void imx233_audioout_set_hp_vol(int vol_l, int vol_r);
void imx233_audioout_set_freq(int fsel);
/* select between DAC and Line1 */
void imx233_audioout_select_hp_input(bool line1);
/* value in 1.5dB steps, from 0dB to 6dB */
/* value is uses register encoding: 0=Off, 1=3dB, 2=4.5dB, 3=6dB */
void imx233_audioout_set_3d_effect(int val);
/* enable/disable speaker amplifier */
void imx233_audioout_enable_spkr(bool en);