Skip to content

Commit fbbdb03

Browse files
committed
ASoC: SOF: Intel: Disable SPIB in non ICCMAX stream
The existing code disable SPIB in the playback direction only because previously the hda data stream is only used for SOF firmware download and we prepare capture stream for ICCMAX and prepare playback stream for non ICCMAX case. But now the hda data stream is also used for SoundWire BPT which will use both directions. The SPIB is enabled in non ICCMAX cases and we should disable in clean up. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent c959ac9 commit fbbdb03

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

sound/soc/sof/intel/hda-loader.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ int hda_cl_trigger(struct device *dev, struct hdac_ext_stream *hext_stream, int
216216
EXPORT_SYMBOL_NS(hda_cl_trigger, "SND_SOC_SOF_INTEL_HDA_COMMON");
217217

218218
int hda_cl_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
219-
bool persistent_buffer, struct hdac_ext_stream *hext_stream)
219+
bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool is_iccmax)
220220
{
221-
return hda_data_stream_cleanup(dev, dmab, persistent_buffer, hext_stream, false);
221+
return hda_data_stream_cleanup(dev, dmab, persistent_buffer, hext_stream,
222+
is_iccmax, false);
222223
}
223224
EXPORT_SYMBOL_NS(hda_cl_cleanup, "SND_SOC_SOF_INTEL_HDA_COMMON");
224225

@@ -302,7 +303,7 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev)
302303
* If the cleanup also fails, we return the initial error
303304
*/
304305
ret1 = hda_cl_cleanup(sdev->dev, &hda->iccmax_dmab,
305-
persistent_cl_buffer, iccmax_stream);
306+
persistent_cl_buffer, iccmax_stream, true);
306307
if (ret1 < 0) {
307308
dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n");
308309

@@ -458,7 +459,7 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
458459
* If the cleanup also fails, we return the initial error
459460
*/
460461
ret1 = hda_cl_cleanup(sdev->dev, &hda->cl_dmab,
461-
persistent_cl_buffer, hext_stream);
462+
persistent_cl_buffer, hext_stream, false);
462463
if (ret1 < 0) {
463464
dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n");
464465

@@ -587,7 +588,7 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
587588
cleanup:
588589
/* clean up even in case of error and return the first error */
589590
ret1 = hda_cl_cleanup(sdev->dev, &hda->cl_dmab, persistent_cl_buffer,
590-
hext_stream);
591+
hext_stream, false);
591592
if (ret1 < 0) {
592593
dev_err(sdev->dev, "%s: Code loader DSP cleanup failed\n", __func__);
593594

sound/soc/sof/intel/hda-sdw-bpt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int hda_sdw_bpt_dma_deprepare(struct device *dev, struct hdac_ext_stream
163163
u32 mask;
164164
int ret;
165165

166-
ret = hda_data_stream_cleanup(sdev->dev, dmab_bdl, false, sdw_bpt_stream, true);
166+
ret = hda_data_stream_cleanup(sdev->dev, dmab_bdl, false, sdw_bpt_stream, false, true);
167167
if (ret < 0) {
168168
dev_err(sdev->dev, "%s: SDW BPT DMA cleanup failed\n",
169169
__func__);

sound/soc/sof/intel/hda-stream.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,16 +1331,18 @@ hda_data_stream_prepare(struct device *dev, unsigned int format, unsigned int si
13311331
EXPORT_SYMBOL_NS(hda_data_stream_prepare, "SND_SOC_SOF_INTEL_HDA_COMMON");
13321332

13331333
int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
1334-
bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool pair)
1334+
bool persistent_buffer, struct hdac_ext_stream *hext_stream,
1335+
bool is_iccmax, bool pair)
13351336
{
13361337
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
13371338
struct hdac_stream *hstream = hdac_stream(hext_stream);
13381339
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
13391340
int ret = 0;
13401341

1341-
if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
1342+
if (!is_iccmax)
13421343
ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
1343-
else
1344+
1345+
if (hstream->direction == SNDRV_PCM_STREAM_CAPTURE)
13441346
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
13451347
SOF_HDA_SD_CTL_DMA_START, 0);
13461348

sound/soc/sof/intel/hda.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ struct hdac_ext_stream *hda_cl_prepare(struct device *dev, unsigned int format,
762762
int hda_cl_trigger(struct device *dev, struct hdac_ext_stream *hext_stream, int cmd);
763763

764764
int hda_cl_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
765-
bool persistent_buffer, struct hdac_ext_stream *hext_stream);
765+
bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool is_iccmax);
766766
int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot);
767767
#define HDA_CL_STREAM_FORMAT 0x40
768768

@@ -934,7 +934,8 @@ hda_data_stream_prepare(struct device *dev, unsigned int format, unsigned int si
934934
bool is_iccmax, bool pair);
935935

936936
int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
937-
bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool pair);
937+
bool persistent_buffer, struct hdac_ext_stream *hext_stream,
938+
bool is_iccmax, bool pair);
938939

939940
/* common dai driver */
940941
extern struct snd_soc_dai_driver skl_dai[];

0 commit comments

Comments
 (0)