summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/imx233/audio-imx233.h8
-rw-r--r--firmware/target/arm/imx233/audioin-imx233.c22
-rw-r--r--firmware/target/arm/imx233/creative-zen/audio-target.h6
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/audio-target.h4
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/audio-target.h4
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h4
6 files changed, 43 insertions, 5 deletions
diff --git a/firmware/target/arm/imx233/audio-imx233.h b/firmware/target/arm/imx233/audio-imx233.h
index 035bf357e1..2596e81bac 100644
--- a/firmware/target/arm/imx233/audio-imx233.h
+++ b/firmware/target/arm/imx233/audio-imx233.h
@@ -36,6 +36,12 @@
* IMX233_AUDIO_SPKR_GATE_BANK (gpio bank)
* IMX233_AUDIO_SPKR_GATE_PIN (gpio pin)
* IMX233_AUDIO_SPKR_GATE_INVERTED (define if inverted)
+ *
+ * target can override those to control microphone parameters
+ * NOTE by default, mic select is 1, mic bias is 0 and mic resistor is 2KOhm
+ * IMX233_AUDIO_MIC_SELECT (mic bias pin: 0=lradc0, 1=lradc1)
+ * IMX233_AUDIO_MIC_BIAS (mic bias, 0=1.21V, 1=1.46, ..., 7=2.96V (0.25mV inc)
+ * IMX233_AUDIO_MIC_RESISTOR (mic resistor: 2KOhm, 4KOhm, 8KOhm)
*/
// do some initialisation related to next functions
void imx233_audio_preinit(void);
@@ -45,4 +51,4 @@ void imx233_audio_enable_hp(bool en);
// enable/disable the speaker audio gate (typically using a GPIO)
void imx233_audio_enable_spkr(bool en);
-#endif /* __audio_imx233__ */ \ No newline at end of file
+#endif /* __audio_imx233__ */
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));
diff --git a/firmware/target/arm/imx233/creative-zen/audio-target.h b/firmware/target/arm/imx233/creative-zen/audio-target.h
index 38e0dea0af..807a7b4966 100644
--- a/firmware/target/arm/imx233/creative-zen/audio-target.h
+++ b/firmware/target/arm/imx233/creative-zen/audio-target.h
@@ -28,5 +28,11 @@
#define IMX233_AUDIO_SPKR_GATE_PIN 12
#endif
+#if defined(CREATIVE_ZENXFISTYLE)
+#define IMX233_AUDIO_MIC_SELECT 0 /* lradc0 */
+#define IMX233_AUDIO_MIC_BIAS 0 /* 1.21V */
+#define IMX233_AUDIO_MIC_RESISTOR 2KOhm
+#endif
+
#endif /* __audio_target__ */
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h b/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h
index d38d58bada..4179fe910e 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h
+++ b/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h
@@ -26,4 +26,8 @@
#define IMX233_AUDIO_SPKR_GATE_BANK 0
#define IMX233_AUDIO_SPKR_GATE_PIN 12
+#define IMX233_AUDIO_MIC_SELECT 0 /* lradc0 */
+#define IMX233_AUDIO_MIC_BIAS 0 /* 1.21V */
+#define IMX233_AUDIO_MIC_RESISTOR 2KOhm
+
#endif /* __audio_target__ */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h b/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h
index bdb6b4a610..7286900331 100644
--- a/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h
+++ b/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h
@@ -29,4 +29,8 @@
#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS
+#define IMX233_AUDIO_MIC_SELECT 1 /* lradc1 */
+#define IMX233_AUDIO_MIC_BIAS 0 /* 1.21V */
+#define IMX233_AUDIO_MIC_RESISTOR 2KOhm
+
#endif /* __audio_target__ */
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h
index 59e8fd6f01..46ae86ae94 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h
@@ -23,4 +23,8 @@
#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS
+#define IMX233_AUDIO_MIC_SELECT 1 /* lradc1 */
+#define IMX233_AUDIO_MIC_BIAS 4 /* 2.21V */
+#define IMX233_AUDIO_MIC_RESISTOR 2KOhm
+
#endif /* __audio_target__ */