diff options
7 files changed, 31 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c index b27f7b37e2..26a480d05c 100644 --- a/firmware/target/arm/imx233/audioout-imx233.c +++ b/firmware/target/arm/imx233/audioout-imx233.c @@ -23,6 +23,15 @@ #include "rtc-imx233.h" #include "pcm_sampr.h" #include "string.h" +#include "audio-target.h" + +#ifndef IMX233_AUDIO_COUPLING_MODE +#error You must define IMX233_AUDIO_COUPLING_MODE +#endif + +#if IMX233_AUDIO_COUPLING_MODE != ACM_CAP && IMX233_AUDIO_COUPLING_MODE != ACM_CAPLESS +#error Invalid value for IMX233_AUDIO_COUPLING_MODE +#endif static int hp_vol_l, hp_vol_r; static bool input_line1; @@ -46,7 +55,11 @@ void imx233_audioout_preinit(void) /* Enable DAC */ BF_CLR(AUDIOOUT_ANACLKCTRL, CLKGATE); /* Set capless mode */ +#if IMX233_AUDIO_COUPLING_MODE == ACM_CAP + BF_SET(AUDIOOUT_PWRDN, CAPLESS); +#else BF_CLR(AUDIOOUT_PWRDN, CAPLESS); +#endif /* Set word-length to 16-bit */ BF_SET(AUDIOOUT_CTRL, WORD_LENGTH); /* Power up DAC */ diff --git a/firmware/target/arm/imx233/audioout-imx233.h b/firmware/target/arm/imx233/audioout-imx233.h index b5c16767c6..88163e7ad2 100644 --- a/firmware/target/arm/imx233/audioout-imx233.h +++ b/firmware/target/arm/imx233/audioout-imx233.h @@ -27,6 +27,14 @@ #include "regs/regs-audioout.h" +/* target-defined output stage coupling method + * its setting is IMX233_AUDIO_COUPLING_MODE and must be set for every target + * Use ACM_CAP if output stage (i.e. headphones) have output capacitors, + * ACM_CAPLESS (DC-coupled) otherwise. + */ +#define ACM_CAPLESS 0 +#define ACM_CAP 1 + struct imx233_audioout_info_t { // NOTE there is a convention here: dac -> dacvol -> dacmute diff --git a/firmware/target/arm/imx233/creative-zen/audio-target.h b/firmware/target/arm/imx233/creative-zen/audio-target.h index 4ee2e2f402..192539211e 100644 --- a/firmware/target/arm/imx233/creative-zen/audio-target.h +++ b/firmware/target/arm/imx233/creative-zen/audio-target.h @@ -21,5 +21,7 @@ #ifndef __audio_target__ #define __audio_target__ +#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS + #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 afa3d9649b..59e8fd6f01 100644 --- a/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h +++ b/firmware/target/arm/imx233/creative-zenxfi2/audio-target.h @@ -21,4 +21,6 @@ #ifndef __audio_target__ #define __audio_target__ +#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS + #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 0b4610cd1a..bdb6b4a610 100644 --- a/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h +++ b/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h @@ -27,4 +27,6 @@ #define IMX233_AUDIO_SPKR_GATE_BANK 1 #define IMX233_AUDIO_SPKR_GATE_PIN 22 +#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS + #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 afa3d9649b..59e8fd6f01 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h +++ b/firmware/target/arm/imx233/sansa-fuzeplus/audio-target.h @@ -21,4 +21,6 @@ #ifndef __audio_target__ #define __audio_target__ +#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS + #endif /* __audio_target__ */ diff --git a/firmware/target/arm/imx233/sony-nwz/audio-target.h b/firmware/target/arm/imx233/sony-nwz/audio-target.h index afa3d9649b..59e8fd6f01 100644 --- a/firmware/target/arm/imx233/sony-nwz/audio-target.h +++ b/firmware/target/arm/imx233/sony-nwz/audio-target.h @@ -21,4 +21,6 @@ #ifndef __audio_target__ #define __audio_target__ +#define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS + #endif /* __audio_target__ */ |