summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/audioout-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-10-19 17:32:03 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-10-21 01:23:14 +0200
commit898b760e59c19425152050829664f2c915c9f667 (patch)
treefb80511bb03842a6dd76485d28dd2417f1aeee56 /firmware/target/arm/imx233/audioout-imx233.c
parent28669ca0fd1894a727eb4da77843f5435722b449 (diff)
downloadrockbox-898b760e59c19425152050829664f2c915c9f667.tar.gz
rockbox-898b760e59c19425152050829664f2c915c9f667.tar.bz2
rockbox-898b760e59c19425152050829664f2c915c9f667.zip
imx233: fix audioout on stmp3700
Strangely enough, only stmp3780 and stmp3600 have speaker control Change-Id: Icec1ed4b7e80e8b3787a3d08b32695551b58aeb9
Diffstat (limited to 'firmware/target/arm/imx233/audioout-imx233.c')
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index 0ad78d224a..b27f7b37e2 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -260,13 +260,25 @@ struct imx233_audioout_info_t imx233_audioout_get_info(void)
info.hpvol[0] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_LEFT);
info.hpvol[1] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_RIGHT);
info.hpmute[0] = info.hpmute[1] = BF_RD(AUDIOOUT_HPVOL, MUTE);
- info.spkrvol[0] = info.spkrvol[1] = 155;
+#if IMX233_SUBTARGET >= 3780
+ info.spkrvol[0] = info.spkrvol[1] = 155; // volume is fixed to 15.5 dB gain
info.spkrmute[0] = info.spkrmute[1] = BF_RD(AUDIOOUT_SPEAKERCTRL, MUTE);
+ info.spkr = !BF_RD(AUDIOOUT_PWRDN, SPEAKER);
+#elif IMX233_SUBTARGET < 3700
+ /* convert 2-dB to tenth-dB */
+ info.spkrvol[0] = MIN(info.spkrvol[1] = BF_RD(AUDIOOUT_SPKRVOL, VOL), 6) * 20;
+ info.spkrmute[0] = info.spkrmute[1] = BF_RD(AUDIOOUT_SPKRVOL, MUTE);
+ info.spkr = !BF_RD(AUDIOOUT_PWRDN, SPEAKER);
+#else
+ /* STMP3700/3770 has not speaker amplifier */
+ info.spkrvol[0] = info.spkrvol[1] = 0;
+ info.spkrmute[0] = info.spkrmute[1] = true;
+ info.spkr = false;
+#endif
info.ss3d = BF_RD(AUDIOOUT_CTRL, SS3D_EFFECT);
info.ss3d = info.ss3d == 0 ? 0 : 15 * (1 + info.ss3d);
info.hp = !BF_RD(AUDIOOUT_PWRDN, HEADPHONE);
info.dac = !BF_RD(AUDIOOUT_PWRDN, DAC);
info.capless = BF_RD(AUDIOOUT_PWRDN, CAPLESS);
- info.spkr = !BF_RD(AUDIOOUT_PWRDN, SPEAKER);
return info;
} \ No newline at end of file