mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
6f7ee0bb7c
commit
5e2600eb3a
6 changed files with 43 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue