Commit be51c576 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: omap-mcbsp: Move out the FIFO check from set_threshold and get_delay

Check if the McBSP have FIFO in the omap_mcbsp_set_threshold() and
omap_mcbsp_dai_delay() delay function to skip calling the lower layer if
it is not needed.
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 59d177f6
...@@ -450,9 +450,6 @@ int omap_st_is_enabled(struct omap_mcbsp *mcbsp) ...@@ -450,9 +450,6 @@ int omap_st_is_enabled(struct omap_mcbsp *mcbsp)
*/ */
void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold) void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold)
{ {
if (mcbsp->pdata->buffer_size == 0)
return;
if (threshold && threshold <= mcbsp->max_tx_thres) if (threshold && threshold <= mcbsp->max_tx_thres)
MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
} }
...@@ -464,9 +461,6 @@ void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold) ...@@ -464,9 +461,6 @@ void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold)
*/ */
void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold) void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold)
{ {
if (mcbsp->pdata->buffer_size == 0)
return;
if (threshold && threshold <= mcbsp->max_rx_thres) if (threshold && threshold <= mcbsp->max_rx_thres)
MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
} }
...@@ -478,9 +472,6 @@ u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp) ...@@ -478,9 +472,6 @@ u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp)
{ {
u16 buffstat; u16 buffstat;
if (mcbsp->pdata->buffer_size == 0)
return 0;
/* Returns the number of free locations in the buffer */ /* Returns the number of free locations in the buffer */
buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); buffstat = MCBSP_READ(mcbsp, XBUFFSTAT);
...@@ -496,9 +487,6 @@ u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp) ...@@ -496,9 +487,6 @@ u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp)
{ {
u16 buffstat, threshold; u16 buffstat, threshold;
if (mcbsp->pdata->buffer_size == 0)
return 0;
/* Returns the number of used locations in the buffer */ /* Returns the number of used locations in the buffer */
buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); buffstat = MCBSP_READ(mcbsp, RBUFFSTAT);
/* RX threshold */ /* RX threshold */
......
...@@ -71,6 +71,10 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream, ...@@ -71,6 +71,10 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream,
struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
int words; int words;
/* No need to proceed further if McBSP does not have FIFO */
if (mcbsp->pdata->buffer_size == 0)
return;
/* /*
* Configure McBSP threshold based on either: * Configure McBSP threshold based on either:
* packet_size, when the sDMA is in packet mode, or based on the * packet_size, when the sDMA is in packet mode, or based on the
...@@ -233,6 +237,10 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay( ...@@ -233,6 +237,10 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay(
u16 fifo_use; u16 fifo_use;
snd_pcm_sframes_t delay; snd_pcm_sframes_t delay;
/* No need to proceed further if McBSP does not have FIFO */
if (mcbsp->pdata->buffer_size == 0)
return 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
fifo_use = omap_mcbsp_get_tx_delay(mcbsp); fifo_use = omap_mcbsp_get_tx_delay(mcbsp);
else else
......
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