summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/audio/eros_qn_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/eros_qn_codec.c')
-rw-r--r--firmware/drivers/audio/eros_qn_codec.c57
1 files changed, 15 insertions, 42 deletions
diff --git a/firmware/drivers/audio/eros_qn_codec.c b/firmware/drivers/audio/eros_qn_codec.c
index da50d62fe5..095b3b5305 100644
--- a/firmware/drivers/audio/eros_qn_codec.c
+++ b/firmware/drivers/audio/eros_qn_codec.c
@@ -26,64 +26,37 @@
#include "audiohw.h"
#include "settings.h"
#include "pcm_sw_volume.h"
-#include "gpio-x1000.h"
-static long int vol_l_hw = 0;
-static long int vol_r_hw = 0;
+#include "gpio-x1000.h"
-/* internal: mute the headphone amp. 0 - unmuted, 1 - muted */
-void audiohw_mute_hp(int mute);
+static long int vol_l_hw = PCM5102A_VOLUME_MIN;
+static long int vol_r_hw = PCM5102A_VOLUME_MIN;
+int es9018k2m_present_flag = 0;
-void pcm5102_set_outputs(void)
+void eros_qn_set_outputs(void)
{
audiohw_set_volume(vol_l_hw, vol_r_hw);
}
-/* this makes less sense here than it does in the audiohw-*.c file,
- * but we need access to settings.h */
-void audiohw_set_volume(int vol_l, int vol_r)
+void eros_qn_set_last_vol(long int vol_l, long int vol_r)
{
- int l, r;
-
vol_l_hw = vol_l;
vol_r_hw = vol_r;
+}
- l = vol_l;
- r = vol_r;
-
-#if (defined(HAVE_HEADPHONE_DETECTION) && defined(HAVE_LINEOUT_DETECTION))
- /* make sure headphones aren't present - don't want to
- * blow out our eardrums cranking it to full */
- if (lineout_inserted() && !headphones_inserted())
- {
- l = r = global_settings.volume_limit * 10;
-
- /* mute the headphone amp if not plugged in */
- audiohw_mute_hp(1);
- }
- else
- {
- /* unmute the headphone amp when plugged in */
- audiohw_mute_hp(0);
- l = vol_l;
- r = vol_r;
- }
-#endif
-
- l = l <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : (l / 20);
- r = r <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : (r / 20);
-
- pcm_set_master_volume(l, r);
+int eros_qn_get_volume_limit(void)
+{
+ return (global_settings.volume_limit * 10);
}
-void audiohw_mute_hp(int mute)
+void eros_qn_switch_output(int select)
{
- if (mute == 0)
+ if (select == 0)
{
- gpio_set_level(GPIO_MAX97220_SHDN, 1);
+ gpio_set_level(GPIO_STEREOSW_SEL, 0);
}
else
{
- gpio_set_level(GPIO_MAX97220_SHDN, 0);
+ gpio_set_level(GPIO_STEREOSW_SEL, 1);
}
-}
+} \ No newline at end of file