diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2018-02-19 16:28:11 +1100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-31 14:16:31 +0000 |
commit | dd82f13fa1241266576b508180fcf90b8d9bda2c (patch) | |
tree | cdae2331353e4f85a296782b14001d021923ddfc /firmware/drivers | |
parent | ce9e7e712238dc69a825a49f4f226ff47fbbff69 (diff) | |
download | rockbox-dd82f13fa1241266576b508180fcf90b8d9bda2c.tar.gz rockbox-dd82f13fa1241266576b508180fcf90b8d9bda2c.zip |
nwz/alsa: various improvements
Also audiohw driver to specific device name, rewrite alsa controls code to
cache more data, thus making the code easier and use less stack. Avoid using
short/long in pcm alsa code since it's the wrong size on 64-bit (simulator
for example)
Change-Id: Ibc1ec44396e37b6cbdedbcf37300878638e5d2d3
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/audio/erosqlinux_codec.c | 2 | ||||
-rw-r--r-- | firmware/drivers/audio/fiiolinux_codec.c | 8 | ||||
-rw-r--r-- | firmware/drivers/audio/nwzlinux-codec.c | 5 | ||||
-rw-r--r-- | firmware/drivers/audio/rocker_codec.c | 2 | ||||
-rw-r--r-- | firmware/drivers/audio/xduoolinux_codec.c | 2 |
5 files changed, 9 insertions, 10 deletions
diff --git a/firmware/drivers/audio/erosqlinux_codec.c b/firmware/drivers/audio/erosqlinux_codec.c index 3b7155faef..c288c63c4f 100644 --- a/firmware/drivers/audio/erosqlinux_codec.c +++ b/firmware/drivers/audio/erosqlinux_codec.c | |||
@@ -143,7 +143,7 @@ void erosq_set_output(int ps) | |||
143 | void audiohw_preinit(void) | 143 | void audiohw_preinit(void) |
144 | { | 144 | { |
145 | logf("hw preinit"); | 145 | logf("hw preinit"); |
146 | alsa_controls_init(); | 146 | alsa_controls_init("default"); |
147 | hw_open(); | 147 | hw_open(); |
148 | audiohw_mute(false); /* No need to stay muted */ | 148 | audiohw_mute(false); /* No need to stay muted */ |
149 | } | 149 | } |
diff --git a/firmware/drivers/audio/fiiolinux_codec.c b/firmware/drivers/audio/fiiolinux_codec.c index 8b1f14662e..b2d95c91e9 100644 --- a/firmware/drivers/audio/fiiolinux_codec.c +++ b/firmware/drivers/audio/fiiolinux_codec.c | |||
@@ -67,7 +67,7 @@ static void hw_close(void) | |||
67 | 67 | ||
68 | void audiohw_preinit(void) | 68 | void audiohw_preinit(void) |
69 | { | 69 | { |
70 | alsa_controls_init(); | 70 | alsa_controls_init("default"); |
71 | hw_open(); | 71 | hw_open(); |
72 | // NOTE: | 72 | // NOTE: |
73 | // Of the exported controls, only these do anything: | 73 | // Of the exported controls, only these do anything: |
@@ -130,7 +130,7 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
130 | if (!muted) { | 130 | if (!muted) { |
131 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol_hw[0]); | 131 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol_hw[0]); |
132 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol_hw[1]); | 132 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol_hw[1]); |
133 | pcm_alsa_set_digital_volume(vol_sw[0], vol_sw[1]); | 133 | pcm_set_mixer_volume(vol_sw[0], vol_sw[1]); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
@@ -147,13 +147,13 @@ void audiohw_mute(int mute) | |||
147 | { | 147 | { |
148 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol0); | 148 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol0); |
149 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol0); | 149 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol0); |
150 | pcm_alsa_set_digital_volume(0, 0); | 150 | pcm_set_mixer_volume(0, 0); |
151 | } | 151 | } |
152 | else | 152 | else |
153 | { | 153 | { |
154 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol_hw[0]); | 154 | alsa_controls_set_ints("DACL Playback Volume", 1, &vol_hw[0]); |
155 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol_hw[1]); | 155 | alsa_controls_set_ints("DACR Playback Volume", 1, &vol_hw[1]); |
156 | pcm_alsa_set_digital_volume(vol_sw[0], vol_sw[1]); | 156 | pcm_set_mixer_volume(vol_sw[0], vol_sw[1]); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
diff --git a/firmware/drivers/audio/nwzlinux-codec.c b/firmware/drivers/audio/nwzlinux-codec.c index ca5e274255..5085befb20 100644 --- a/firmware/drivers/audio/nwzlinux-codec.c +++ b/firmware/drivers/audio/nwzlinux-codec.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "audio.h" | 26 | #include "audio.h" |
27 | #include "sound.h" | 27 | #include "sound.h" |
28 | #include "audiohw.h" | 28 | #include "audiohw.h" |
29 | #include "cscodec.h" | ||
30 | #include "nwzlinux_codec.h" | 29 | #include "nwzlinux_codec.h" |
31 | #include "stdlib.h" | 30 | #include "stdlib.h" |
32 | #include "panic.h" | 31 | #include "panic.h" |
@@ -313,7 +312,7 @@ void audiohw_set_playback_src(enum nwz_src_t src) | |||
313 | 312 | ||
314 | void audiohw_preinit(void) | 313 | void audiohw_preinit(void) |
315 | { | 314 | { |
316 | alsa_controls_init(); | 315 | alsa_controls_init("default"); |
317 | /* turn on codec */ | 316 | /* turn on codec */ |
318 | alsa_controls_set_bool("CODEC Power Switch", true); | 317 | alsa_controls_set_bool("CODEC Power Switch", true); |
319 | /* mute */ | 318 | /* mute */ |
@@ -416,7 +415,7 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
416 | printf(" set driver volume %d (%d dB)\n", drv_vol, curve->level[drv_vol] / 10); | 415 | printf(" set driver volume %d (%d dB)\n", drv_vol, curve->level[drv_vol] / 10); |
417 | nwz_set_driver_vol(drv_vol); | 416 | nwz_set_driver_vol(drv_vol); |
418 | printf(" set digital volume %d dB\n", vol / 10); | 417 | printf(" set digital volume %d dB\n", vol / 10); |
419 | pcm_alsa_set_digital_volume(vol / 10, vol / 10); | 418 | pcm_set_mixer_volume(vol / 10, vol / 10); |
420 | } | 419 | } |
421 | 420 | ||
422 | void audiohw_close(void) | 421 | void audiohw_close(void) |
diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c index b4ebdd7816..20c6e1e795 100644 --- a/firmware/drivers/audio/rocker_codec.c +++ b/firmware/drivers/audio/rocker_codec.c | |||
@@ -69,7 +69,7 @@ void audiohw_mute(int mute) | |||
69 | 69 | ||
70 | void audiohw_preinit(void) | 70 | void audiohw_preinit(void) |
71 | { | 71 | { |
72 | alsa_controls_init(); | 72 | alsa_controls_init("debug"); |
73 | hw_open(); | 73 | hw_open(); |
74 | #if defined(AUDIOHW_MUTE_ON_STOP) || defined(AUDIOHW_NEEDS_INITIAL_UNMUTE) | 74 | #if defined(AUDIOHW_MUTE_ON_STOP) || defined(AUDIOHW_NEEDS_INITIAL_UNMUTE) |
75 | audiohw_mute(true); /* Start muted to avoid the POP */ | 75 | audiohw_mute(true); /* Start muted to avoid the POP */ |
diff --git a/firmware/drivers/audio/xduoolinux_codec.c b/firmware/drivers/audio/xduoolinux_codec.c index 5452a0f5c3..3ce35aa62a 100644 --- a/firmware/drivers/audio/xduoolinux_codec.c +++ b/firmware/drivers/audio/xduoolinux_codec.c | |||
@@ -166,7 +166,7 @@ void xduoo_set_output(int ps) | |||
166 | void audiohw_preinit(void) | 166 | void audiohw_preinit(void) |
167 | { | 167 | { |
168 | logf("hw preinit"); | 168 | logf("hw preinit"); |
169 | alsa_controls_init(); | 169 | alsa_controls_init("default"); |
170 | hw_open(); | 170 | hw_open(); |
171 | 171 | ||
172 | #if defined(XDUOO_X3II) | 172 | #if defined(XDUOO_X3II) |