From 1824f8b103ffbc20ddf5487088ed5d7a3682fb09 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 3 Oct 2020 00:11:20 -0400 Subject: xduoox3ii/x20: Rework the mute control to actually function properly. (By switching the output away from the audio jacks) Change-Id: Ib8511c9d45029bba038dc4d1d187174d56cb3043 --- firmware/drivers/audio/xduoolinux_codec.c | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/firmware/drivers/audio/xduoolinux_codec.c b/firmware/drivers/audio/xduoolinux_codec.c index f8de0bf78d..829b9dd334 100644 --- a/firmware/drivers/audio/xduoolinux_codec.c +++ b/firmware/drivers/audio/xduoolinux_codec.c @@ -21,6 +21,8 @@ * ****************************************************************************/ +//#define LOGF_ENABLE + #include "config.h" #include "audio.h" #include "audiohw.h" @@ -32,6 +34,8 @@ #include "alsa-controls.h" #include "pcm-alsa.h" +#include "logf.h" + static int fd_hw; static int inited = 0; @@ -53,24 +57,19 @@ static void hw_close(void) void audiohw_mute(int mute) { + logf("mute %d", mute); + if(mute) { -#if defined(XDUOO_X3II) - alsa_controls_set_bool("AK4490 Soft Mute", true); -#endif -#if defined(XDUOO_X20) - long int ps0 = (last_ps > 1) ? 1 : 2; + long int ps0 = 0; alsa_controls_set_ints("Output Port Switch", 1, &ps0); -#endif } else { -#if defined(XDUOO_X3II) - alsa_controls_set_bool("AK4490 Soft Mute", false); -#endif -#if defined(XDUOO_X20) - alsa_controls_set_ints("Output Port Switch", 1, &last_ps); -#endif + long int ps0 = last_ps; + last_ps = 0; + xduoo_get_outputs(); +// xduoo_set_output(ps); } } @@ -109,6 +108,7 @@ void xduoo_set_output(int ps) if (last_ps != ps) { + logf("set out %d/%d", ps, last_ps); /* Output port switch */ last_ps = ps; alsa_controls_set_ints("Output Port Switch", 1, &last_ps); @@ -118,18 +118,23 @@ void xduoo_set_output(int ps) void audiohw_preinit(void) { + logf("hw preinit"); alsa_controls_init(); hw_open(); + audiohw_mute(true); /* Start muted */ inited = 1; } void audiohw_postinit(void) { + logf("hw postinit"); + audiohw_mute(true); /* Stay muted */ xduoo_set_output(xduoo_get_outputs()); } void audiohw_close(void) { + logf("hw close"); inited = 0; hw_close(); alsa_controls_close(); @@ -142,6 +147,8 @@ void audiohw_set_frequency(int fsel) void audiohw_set_volume(int vol_l, int vol_r) { + logf("hw vol %d %d", vol_l, vol_r); + long l,r; vol_l_hw = vol_l; @@ -163,6 +170,8 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) { long l,r; + logf("lo vol %d %d", vol_l, vol_r); + (void)vol_l; (void)vol_r; @@ -180,6 +189,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) void audiohw_set_filter_roll_off(int value) { + logf("rolloff %d", value); /* 0 = Sharp; 1 = Slow; 2 = Short Sharp -- cgit v1.2.3