diff options
author | Arnaud Pouliquen <arnaud.pouliquen@st.com> | 2016-10-24 16:42:53 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-26 11:41:11 +0100 |
commit | 4c88f89f9c255d0a754e38ff1a55a6f8cef362e8 (patch) | |
tree | 3f3b8e0a4b5748319527c9e797118e7d9bb5f119 /sound/soc/sti/uniperif_player.c | |
parent | 748abba8f3a93cee13a56350386e59457ffa600d (diff) | |
download | op-kernel-dev-4c88f89f9c255d0a754e38ff1a55a6f8cef362e8.zip op-kernel-dev-4c88f89f9c255d0a754e38ff1a55a6f8cef362e8.tar.gz |
ASoC: sti: reset refactoring
Reset is common to player and reader, migrate function in sti_uniperif.c
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sti/uniperif_player.c')
-rw-r--r-- | sound/soc/sti/uniperif_player.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c index c9b4670..00022aa4 100644 --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c @@ -6,7 +6,6 @@ */ #include <linux/clk.h> -#include <linux/delay.h> #include <linux/io.h> #include <linux/mfd/syscon.h> @@ -55,25 +54,6 @@ static const struct snd_pcm_hardware uni_player_pcm_hw = { .buffer_bytes_max = 256 * PAGE_SIZE }; -static inline int reset_player(struct uniperif *player) -{ - int count = 10; - - if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) { - while (GET_UNIPERIF_SOFT_RST_SOFT_RST(player) && count) { - udelay(5); - count--; - } - } - - if (!count) { - dev_err(player->dev, "Failed to reset uniperif\n"); - return -EIO; - } - - return 0; -} - /* * uni_player_irq_handler * In case of error audio stream is stopped; stop action is protected via PCM @@ -858,10 +838,8 @@ static int uni_player_prepare(struct snd_pcm_substream *substream, SET_UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ(player, 0); - /* Reset uniperipheral player */ - SET_UNIPERIF_SOFT_RST_SOFT_RST(player); - return reset_player(player); + return sti_uniperiph_reset(player); } static int uni_player_start(struct uniperif *player) @@ -893,10 +871,7 @@ static int uni_player_start(struct uniperif *player) SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED(player); } - /* Reset uniperipheral player */ - SET_UNIPERIF_SOFT_RST_SOFT_RST(player); - - ret = reset_player(player); + ret = sti_uniperiph_reset(player); if (ret < 0) { clk_disable_unprepare(player->clk); return ret; @@ -945,10 +920,7 @@ static int uni_player_stop(struct uniperif *player) /* Turn the player off */ SET_UNIPERIF_CTRL_OPERATION_OFF(player); - /* Soft reset the player */ - SET_UNIPERIF_SOFT_RST_SOFT_RST(player); - - ret = reset_player(player); + ret = sti_uniperiph_reset(player); if (ret < 0) return ret; |