summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index c4b40340bc..887d9d77f7 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -264,6 +264,11 @@ void imx233_audioout_set_3d_effect(int val)
void imx233_audioout_enable_spkr(bool en)
{
+ /* avoid power sequence if not needed */
+ static bool spkr_en = false;
+ if(en == spkr_en)
+ return;
+ spkr_en = true;
#if IMX233_SUBTARGET >= 3780
if(en)
{
@@ -275,6 +280,38 @@ void imx233_audioout_enable_spkr(bool en)
BF_SET(AUDIOOUT_SPEAKERCTRL, MUTE);
BF_SET(AUDIOOUT_PWRDN, SPEAKER);
}
+#elif IMX233_SUBTARGET >= 3700
+ /* assume speaker is wired to lineout */
+ if(en)
+ {
+ /** 1) make sure charge capacitors are discharged */
+ BF_WR(AUDIOOUT_LINEOUTCTRL, CHARGE_CAP, 2);
+ /** 2) set min gain, nominal vag levels and zerocross desires */
+ /* volume is decreasing with the value in the register */
+ BF_SET(AUDIOOUT_LINEOUTCTRL, VOLUME_LEFT);
+ BF_SET(AUDIOOUT_LINEOUTCTRL, VOLUME_RIGHT);
+ BF_SET(AUDIOOUT_LINEOUTCTRL, EN_LINEOUT_ZCD);
+ /* vag should be set to VDDIO/2, 0 is 1.725V, 15 is 1.350V, 25mV steps */
+ int vddio;
+ imx233_power_get_regulator(REGULATOR_VDDIO, &vddio, NULL);
+ BF_WR(AUDIOOUT_LINEOUTCTRL, VAG_CTRL, 15 - (vddio / 2 - 1350) / 25);
+ /** 3) Power up lineout */
+ BF_CLR(AUDIOOUT_PWRDN, LINEOUT);
+ /** 4) Ramp the vag */
+ BF_WR(AUDIOOUT_LINEOUTCTRL, CHARGE_CAP, 1);
+ /** 5) Unmute */
+ BF_CLR(AUDIOOUT_LINEOUTCTRL, MUTE);
+ /** 6) Ramp volume */
+ BF_WR(AUDIOOUT_LINEOUTCTRL, VOLUME_LEFT, 0);
+ BF_WR(AUDIOOUT_LINEOUTCTRL, VOLUME_RIGHT, 0);
+ }
+ else
+ {
+ /** Reverse procedure */
+ BF_SET(AUDIOOUT_LINEOUTCTRL, MUTE);
+ BF_WR(AUDIOOUT_LINEOUTCTRL, CHARGE_CAP, 2);
+ BF_SET(AUDIOOUT_PWRDN, LINEOUT);
+ }
#else
(void) en;
#endif