diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-03 00:11:20 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-03 04:13:13 +0000 |
commit | 1824f8b103ffbc20ddf5487088ed5d7a3682fb09 (patch) | |
tree | 363d4696386b6f99414d28288ab67b0c4c04eff8 | |
parent | 90c30bc7ef52cd447eb92157c53ba6ffc266efae (diff) | |
download | rockbox-1824f8b103ffbc20ddf5487088ed5d7a3682fb09.tar.gz rockbox-1824f8b103ffbc20ddf5487088ed5d7a3682fb09.zip |
xduoox3ii/x20: Rework the mute control to actually function properly.
(By switching the output away from the audio jacks)
Change-Id: Ib8511c9d45029bba038dc4d1d187174d56cb3043
-rw-r--r-- | firmware/drivers/audio/xduoolinux_codec.c | 34 |
1 files 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 @@ | |||
21 | * | 21 | * |
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | 23 | ||
24 | //#define LOGF_ENABLE | ||
25 | |||
24 | #include "config.h" | 26 | #include "config.h" |
25 | #include "audio.h" | 27 | #include "audio.h" |
26 | #include "audiohw.h" | 28 | #include "audiohw.h" |
@@ -32,6 +34,8 @@ | |||
32 | #include "alsa-controls.h" | 34 | #include "alsa-controls.h" |
33 | #include "pcm-alsa.h" | 35 | #include "pcm-alsa.h" |
34 | 36 | ||
37 | #include "logf.h" | ||
38 | |||
35 | static int fd_hw; | 39 | static int fd_hw; |
36 | static int inited = 0; | 40 | static int inited = 0; |
37 | 41 | ||
@@ -53,24 +57,19 @@ static void hw_close(void) | |||
53 | 57 | ||
54 | void audiohw_mute(int mute) | 58 | void audiohw_mute(int mute) |
55 | { | 59 | { |
60 | logf("mute %d", mute); | ||
61 | |||
56 | if(mute) | 62 | if(mute) |
57 | { | 63 | { |
58 | #if defined(XDUOO_X3II) | 64 | long int ps0 = 0; |
59 | alsa_controls_set_bool("AK4490 Soft Mute", true); | ||
60 | #endif | ||
61 | #if defined(XDUOO_X20) | ||
62 | long int ps0 = (last_ps > 1) ? 1 : 2; | ||
63 | alsa_controls_set_ints("Output Port Switch", 1, &ps0); | 65 | alsa_controls_set_ints("Output Port Switch", 1, &ps0); |
64 | #endif | ||
65 | } | 66 | } |
66 | else | 67 | else |
67 | { | 68 | { |
68 | #if defined(XDUOO_X3II) | 69 | long int ps0 = last_ps; |
69 | alsa_controls_set_bool("AK4490 Soft Mute", false); | 70 | last_ps = 0; |
70 | #endif | 71 | xduoo_get_outputs(); |
71 | #if defined(XDUOO_X20) | 72 | // xduoo_set_output(ps); |
72 | alsa_controls_set_ints("Output Port Switch", 1, &last_ps); | ||
73 | #endif | ||
74 | } | 73 | } |
75 | } | 74 | } |
76 | 75 | ||
@@ -109,6 +108,7 @@ void xduoo_set_output(int ps) | |||
109 | 108 | ||
110 | if (last_ps != ps) | 109 | if (last_ps != ps) |
111 | { | 110 | { |
111 | logf("set out %d/%d", ps, last_ps); | ||
112 | /* Output port switch */ | 112 | /* Output port switch */ |
113 | last_ps = ps; | 113 | last_ps = ps; |
114 | alsa_controls_set_ints("Output Port Switch", 1, &last_ps); | 114 | alsa_controls_set_ints("Output Port Switch", 1, &last_ps); |
@@ -118,18 +118,23 @@ void xduoo_set_output(int ps) | |||
118 | 118 | ||
119 | void audiohw_preinit(void) | 119 | void audiohw_preinit(void) |
120 | { | 120 | { |
121 | logf("hw preinit"); | ||
121 | alsa_controls_init(); | 122 | alsa_controls_init(); |
122 | hw_open(); | 123 | hw_open(); |
124 | audiohw_mute(true); /* Start muted */ | ||
123 | inited = 1; | 125 | inited = 1; |
124 | } | 126 | } |
125 | 127 | ||
126 | void audiohw_postinit(void) | 128 | void audiohw_postinit(void) |
127 | { | 129 | { |
130 | logf("hw postinit"); | ||
131 | audiohw_mute(true); /* Stay muted */ | ||
128 | xduoo_set_output(xduoo_get_outputs()); | 132 | xduoo_set_output(xduoo_get_outputs()); |
129 | } | 133 | } |
130 | 134 | ||
131 | void audiohw_close(void) | 135 | void audiohw_close(void) |
132 | { | 136 | { |
137 | logf("hw close"); | ||
133 | inited = 0; | 138 | inited = 0; |
134 | hw_close(); | 139 | hw_close(); |
135 | alsa_controls_close(); | 140 | alsa_controls_close(); |
@@ -142,6 +147,8 @@ void audiohw_set_frequency(int fsel) | |||
142 | 147 | ||
143 | void audiohw_set_volume(int vol_l, int vol_r) | 148 | void audiohw_set_volume(int vol_l, int vol_r) |
144 | { | 149 | { |
150 | logf("hw vol %d %d", vol_l, vol_r); | ||
151 | |||
145 | long l,r; | 152 | long l,r; |
146 | 153 | ||
147 | vol_l_hw = vol_l; | 154 | vol_l_hw = vol_l; |
@@ -163,6 +170,8 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) | |||
163 | { | 170 | { |
164 | long l,r; | 171 | long l,r; |
165 | 172 | ||
173 | logf("lo vol %d %d", vol_l, vol_r); | ||
174 | |||
166 | (void)vol_l; | 175 | (void)vol_l; |
167 | (void)vol_r; | 176 | (void)vol_r; |
168 | 177 | ||
@@ -180,6 +189,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) | |||
180 | 189 | ||
181 | void audiohw_set_filter_roll_off(int value) | 190 | void audiohw_set_filter_roll_off(int value) |
182 | { | 191 | { |
192 | logf("rolloff %d", value); | ||
183 | /* 0 = Sharp; | 193 | /* 0 = Sharp; |
184 | 1 = Slow; | 194 | 1 = Slow; |
185 | 2 = Short Sharp | 195 | 2 = Short Sharp |