Commit 59d177f6 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: omap-mcbsp: Simplify the mcbsp_start/_stop function parameters

We either start/stop TX or RX, never both. Move the tx/rx direction
selection within the functions.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
Tested-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d63a7625
...@@ -637,8 +637,10 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp) ...@@ -637,8 +637,10 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
* If no transmitter or receiver is active prior calling, then sample-rate * If no transmitter or receiver is active prior calling, then sample-rate
* generator and frame sync are started. * generator and frame sync are started.
*/ */
void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx) void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream)
{ {
int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK);
int rx = !tx;
int enable_srg = 0; int enable_srg = 0;
u16 w; u16 w;
...@@ -694,8 +696,10 @@ void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx) ...@@ -694,8 +696,10 @@ void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx)
omap_mcbsp_dump_reg(mcbsp); omap_mcbsp_dump_reg(mcbsp);
} }
void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx) void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream)
{ {
int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK);
int rx = !tx;
int idle; int idle;
u16 w; u16 w;
......
...@@ -339,8 +339,8 @@ u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp); ...@@ -339,8 +339,8 @@ u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp);
int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp); int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp);
int omap_mcbsp_request(struct omap_mcbsp *mcbsp); int omap_mcbsp_request(struct omap_mcbsp *mcbsp);
void omap_mcbsp_free(struct omap_mcbsp *mcbsp); void omap_mcbsp_free(struct omap_mcbsp *mcbsp);
void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx); void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream);
void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx); void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream);
/* McBSP functional clock source changing function */ /* McBSP functional clock source changing function */
int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id); int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id);
......
...@@ -201,27 +201,26 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -201,27 +201,26 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *cpu_dai) struct snd_soc_dai *cpu_dai)
{ {
struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
mcbsp->active++; mcbsp->active++;
omap_mcbsp_start(mcbsp, play, !play); omap_mcbsp_start(mcbsp, substream->stream);
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
omap_mcbsp_stop(mcbsp, play, !play); omap_mcbsp_stop(mcbsp, substream->stream);
mcbsp->active--; mcbsp->active--;
break; break;
default: default:
err = -EINVAL; return -EINVAL;
} }
return err; return 0;
} }
static snd_pcm_sframes_t omap_mcbsp_dai_delay( static snd_pcm_sframes_t omap_mcbsp_dai_delay(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment