From fe2d52cc7d0180acff26349f2904fba854de6fbc Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 30 Oct 2020 20:30:27 -0400 Subject: [PATCH] pcm: Get rid of pcm_play_pause() and associated APIs Nothing in the core has used it for some time. It's exported to the plugin API but the last plugins to use it were switched to the mixer API back in 2011. This allows us to get rid of pcm_play_dma_pause() from all audio drivers Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b --- apps/plugin.c | 2 - apps/plugin.h | 2 - apps/plugins/lua/include_lua/pcm.lua | 2 - apps/plugins/lua/rocklib.c | 15 ++---- docs/PLUGIN_API | 12 +---- firmware/drivers/audio/rocker_codec.c | 2 +- firmware/export/fiiolinux_codec.h | 2 +- firmware/export/pcm-internal.h | 3 -- firmware/export/pcm.h | 2 - firmware/export/rocker_codec.h | 2 +- firmware/export/xduoolinux_codec.h | 2 +- firmware/pcm.c | 53 +------------------ firmware/pcm_sw_volume.c | 10 ---- firmware/target/arm/as3525/pcm-as3525.c | 20 ------- firmware/target/arm/imx233/pcm-imx233.c | 6 --- .../arm/imx31/gigabeat-s/pcm-gigabeat-s.c | 14 ----- firmware/target/arm/pcm-telechips.c | 9 ---- firmware/target/arm/pnx0101/pcm-pnx0101.c | 7 +-- firmware/target/arm/pp/pcm-pp.c | 9 ---- firmware/target/arm/rk27xx/pcm-rk27xx.c | 15 ------ .../arm/s3c2440/gigabeat-fx/pcm-meg-fx.c | 18 ------- .../arm/s3c2440/mini2440/pcm-mini2440.c | 18 ------- firmware/target/arm/s5l8700/pcm-s5l8700.c | 12 ----- firmware/target/arm/s5l8702/pcm-s5l8702.c | 7 --- .../creative-zvm/pcm-creativezvm.c | 5 -- .../arm/tms320dm320/mrobe-500/pcm-mr500.c | 14 ----- .../sansa-connect/pcm-sansaconnect.c | 14 ----- firmware/target/coldfire/pcm-coldfire.c | 19 ------- firmware/target/hosted/android/pcm-android.c | 15 ++---- firmware/target/hosted/ibasso/pcm-ibasso.c | 16 ------ firmware/target/hosted/maemo/pcm-gstreamer.c | 17 ------ firmware/target/hosted/pcm-alsa.c | 32 ++--------- firmware/target/hosted/sdl/pcm-sdl.c | 8 --- .../target/mips/ingenic_jz47xx/pcm-jz4740.c | 12 ----- .../target/mips/ingenic_jz47xx/pcm-jz4760.c | 12 ----- 35 files changed, 20 insertions(+), 388 deletions(-) diff --git a/apps/plugin.c b/apps/plugin.c index 4a50c2b3a3..584fbf1ab3 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -602,8 +602,6 @@ static const struct plugin_api rockbox_api = { pcm_play_stop, pcm_set_frequency, pcm_is_playing, - pcm_is_paused, - pcm_play_pause, pcm_get_bytes_waiting, pcm_calculate_peaks, pcm_get_peak_buffer, diff --git a/apps/plugin.h b/apps/plugin.h index 395caaddc0..c2538b0cf5 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -677,8 +677,6 @@ struct plugin_api { void (*pcm_play_stop)(void); void (*pcm_set_frequency)(unsigned int frequency); bool (*pcm_is_playing)(void); - bool (*pcm_is_paused)(void); - void (*pcm_play_pause)(bool play); size_t (*pcm_get_bytes_waiting)(void); void (*pcm_calculate_peaks)(int *left, int *right); const void* (*pcm_get_peak_buffer)(int *count); diff --git a/apps/plugins/lua/include_lua/pcm.lua b/apps/plugins/lua/include_lua/pcm.lua index 6b2b6db204..46cc5b0720 100644 --- a/apps/plugins/lua/include_lua/pcm.lua +++ b/apps/plugins/lua/include_lua/pcm.lua @@ -26,11 +26,9 @@ if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end rb.pcm_apply_settings = function() rb.pcm("apply_settings") end rb.pcm_set_frequency = function(freq) rb.pcm("set_frequency", freq) end -rb.pcm_play_pause = function(bplay) rb.pcm("play_pause", bplay) end rb.pcm_play_stop = function() rb.pcm("play_stop") end rb.pcm_play_lock = function() rb.pcm("play_lock") end rb.pcm_play_unlock = function() rb.pcm("play_unlock") end rb.pcm_is_playing = function() return rb.pcm("is_playing") end -rb.pcm_is_paused = function() return rb.pcm("is_paused") end rb.pcm_calculate_peaks = function() return rb.pcm("calculate_peaks") end rb.pcm_get_bytes_waiting = function() return rb.pcm("get_bytes_waiting") end diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 8921c0a4c3..6219bb2e5a 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -519,12 +519,12 @@ RB_WRAP(sound) RB_WRAP(pcm) { - enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, PCM_ISPAUSED, - PCM_PLAYSTOP, PCM_PLAYPAUSE, PCM_PLAYLOCK, PCM_PLAYUNLOCK, + enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, + PCM_PLAYSTOP, PCM_PLAYLOCK, PCM_PLAYUNLOCK, PCM_CALCULATEPEAKS, PCM_SETFREQUENCY, PCM_GETBYTESWAITING, PCM_ECOUNT}; - const char *pcm_option[] = {"apply_settings", "is_playing", "is_paused", - "play_stop", "play_pause", "play_lock", "play_unlock", + const char *pcm_option[] = {"apply_settings", "is_playing", + "play_stop", "play_lock", "play_unlock", "calculate_peaks", "set_frequency", "get_bytes_waiting", NULL}; bool b_result; int left, right; @@ -542,13 +542,6 @@ RB_WRAP(pcm) b_result = rb->pcm_is_playing(); lua_pushboolean(L, b_result); break; - case PCM_ISPAUSED: - b_result = rb->pcm_is_paused(); - lua_pushboolean(L, b_result); - break; - case PCM_PLAYPAUSE: - rb->pcm_play_pause(luaL_checkboolean(L, 2)); - break; case PCM_PLAYSTOP: rb->pcm_play_stop(); break; diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API index 84c203c05a..b77d25a4b9 100644 --- a/docs/PLUGIN_API +++ b/docs/PLUGIN_API @@ -1430,11 +1430,6 @@ void pcm_init_recording(void) \conditions defined(HAVE_RECORDING) \description -bool pcm_is_paused(void) - \group sound - \return true if playback is paused, else false - \description - bool pcm_is_playing(void) \group sound \return true unless playback is paused @@ -1451,14 +1446,9 @@ void pcm_play_lock(void) \group sound \description -void pcm_play_pause(bool play) - \group sound - \param play - \description Pauses or unpauses the playback depending on the truth value of =play= - void pcm_play_stop(void) \group sound - \description Stops the playback and empties the audio buffer unlike [F[pcm_play_pause]] + \description Stops the playback and empties the audio buffer. void pcm_play_unlock(void) \group sound diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c index 4beda4b572..b4ebdd7816 100644 --- a/firmware/drivers/audio/rocker_codec.c +++ b/firmware/drivers/audio/rocker_codec.c @@ -71,7 +71,7 @@ void audiohw_preinit(void) { alsa_controls_init(); hw_open(); -#if defined(AUDIOHW_MUTE_ON_PAUSE) || defined (AUDIOHW_NEEDS_INITIAL_UNMUTE) +#if defined(AUDIOHW_MUTE_ON_STOP) || defined(AUDIOHW_NEEDS_INITIAL_UNMUTE) audiohw_mute(true); /* Start muted to avoid the POP */ #else audiohw_mute(false); diff --git a/firmware/export/fiiolinux_codec.h b/firmware/export/fiiolinux_codec.h index 118a0928d7..5fa7ae2b10 100644 --- a/firmware/export/fiiolinux_codec.h +++ b/firmware/export/fiiolinux_codec.h @@ -7,6 +7,6 @@ AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 0, -30) AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0) #endif -#define AUDIOHW_MUTE_ON_PAUSE +#define AUDIOHW_MUTE_ON_STOP void audiohw_mute(int mute); diff --git a/firmware/export/pcm-internal.h b/firmware/export/pcm-internal.h index 7670f99f04..d5d46c33e1 100644 --- a/firmware/export/pcm-internal.h +++ b/firmware/export/pcm-internal.h @@ -119,7 +119,6 @@ pcm_play_dma_status_callback(enum pcm_dma_status status) #if defined(HAVE_SW_VOLUME_CONTROL) && !defined(PCM_SW_VOLUME_UNBUFFERED) void pcm_play_dma_start_int(const void *addr, size_t size); -void pcm_play_dma_pause_int(bool pause); void pcm_play_dma_stop_int(void); void pcm_play_stop_int(void); const void *pcm_play_dma_get_peak_buffer_int(int *count); @@ -139,7 +138,6 @@ void * pcm_dma_addr(void *addr); #endif extern volatile bool pcm_playing; -extern volatile bool pcm_paused; void pcm_play_dma_lock(void); void pcm_play_dma_unlock(void); @@ -147,7 +145,6 @@ void pcm_play_dma_init(void) INIT_ATTR; void pcm_play_dma_postinit(void); void pcm_play_dma_start(const void *addr, size_t size); void pcm_play_dma_stop(void); -void pcm_play_dma_pause(bool pause); const void * pcm_play_dma_get_peak_buffer(int *count); void pcm_dma_apply_settings(void); diff --git a/firmware/export/pcm.h b/firmware/export/pcm.h index 23c0bd4a0b..61e11ef801 100644 --- a/firmware/export/pcm.h +++ b/firmware/export/pcm.h @@ -90,8 +90,6 @@ const void* pcm_get_peak_buffer(int* count); size_t pcm_get_bytes_waiting(void); void pcm_play_stop(void); -void pcm_play_pause(bool play); -bool pcm_is_paused(void); bool pcm_is_playing(void); #ifdef HAVE_RECORDING diff --git a/firmware/export/rocker_codec.h b/firmware/export/rocker_codec.h index c1ee7b87bc..9eb4954f0b 100644 --- a/firmware/export/rocker_codec.h +++ b/firmware/export/rocker_codec.h @@ -5,7 +5,7 @@ AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -115*10, 0, -30*10) #endif -//#define AUDIOHW_MUTE_ON_PAUSE +//#define AUDIOHW_MUTE_ON_STOP //#define AUDIOHW_NEEDS_INITIAL_UNMUTE /* Note: Due to Kernel bug, we can't use MUTE_ON_PAUSE with backlight fading */ diff --git a/firmware/export/xduoolinux_codec.h b/firmware/export/xduoolinux_codec.h index 744be58e30..301a341f15 100644 --- a/firmware/export/xduoolinux_codec.h +++ b/firmware/export/xduoolinux_codec.h @@ -7,7 +7,7 @@ AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0) #endif // We want this, but the codec takes over a second to unmute! -//#define AUDIOHW_MUTE_ON_PAUSE +//#define AUDIOHW_MUTE_ON_STOP #if defined(XDUOO_X3II) /* The AK4490 glitches when switching sample rates */ diff --git a/firmware/pcm.c b/firmware/pcm.c index 640bb7830f..7a7043bef8 100644 --- a/firmware/pcm.c +++ b/firmware/pcm.c @@ -47,14 +47,12 @@ * pcm_play_dma_postinit * pcm_play_dma_start * pcm_play_dma_stop - * pcm_play_dma_pause * pcm_play_dma_get_peak_buffer * Data Read/Written within TSP - * pcm_sampr (R) * pcm_fsel (R) * pcm_curr_sampr (R) * pcm_playing (R) - * pcm_paused (R) * * ==Playback/Recording== * Public - @@ -93,8 +91,6 @@ volatile pcm_status_callback_type pcm_play_status_callback SHAREDBSS_ATTR = NULL; /* PCM playback state */ volatile bool pcm_playing SHAREDBSS_ATTR = false; -/* PCM paused state. paused implies playing */ -volatile bool pcm_paused SHAREDBSS_ATTR = false; /* samplerate of currently playing audio - undefined if stopped */ unsigned long pcm_curr_sampr SHAREDBSS_ATTR = 0; /* samplerate waiting to be set */ @@ -103,7 +99,6 @@ unsigned long pcm_sampr SHAREDBSS_ATTR = HW_SAMPR_DEFAULT; int pcm_fsel SHAREDBSS_ATTR = HW_FREQ_DEFAULT; static void pcm_play_data_start_int(const void *addr, size_t size); -static void pcm_play_pause_int(bool play); void pcm_play_stop_int(void); #if !defined(HAVE_SW_VOLUME_CONTROL) || defined(PCM_SW_VOLUME_UNBUFFERED) @@ -118,19 +113,6 @@ static inline void pcm_play_dma_start_int(const void *addr, size_t size) pcm_play_dma_start(addr, size); } -static inline void pcm_play_dma_pause_int(bool pause) -{ - if (pause || pcm_get_bytes_waiting() > 0) - { - pcm_play_dma_pause(pause); - } - else - { - logf(" no data"); - pcm_play_data_start_int(NULL, 0); - } -} - static inline void pcm_play_dma_stop_int(void) { pcm_play_dma_stop(); @@ -167,7 +149,6 @@ static void pcm_play_data_start_int(const void *addr, size_t size) logf(" pcm_play_dma_start_int"); pcm_play_dma_start_int(addr, size); pcm_playing = true; - pcm_paused = false; } else { @@ -177,22 +158,11 @@ static void pcm_play_data_start_int(const void *addr, size_t size) } } -static void pcm_play_pause_int(bool play) -{ - if (play) - pcm_apply_settings(); - - logf(" pcm_play_dma_pause_int"); - pcm_play_dma_pause_int(!play); - pcm_paused = !play && pcm_playing; -} - void pcm_play_stop_int(void) { pcm_play_dma_stop_int(); pcm_callback_for_more = NULL; pcm_play_status_callback = NULL; - pcm_paused = false; pcm_playing = false; } @@ -282,8 +252,7 @@ void pcm_calculate_peaks(int *left, int *right) int count; const void *addr = pcm_play_dma_get_peak_buffer_int(&count); - pcm_do_peak_calculation(&peaks, pcm_playing && !pcm_paused, - addr, count); + pcm_do_peak_calculation(&peaks, pcm_playing, addr, count); if (left) *left = peaks.left; @@ -302,11 +271,6 @@ bool pcm_is_playing(void) return pcm_playing; } -bool pcm_is_paused(void) -{ - return pcm_paused; -} - /**************************************************************************** * Functions that do not require targeted implementation but only a targeted * interface @@ -358,21 +322,6 @@ void pcm_play_data(pcm_play_callback_type get_more, pcm_play_unlock(); } -void pcm_play_pause(bool play) -{ - logf("pcm_play_pause: %s", play ? "play" : "pause"); - - pcm_play_lock(); - - if (play == pcm_paused && pcm_playing) - { - logf(" pcm_play_pause_int"); - pcm_play_pause_int(play); - } - - pcm_play_unlock(); -} - void pcm_play_stop(void) { logf("pcm_play_stop"); diff --git a/firmware/pcm_sw_volume.c b/firmware/pcm_sw_volume.c index 8b6c9220fd..e972896321 100644 --- a/firmware/pcm_sw_volume.c +++ b/firmware/pcm_sw_volume.c @@ -278,16 +278,6 @@ void pcm_play_dma_start_int(const void *addr, size_t size) start_pcm(true); } -void pcm_play_dma_pause_int(bool pause) -{ - if (pause) - pcm_play_dma_pause(true); - else if (src_buf_rem) - start_pcm(false); /* Reprocess in case volume level changed */ - else - pcm_play_stop_int(); /* Playing frame was last frame */ -} - void pcm_play_dma_stop_int(void) { pcm_play_dma_stop(); diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c index ddb4d86bd4..90b6aabd7c 100644 --- a/firmware/target/arm/as3525/pcm-as3525.c +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -152,26 +152,6 @@ void pcm_play_dma_stop(void) play_callback_pending = false; } -void pcm_play_dma_pause(bool pause) -{ - is_playing = !pause; - - if(pause) - { - dma_pause_channel(0); - - /* if producer's buffer finished, upper layer starts anew */ - if (dma_rem_size == 0) - play_callback_pending = false; - } - else - { - if (play_sub_size != 0) - dma_resume_channel(0); - /* else unlock calls the callback if sub buffers remain */ - } -} - void pcm_play_dma_init(void) { bitset32(&CGU_PERI, CGU_I2SOUT_APB_CLOCK_ENABLE); diff --git a/firmware/target/arm/imx233/pcm-imx233.c b/firmware/target/arm/imx233/pcm-imx233.c index de0e1aabf5..7e20a7ce68 100644 --- a/firmware/target/arm/imx233/pcm-imx233.c +++ b/firmware/target/arm/imx233/pcm-imx233.c @@ -149,12 +149,6 @@ void pcm_play_dma_start(const void *addr, size_t size) pcm_play_unlock(); } -void pcm_play_dma_pause(bool pause) -{ - imx233_dma_freeze_channel(APB_AUDIO_DAC, pause); - dac_freezed = pause; -} - void pcm_play_dma_init(void) { audiohw_preinit(); diff --git a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c index 7304bdcff3..72d8e4a021 100644 --- a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c @@ -224,20 +224,6 @@ void pcm_play_dma_stop(void) play_stop_pcm(); } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - sdma_channel_pause(DMA_PLAY_CH_NUM); - play_stop_pcm(); - } - else - { - play_start_pcm(); - sdma_channel_run(DMA_PLAY_CH_NUM); - } -} - /* Return the number of bytes waiting - full L-R sample pairs only */ size_t pcm_get_bytes_waiting(void) { diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c index ddd69088cf..9c64b58594 100644 --- a/firmware/target/arm/pcm-telechips.c +++ b/firmware/target/arm/pcm-telechips.c @@ -194,15 +194,6 @@ void pcm_play_unlock(void) restore_fiq(status); } -void pcm_play_dma_pause(bool pause) -{ - if (pause) { - play_stop_pcm(); - } else { - play_start_pcm(); - } -} - size_t pcm_get_bytes_waiting(void) { return dma_play_data.size & ~3; diff --git a/firmware/target/arm/pnx0101/pcm-pnx0101.c b/firmware/target/arm/pnx0101/pcm-pnx0101.c index a2394bc355..01ead4723b 100644 --- a/firmware/target/arm/pnx0101/pcm-pnx0101.c +++ b/firmware/target/arm/pnx0101/pcm-pnx0101.c @@ -49,11 +49,6 @@ void pcm_play_dma_stop(void) { } -void pcm_play_dma_pause(bool pause) -{ - (void)pause; -} - static inline void fill_dma_buf(int offset) { short *l, *r, *lend; @@ -62,7 +57,7 @@ static inline void fill_dma_buf(int offset) lend = l + DMA_BUF_SAMPLES / 2; r = dma_buf_right + offset; - if (pcm_playing && !pcm_paused) + if (pcm_playing) { bool new_buffer =false; diff --git a/firmware/target/arm/pp/pcm-pp.c b/firmware/target/arm/pp/pcm-pp.c index 99d46a6096..91d567ee83 100644 --- a/firmware/target/arm/pp/pcm-pp.c +++ b/firmware/target/arm/pp/pcm-pp.c @@ -497,15 +497,6 @@ void pcm_play_dma_stop(void) #endif } -void pcm_play_dma_pause(bool pause) -{ - if (pause) { - play_stop_pcm(); - } else { - play_start_pcm(); - } -} - size_t pcm_get_bytes_waiting(void) { return dma_play_data.size & ~3; diff --git a/firmware/target/arm/rk27xx/pcm-rk27xx.c b/firmware/target/arm/rk27xx/pcm-rk27xx.c index 21feaf6cc4..5cfe54f9de 100644 --- a/firmware/target/arm/rk27xx/pcm-rk27xx.c +++ b/firmware/target/arm/rk27xx/pcm-rk27xx.c @@ -114,21 +114,6 @@ void pcm_play_dma_start(const void *addr, size_t size) hdma_i2s_transfer(addr, size); } -/* pause DMA transfer by disabling clock to DMA module */ -void pcm_play_dma_pause(bool pause) -{ - if(pause) - { - SCU_CLKCFG |= CLKCFG_HDMA; - locked = 1; - } - else - { - SCU_CLKCFG &= ~CLKCFG_HDMA; - locked = 0; - } -} - static void i2s_init(void) { #if defined(HAVE_RK27XX_CODEC) diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c index a1c854a0df..da5dc9cdd5 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c @@ -195,24 +195,6 @@ void pcm_play_dma_stop(void) bitclr32(&CLKCON, 1<<17); } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - /* pause playback on current buffer */ - play_stop_pcm(); - } - else - { - /* restart playback on current buffer */ - /* make sure we're aligned on left channel - skip any right - channel sample left waiting */ - DISRC2 = (DCSRC2 + 2) & ~0x3; - DCON2 = DMA_CONTROL_SETUP | (DSTAT2 & 0xFFFFE); - play_start_pcm(); - } -} - void fiq_handler(void) { static const void *start; diff --git a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c index 943cbb2ade..dbb1a06809 100644 --- a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c +++ b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c @@ -235,24 +235,6 @@ void pcm_play_dma_stop(void) bitclr32(&CLKCON, 1<<17); } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - /* pause playback on current buffer */ - play_stop_pcm(); - } - else - { - /* restart playback on current buffer */ - /* make sure we're aligned on left channel - skip any right - channel sample left waiting */ - DISRC2 = (DCSRC2 + 2) & ~0x3; - DCON2 = DMA_CONTROL_SETUP | (DSTAT2 & 0xFFFFE); - play_start_pcm(); - } -} - void fiq_handler(void) { static const void *start; diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c index d8387c2aa5..47525611ee 100644 --- a/firmware/target/arm/s5l8700/pcm-s5l8700.c +++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c @@ -35,7 +35,6 @@ /* Driver for the IIS/PCM part of the s5l8700 using DMA Notes: - - pcm_play_dma_pause is untested, not sure if implemented the right way - pcm_play_dma_stop is untested, not sure if implemented the right way - recording is not implemented */ @@ -173,17 +172,6 @@ void pcm_play_dma_stop(void) (0 << 0); /* 0 = LRCK on */ } -/* pause playback by disabling the I2S interface */ -void pcm_play_dma_pause(bool pause) -{ - if (pause) { - I2STXCOM |= (1 << 0); /* LRCK off */ - } - else { - I2STXCOM &= ~(1 << 0); /* LRCK on */ - } -} - static void pcm_dma_set_freq(enum hw_freq_indexes idx) { struct div_entry div = div_table[idx]; diff --git a/firmware/target/arm/s5l8702/pcm-s5l8702.c b/firmware/target/arm/s5l8702/pcm-s5l8702.c index 86a0edd54a..a62a7243a2 100644 --- a/firmware/target/arm/s5l8702/pcm-s5l8702.c +++ b/firmware/target/arm/s5l8702/pcm-s5l8702.c @@ -157,13 +157,6 @@ void pcm_play_dma_stop(void) I2STXCOM = 0xa; } -/* pause playback by disabling LRCK */ -void pcm_play_dma_pause(bool pause) -{ - if (pause) I2STXCOM |= 1; - else I2STXCOM &= ~1; -} - /* MCLK = 12MHz (MCLKDIV2=1), [CS42L55 DS, s4.8] */ #define MCLK_FREQ 12000000 diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c index 1fda5fe045..f31185c2ea 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c @@ -85,11 +85,6 @@ void pcm_play_unlock(void) } -void pcm_play_dma_pause(bool pause) -{ - (void) pause; -} - size_t pcm_get_bytes_waiting(void) { return 0; diff --git a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c index d23c93de39..0d7bcbab37 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c @@ -120,20 +120,6 @@ void pcm_play_unlock(void) } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - DSP_(_dma0_stopped)=2; - dsp_wake(); - } - else - { - DSP_(_dma0_stopped)=0; - dsp_wake(); - } -} - size_t pcm_get_bytes_waiting(void) { return DSP_(_sdem_dsp_size)-DSP_(_sdem_level); diff --git a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c index 6e640bdf12..c2932fd762 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c @@ -127,20 +127,6 @@ void pcm_play_unlock(void) } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - DSP_(_dma0_stopped)=2; - dsp_wake(); - } - else - { - DSP_(_dma0_stopped)=0; - dsp_wake(); - } -} - size_t pcm_get_bytes_waiting(void) { return DSP_(_sdem_dsp_size)-DSP_(_sdem_level); diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c index 8162f521f9..10f9ea931f 100644 --- a/firmware/target/coldfire/pcm-coldfire.c +++ b/firmware/target/coldfire/pcm-coldfire.c @@ -264,25 +264,6 @@ void pcm_play_dma_stop(void) dma_play_lock.state = (1 << 14); } /* pcm_play_dma_stop */ -void pcm_play_dma_pause(bool pause) -{ - if (pause) - { - /* pause playback on current buffer */ - and_l(~(DMA_EEXT | DMA_INT), &DCR0); /* per request and int OFF */ - DSR0 = 1; /* stop channel */ - iis_play_reset_if_playback(true); - dma_play_lock.state = (1 << 14); - } - else - { - /* restart playback on current buffer */ - iis_play_reset_if_playback(true); - or_l(DMA_INT | DMA_EEXT | DMA_START, &DCR0); /* everything ON */ - dma_play_lock.state = (0 << 14); - } -} /* pcm_play_dma_pause */ - size_t pcm_get_bytes_waiting(void) { return BCR0 & 0xffffff; diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c index 23a003ff73..69fd06c6f7 100644 --- a/firmware/target/hosted/android/pcm-android.c +++ b/firmware/target/hosted/android/pcm-android.c @@ -153,8 +153,11 @@ void pcm_play_dma_start(const void *addr, size_t size) { pcm_data_start = addr; pcm_data_size = size; - - pcm_play_dma_pause(false); + + (*env_ptr)->CallVoidMethod(env_ptr, + RockboxPCM_instance, + play_pause_method, + (int)pause); } void pcm_play_dma_stop(void) @@ -168,14 +171,6 @@ void pcm_play_dma_stop(void) stop_method); } -void pcm_play_dma_pause(bool pause) -{ - (*env_ptr)->CallVoidMethod(env_ptr, - RockboxPCM_instance, - play_pause_method, - (int)pause); -} - size_t pcm_get_bytes_waiting(void) { return pcm_data_size; diff --git a/firmware/target/hosted/ibasso/pcm-ibasso.c b/firmware/target/hosted/ibasso/pcm-ibasso.c index 4721501d25..edfdc6d592 100644 --- a/firmware/target/hosted/ibasso/pcm-ibasso.c +++ b/firmware/target/hosted/ibasso/pcm-ibasso.c @@ -364,22 +364,6 @@ void pcm_play_dma_start(const void *addr, size_t size) pthread_mutex_unlock(&_dma_suspended_mtx); } - -/* TODO: Why is this in the API if it gets never called? */ -void pcm_play_dma_pause(bool pause) -{ - TRACE; - - pthread_mutex_lock(&_dma_suspended_mtx); - _dma_stopped = pause ? 1 : 0; - if(_dma_stopped == 0) - { - pthread_cond_signal(&_dma_suspended_cond); - } - pthread_mutex_unlock(&_dma_suspended_mtx); -} - - void pcm_play_dma_stop(void) { TRACE; diff --git a/firmware/target/hosted/maemo/pcm-gstreamer.c b/firmware/target/hosted/maemo/pcm-gstreamer.c index bd264fe5d3..7c864738ef 100644 --- a/firmware/target/hosted/maemo/pcm-gstreamer.c +++ b/firmware/target/hosted/maemo/pcm-gstreamer.c @@ -154,23 +154,6 @@ void pcm_play_dma_stop(void) gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_NULL); } -void pcm_play_dma_pause(bool pause) -{ - if (inside_feed_data) - { - if (pause) - g_signal_emit_by_name (gst_appsrc, "end-of-stream", NULL); - else - DEBUGF("ERROR: Called dma_pause(0) while inside feed_data\n"); - } else - { - if (pause) - gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_NULL); - else - gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_PLAYING); - } -} - size_t pcm_get_bytes_waiting(void) { return pcm_data_size; diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c index eb1f764791..939a0cabb5 100644 --- a/firmware/target/hosted/pcm-alsa.c +++ b/firmware/target/hosted/pcm-alsa.c @@ -489,7 +489,7 @@ static void close_hwdev(void) if (handle) { snd_pcm_drain(handle); -#ifdef AUDIOHW_MUTE_ON_PAUSE +#ifdef AUDIOHW_MUTE_ON_STOP audiohw_mute(true); #endif if (ahandler) { @@ -634,20 +634,6 @@ void pcm_dma_apply_settings(void) pcm_play_unlock(); } -void pcm_play_dma_pause(bool pause) -{ - logf("PCM DMA pause %d", pause); - if (!handle) return; - -#ifdef AUDIOHW_MUTE_ON_PAUSE - if (pause) audiohw_mute(true); -#endif - snd_pcm_pause(handle, pause); -#ifdef AUDIOHW_MUTE_ON_PAUSE - if (!pause) audiohw_mute(false); -#endif -} - void pcm_play_dma_stop(void) { logf("PCM DMA stop (%d)", snd_pcm_state(handle)); @@ -656,7 +642,7 @@ void pcm_play_dma_stop(void) if (err < 0) if (err < 0) logf("Drain failed: %s", snd_strerror(err)); -#ifdef AUDIOHW_MUTE_ON_PAUSE +#ifdef AUDIOHW_MUTE_ON_STOP audiohw_mute(true); #endif } @@ -669,7 +655,7 @@ void pcm_play_dma_start(const void *addr, size_t size) pcm_data = addr; pcm_size = size; -#if !defined(AUDIOHW_MUTE_ON_PAUSE) && defined(AUDIOHW_MUTE_ON_SRATE_CHANGE) +#if !defined(AUDIOHW_MUTE_ON_STOP) && defined(AUDIOHW_MUTE_ON_SRATE_CHANGE) audiohw_mute(false); #endif @@ -681,7 +667,7 @@ void pcm_play_dma_start(const void *addr, size_t size) switch (state) { case SND_PCM_STATE_RUNNING: -#if defined(AUDIOHW_MUTE_ON_PAUSE) +#if defined(AUDIOHW_MUTE_ON_STOP) audiohw_mute(false); #endif return; @@ -740,11 +726,6 @@ void pcm_play_dma_start(const void *addr, size_t size) break; } - case SND_PCM_STATE_PAUSED: - { /* paused, simply resume */ - pcm_play_dma_pause(0); - return; - } case SND_PCM_STATE_DRAINING: /* run until drained */ continue; @@ -850,11 +831,6 @@ void pcm_rec_dma_start(void *start, size_t size) panicf("Start error: %s", snd_strerror(err)); return; } - case SND_PCM_STATE_PAUSED: - { /* paused, simply resume */ - pcm_play_dma_pause(0); - return; - } case SND_PCM_STATE_DRAINING: /* run until drained */ continue; diff --git a/firmware/target/hosted/sdl/pcm-sdl.c b/firmware/target/hosted/sdl/pcm-sdl.c index 877ca5a482..ba43ece543 100644 --- a/firmware/target/hosted/sdl/pcm-sdl.c +++ b/firmware/target/hosted/sdl/pcm-sdl.c @@ -124,14 +124,6 @@ void pcm_play_dma_stop(void) #endif } -void pcm_play_dma_pause(bool pause) -{ - if (pause) - SDL_PauseAudio(1); - else - SDL_PauseAudio(0); -} - size_t pcm_get_bytes_waiting(void) { return pcm_data_size; diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c index ef2597ae69..1ce0b5ad5f 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c @@ -184,18 +184,6 @@ void pcm_play_unlock(void) restore_irq(flags); } -void pcm_play_dma_pause(bool pause) -{ - int flags = disable_irq_save(); - - if(pause) - REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) &= ~DMAC_DCCSR_EN; - else - REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) |= DMAC_DCCSR_EN; - - restore_irq(flags); -} - static int get_dma_count(void) { int count = REG_DMAC_DTCR(DMA_AIC_TX_CHANNEL); diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c index 098c28ecf5..4a4f3020bb 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c @@ -173,18 +173,6 @@ void pcm_play_unlock(void) restore_irq(flags); } -void pcm_play_dma_pause(bool pause) -{ - int flags = disable_irq_save(); - - if(pause) - REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) &= ~DMAC_DCCSR_EN; - else - REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) |= DMAC_DCCSR_EN; - - restore_irq(flags); -} - static int get_dma_count(void) { int count = REG_DMAC_DTCR(DMA_AIC_TX_CHANNEL);