summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/audioin-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-09-21 00:02:14 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2016-09-21 00:36:51 +0100
commit5e2600eb3ae4563ac9d856ca7a63af1322679ea3 (patch)
tree7b278f129e826bc3e505ea43efe506dfc803f19f /firmware/target/arm/imx233/audioin-imx233.c
parent6f7ee0bb7ce507902f571f823fe173f07ec7e32f (diff)
downloadrockbox-5e2600eb3ae4563ac9d856ca7a63af1322679ea3.tar.gz
rockbox-5e2600eb3ae4563ac9d856ca7a63af1322679ea3.tar.bz2
rockbox-5e2600eb3ae4563ac9d856ca7a63af1322679ea3.zip
imx233: make microphone bias, bias pin and resistor configurable
This clearly fixes recording on targets where the bias pin was wrong. It may also improve recording on targets where the bias voltage was wrong. I was unable to find those parameters on the ZEN Mozaic, which fallback to default values. Change-Id: Ifb5f823c9cbd01f0d9a80fa5d49d93972c8b7cfe
Diffstat (limited to 'firmware/target/arm/imx233/audioin-imx233.c')
-rw-r--r--firmware/target/arm/imx233/audioin-imx233.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/audioin-imx233.c b/firmware/target/arm/imx233/audioin-imx233.c
index e538765244..e221ac07e9 100644
--- a/firmware/target/arm/imx233/audioin-imx233.c
+++ b/firmware/target/arm/imx233/audioin-imx233.c
@@ -26,6 +26,20 @@
/* some audioout registers impact audioin */
#include "regs/audioout.h"
+#include "audio-target.h"
+
+#ifndef IMX233_AUDIO_MIC_SELECT
+#define IMX233_AUDIO_MIC_SELECT 1 /* lradc1 */
+#endif
+
+#ifndef IMX233_AUDIO_MIC_BIAS
+#define IMX233_AUDIO_MIC_BIAS 0 /* 1.21V */
+#endif
+
+#ifndef IMX233_AUDIO_MIC_RESISTOR
+#define IMX233_AUDIO_MIC_RESISTOR 2KOhm
+#endif
+
/* values in half-dB, one for each setting */
static int audioin_vol[2][4]; /* 0=left, 1=right */
static int audioin_select[2]; /* idem */
@@ -58,7 +72,7 @@ void imx233_audioin_open(void)
void imx233_audioin_close(void)
{
- /* Stop ADC (doc says it gate off the module but that's not the case) */
+ /* Stop ADC (doc says it gates off the module but that's not the case) */
BF_CLR(AUDIOIN_CTRL, RUN);
/* Disable ADC clock */
BF_SET(AUDIOIN_ANACLKCTRL, CLKGATE);
@@ -157,9 +171,9 @@ void imx233_audioin_enable_mic(bool enable)
{
if(enable)
{
- BF_WR(AUDIOIN_MICLINE, MIC_RESISTOR_V(2KOhm));
- BF_WR(AUDIOIN_MICLINE, MIC_BIAS(4));
- BF_WR(AUDIOIN_MICLINE, MIC_SELECT(1));
+ BF_WR(AUDIOIN_MICLINE, MIC_RESISTOR_V(IMX233_AUDIO_MIC_RESISTOR));
+ BF_WR(AUDIOIN_MICLINE, MIC_BIAS(IMX233_AUDIO_MIC_BIAS));
+ BF_WR(AUDIOIN_MICLINE, MIC_SELECT(IMX233_AUDIO_MIC_SELECT));
}
else
BF_WR(AUDIOIN_MICLINE, MIC_RESISTOR_V(Off));