mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
stmp3700: implement speaker support by mean of lineout
Change-Id: Ic4c8b536fde7a840d3f3f295531cc1253de6320d
This commit is contained in:
parent
b9db3d3743
commit
1450f2658a
1 changed files with 37 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue