diff options
author | Jeeja KP <jeeja.kp@intel.com> | 2015-12-18 04:41:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-12-18 12:14:21 -0500 |
commit | a4386450bf08cd968bf41ff30a92caf74262c9d6 (patch) | |
tree | cb4d7564ed8852460831a881fb4f1a9688adf7c8 | |
parent | 743ad80e5c8565ab54e8832f6d74cb543a0adbba (diff) |
ASoC: Intel: Skylake: Clear stream registers before stream setup
This patch adds clean up routine to clear the stream registers and
calls this routine before setting up stream registers.
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/skylake/skl-sst-cldma.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/sound/soc/intel/skylake/skl-sst-cldma.c b/sound/soc/intel/skylake/skl-sst-cldma.c index 8c7e8576cba3..da2329d17f4d 100644 --- a/sound/soc/intel/skylake/skl-sst-cldma.c +++ b/sound/soc/intel/skylake/skl-sst-cldma.c | |||
@@ -60,6 +60,27 @@ static void skl_cldma_stream_run(struct sst_dsp *ctx, bool enable) | |||
60 | dev_err(ctx->dev, "Failed to set Run bit=%d enable=%d\n", val, enable); | 60 | dev_err(ctx->dev, "Failed to set Run bit=%d enable=%d\n", val, enable); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void skl_cldma_stream_clear(struct sst_dsp *ctx) | ||
64 | { | ||
65 | /* make sure Run bit is cleared before setting stream register */ | ||
66 | skl_cldma_stream_run(ctx, 0); | ||
67 | |||
68 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
69 | CL_SD_CTL_IOCE_MASK, CL_SD_CTL_IOCE(0)); | ||
70 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
71 | CL_SD_CTL_FEIE_MASK, CL_SD_CTL_FEIE(0)); | ||
72 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
73 | CL_SD_CTL_DEIE_MASK, CL_SD_CTL_DEIE(0)); | ||
74 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
75 | CL_SD_CTL_STRM_MASK, CL_SD_CTL_STRM(0)); | ||
76 | |||
77 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, CL_SD_BDLPLBA(0)); | ||
78 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, 0); | ||
79 | |||
80 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0); | ||
81 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0); | ||
82 | } | ||
83 | |||
63 | /* Code loader helper APIs */ | 84 | /* Code loader helper APIs */ |
64 | static void skl_cldma_setup_bdle(struct sst_dsp *ctx, | 85 | static void skl_cldma_setup_bdle(struct sst_dsp *ctx, |
65 | struct snd_dma_buffer *dmab_data, | 86 | struct snd_dma_buffer *dmab_data, |
@@ -95,6 +116,7 @@ static void skl_cldma_setup_controller(struct sst_dsp *ctx, | |||
95 | struct snd_dma_buffer *dmab_bdl, unsigned int max_size, | 116 | struct snd_dma_buffer *dmab_bdl, unsigned int max_size, |
96 | u32 count) | 117 | u32 count) |
97 | { | 118 | { |
119 | skl_cldma_stream_clear(ctx); | ||
98 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, | 120 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, |
99 | CL_SD_BDLPLBA(dmab_bdl->addr)); | 121 | CL_SD_BDLPLBA(dmab_bdl->addr)); |
100 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, | 122 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, |
@@ -137,21 +159,7 @@ static void skl_cldma_cleanup_spb(struct sst_dsp *ctx) | |||
137 | static void skl_cldma_cleanup(struct sst_dsp *ctx) | 159 | static void skl_cldma_cleanup(struct sst_dsp *ctx) |
138 | { | 160 | { |
139 | skl_cldma_cleanup_spb(ctx); | 161 | skl_cldma_cleanup_spb(ctx); |
140 | 162 | skl_cldma_stream_clear(ctx); | |
141 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
142 | CL_SD_CTL_IOCE_MASK, CL_SD_CTL_IOCE(0)); | ||
143 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
144 | CL_SD_CTL_FEIE_MASK, CL_SD_CTL_FEIE(0)); | ||
145 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
146 | CL_SD_CTL_DEIE_MASK, CL_SD_CTL_DEIE(0)); | ||
147 | sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL, | ||
148 | CL_SD_CTL_STRM_MASK, CL_SD_CTL_STRM(0)); | ||
149 | |||
150 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, CL_SD_BDLPLBA(0)); | ||
151 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, 0); | ||
152 | |||
153 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0); | ||
154 | sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0); | ||
155 | 163 | ||
156 | ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data); | 164 | ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data); |
157 | ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl); | 165 | ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl); |