From e876f4df6d240bd2e319b1e63be95a625f049a97 Mon Sep 17 00:00:00 2001 From: Lorenzo Miori Date: Tue, 10 Sep 2013 22:48:34 +0200 Subject: Samsung YP-R1 target port This is the basic port to the new target Samsung YP-R1, which runs on a similar platform as YP-R0. Port is usable, although there are still some optimizations that have to be done. Change-Id: If83a8e386369e413581753780c159026d9e41f04 --- .../target/hosted/samsungypr/ypr1/audio-ypr1.c | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c (limited to 'firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c') diff --git a/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c new file mode 100644 index 0000000000..05b77a8ff2 --- /dev/null +++ b/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c @@ -0,0 +1,76 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Nils Wallménius + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "system.h" +#include "audiohw.h" +#include "audio.h" + +void audiohw_enable_tone_controls(bool enable); +void audiohw_enable_depth_3d(bool enable); + +/* Set the audio source for IIS TX */ +void audio_set_output_source(int source) +{ + switch (source) + { + default: + case AUDIO_SRC_PLAYBACK: + /* + audiohw_enable_tone_controls(true); + audiohw_enable_depth_3d(true); + */ + break; + + case AUDIO_SRC_FMRADIO: + /* Analog path doesn't support these and digital radio playback + * cannot be done without mixing on the MCU if voice is to be + * heard. Any recording should match what is heard. */ + audiohw_enable_tone_controls(false); + audiohw_enable_depth_3d(false); + break; + } +} + +void audio_input_mux(int source, unsigned int flags) +{ + /* Prevent pops from unneeded switching */ + static int last_source = AUDIO_SRC_PLAYBACK; + bool recording = flags & SRCF_RECORDING; + static bool last_recording = false; + + switch (source) + { + default: + source = AUDIO_SRC_PLAYBACK; + /* Fallthrough */ + case AUDIO_SRC_PLAYBACK: /* playback - no recording */ + if (source != last_source) + audiohw_set_recsrc(AUDIO_SRC_PLAYBACK, false); + break; + + case AUDIO_SRC_FMRADIO: /* recording and playback */ + if (source != last_source || recording != last_recording) + audiohw_set_recsrc(AUDIO_SRC_FMRADIO, recording); + break; + } + + last_source = source; + last_recording = recording; +} -- cgit v1.2.3