summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/audioout-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:23:45 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:29:25 +0200
commit63ffdc1c8980a388d5017f951c8493a8f1fd477c (patch)
treeae45d24ed3089bec062ad4f3eb352d017b6312fb /firmware/target/arm/imx233/audioout-imx233.c
parentf0f6aee58c8900d2ea562e8caa71cb87878f49f6 (diff)
downloadrockbox-63ffdc1c8980a388d5017f951c8493a8f1fd477c.tar.gz
rockbox-63ffdc1c8980a388d5017f951c8493a8f1fd477c.tar.bz2
rockbox-63ffdc1c8980a388d5017f951c8493a8f1fd477c.zip
imx233: fix audioout for stmp3600 and stmp3700, add 3d effect
Although the 3D effets sound terrible, add support for it. Change-Id: Ib24be01986a974387b592c6e291d34b196ceb884
Diffstat (limited to 'firmware/target/arm/imx233/audioout-imx233.c')
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index 8903879b8a..d3f83c2fad 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -37,6 +37,7 @@ static int hp_unmute_cb(struct timeout *tmo)
void imx233_audioout_preinit(void)
{
+
/* Enable AUDIOOUT block */
imx233_reset_block(&HW_AUDIOOUT_CTRL);
/* Enable digital filter clock */
@@ -57,7 +58,9 @@ void imx233_audioout_preinit(void)
/* change bias to -50% */
BF_WR(AUDIOOUT_TEST, HP_I1_ADJ, 1);
BF_WR(AUDIOOUT_REFCTRL, BIAS_CTRL, 1);
+#if IMX233_SUBTARGET >= 3700
BF_SET(AUDIOOUT_REFCTRL, RAISE_REF);
+#endif
BF_SET(AUDIOOUT_REFCTRL, XTAL_BGR_BIAS);
/* Stop holding to ground */
BF_CLR(AUDIOOUT_ANACTRL, HP_HOLD_GND);
@@ -72,12 +75,12 @@ void imx233_audioout_preinit(void)
HW_AUDIOOUT_DATA = 0;
HW_AUDIOOUT_DATA = 0;
HW_AUDIOOUT_DATA = 0;
- /* wait for everything to stabilize before unmuting */
- timeout_register(&hp_unmute_oneshort, hp_unmute_cb, HZ / 2, 0);
}
void imx233_audioout_postinit(void)
{
+ /* wait for everything to stabilize before unmuting */
+ timeout_register(&hp_unmute_oneshort, hp_unmute_cb, HZ / 2, 0);
}
void imx233_audioout_close(void)
@@ -127,7 +130,11 @@ static void set_hp_vol(int vol_l, int vol_r)
vol_l = MAX(min, MIN(vol_l, max));
vol_r = MAX(min, MIN(vol_r, max));
/* unmute, enable zero cross and set volume.*/
+#if IMX233_SUBTARGET >= 3700
unsigned mstr_zcd = BM_AUDIOOUT_HPVOL_EN_MSTR_ZCD;
+#else
+ unsigned mstr_zcd = 0;
+#endif
HW_AUDIOOUT_HPVOL = mstr_zcd | BF_OR3(AUDIOOUT_HPVOL, SELECT(input_line1),
VOL_LEFT(max - vol_l), VOL_RIGHT(max - vol_r));
}
@@ -183,7 +190,7 @@ void imx233_audioout_set_freq(int fsel)
HW_AUDIOOUT_DACSRR = BF_OR4(AUDIOOUT_DACSRR,
SRC_FRAC(dacssr[fsel].src_frac), SRC_INT(dacssr[fsel].src_int),
SRC_HOLD(dacssr[fsel].src_hold), BASEMULT(dacssr[fsel].base_mult));
-
+
#if 0
/* Select base_mult and src_hold depending on the audio range:
* 0 < f <= 12000 --> base_mult = 1, src_hold = 3 (div by 4)
@@ -218,3 +225,20 @@ void imx233_audioout_select_hp_input(bool line1)
/* reapply volume setting */
apply_volume();
}
+
+void imx233_audioout_set_3d_effect(int val)
+{
+ switch(val)
+ {
+ /* 0 and 1.5dB: off */
+ case 0: case 1: BF_WR(AUDIOOUT_CTRL, SS3D_EFFECT, 0); break;
+ /* 3dB: low */
+ case 2: BF_WR(AUDIOOUT_CTRL, SS3D_EFFECT, 1); break;
+ /* 4.5dB: low */
+ case 3: BF_WR(AUDIOOUT_CTRL, SS3D_EFFECT, 2); break;
+ /* 6dB: low */
+ case 4: BF_WR(AUDIOOUT_CTRL, SS3D_EFFECT, 3); break;
+ /* others: off */
+ default: BF_WR(AUDIOOUT_CTRL, SS3D_EFFECT, 0); break;
+ }
+} \ No newline at end of file