[SRU][OEM-B-OSP1][PATCH 2/4] ALSA: SOF: disable L1SEN for capture stream
Hui Wang
hui.wang at canonical.com
Mon Sep 30 06:01:01 UTC 2019
From: Rander Wang <rander.wang at linux.intel.com>
BugLink: https://bugs.launchpad.net/bugs/1845904
Fix noise issue when doing capture
Signed-off-by: Rander Wang <rander.wang at linux.intel.com>
(cherry picked from commit b1221cb7ed6efbe2f078538278535717981930d5
git://github.com/thesofproject/linux.git)
Signed-off-by: Hui Wang <hui.wang at canonical.com>
---
sound/soc/sof/intel/hda-pcm.c | 18 ++++++++++++++++++
sound/soc/sof/intel/hda.h | 3 +++
sound/soc/sof/sof-priv.h | 1 +
3 files changed, 22 insertions(+)
diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
index 5714a79fbe1a..bcd7a30d51ee 100644
--- a/sound/soc/sof/intel/hda-pcm.c
+++ b/sound/soc/sof/intel/hda-pcm.c
@@ -215,6 +215,15 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
return -ENODEV;
}
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ sdev->capture_stream_num++;
+ if (sdev->capture_stream_num == 1)
+ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
+ HDA_DSP_EM2,
+ HDA_DSP_L1SEN,
+ 0);
+ }
+
/* binding pcm substream to hda stream */
substream->runtime->private_data = &dsp_stream->hstream;
return 0;
@@ -234,6 +243,15 @@ int hda_dsp_pcm_close(struct snd_sof_dev *sdev,
return -ENODEV;
}
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ sdev->capture_stream_num--;
+ if (sdev->capture_stream_num == 0)
+ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
+ HDA_DSP_EM2,
+ HDA_DSP_L1SEN,
+ 1);
+ }
+
/* unbinding pcm substream to hda stream */
substream->runtime->private_data = NULL;
return 0;
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 3ab90266244a..598d529c73fc 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -332,6 +332,9 @@
#define SOF_SKL_NUM_DAIS 8
#endif
+#define HDA_DSP_EM2 0x1030
+#define HDA_DSP_L1SEN BIT(13)
+
/* Intel HD Audio SRAM Window 0*/
#define HDA_ADSP_SRAM0_BASE_SKL 0x8000
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 62132d36d311..4608437bffbe 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -427,6 +427,7 @@ struct snd_sof_dev {
u32 dtrace_error;
u32 msi_enabled;
+ u32 capture_stream_num;
void *private; /* core does not touch this */
};
--
2.17.1
More information about the kernel-team
mailing list