From 812c3e7c48e03d0a6457adf754cb549959550f70 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 16 Feb 2014 20:46:00 +0100 Subject: [PATCH] imx233: add support for speaker on stmp3780 Change-Id: I990ca2bd43e12047e257f85ff06f046dfa3f94b3 --- firmware/drivers/audio/imx233-codec.c | 8 ++++++++ firmware/target/arm/imx233/audioout-imx233.c | 18 ++++++++++++++++++ firmware/target/arm/imx233/audioout-imx233.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/firmware/drivers/audio/imx233-codec.c b/firmware/drivers/audio/imx233-codec.c index 94a1218d5e..b2dcaa3d23 100644 --- a/firmware/drivers/audio/imx233-codec.c +++ b/firmware/drivers/audio/imx233-codec.c @@ -101,3 +101,11 @@ void audiohw_set_monitor(bool enable) { imx233_audioout_select_hp_input(enable); } + +#ifdef HAVE_SPEAKER +void audiohw_enable_speaker(bool en) +{ + imx233_audioout_enable_spkr(en); + imx233_audio_enable_spkr(en); +} +#endif diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c index c92804c2d4..3b6203ea44 100644 --- a/firmware/target/arm/imx233/audioout-imx233.c +++ b/firmware/target/arm/imx233/audioout-imx233.c @@ -261,6 +261,24 @@ void imx233_audioout_set_3d_effect(int val) } } +void imx233_audioout_enable_spkr(bool en) +{ +#if IMX233_SUBTARGET >= 3780 + if(en) + { + BF_CLR(AUDIOOUT_PWRDN, SPEAKER); + BF_CLR(AUDIOOUT_SPEAKERCTRL, MUTE); + } + else + { + BF_SET(AUDIOOUT_SPEAKERCTRL, MUTE); + BF_SET(AUDIOOUT_PWRDN, SPEAKER); + } +#else + (void) en; +#endif +} + struct imx233_audioout_info_t imx233_audioout_get_info(void) { struct imx233_audioout_info_t info; diff --git a/firmware/target/arm/imx233/audioout-imx233.h b/firmware/target/arm/imx233/audioout-imx233.h index 88163e7ad2..47bb815a08 100644 --- a/firmware/target/arm/imx233/audioout-imx233.h +++ b/firmware/target/arm/imx233/audioout-imx233.h @@ -64,6 +64,8 @@ void imx233_audioout_set_freq(int fsel); void imx233_audioout_select_hp_input(bool line1); /* value in 1.5dB steps, from 0dB to 6dB */ void imx233_audioout_set_3d_effect(int val); +/* enable/disable speaker amplifier */ +void imx233_audioout_enable_spkr(bool en); struct imx233_audioout_info_t imx233_audioout_get_info(void);