clear-pkgs-linux-iot-lts2018/0366-ASoC-Intel-Set-all-I2S...

108 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mousumi Jana <mousumix.jana@intel.com>
Date: Tue, 12 Sep 2017 17:18:44 +0530
Subject: [PATCH] ASoC: Intel: Set all I2S ports to slave mode after DSP power
up in BXTP
During DSP power up sequences, the I2S ports default to Master mode.
This drives frame sync and bit clock high and may cause distortion
issues on peripherals in some boards.
To prevent this, the ports should be set slave mode before the DSP boot.
Change-Id: Id8f96989d35674acad89f7080f58e7682bcd81dc
Signed-off-by: Sameer Sharma <sameerx.sharma@intel.com>
Signed-off-by: Mousumi Jana <mousumix.jana@intel.com>
Signed-off-by: Mohit Sinha <mohit.sinha@intel.com>
Reviewed-on:
Reviewed-by: Singh, Guneshwor O <guneshwor.o.singh@intel.com>
Reviewed-by: Shaik, Kareem M <kareem.m.shaik@intel.com>
Reviewed-by: Gogineni, GiribabuX <giribabux.gogineni@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Reviewed-by: audio_build
Tested-by: Sm, Bhadur A <bhadur.a.sm@intel.com>
---
sound/soc/intel/skylake/bxt-sst.c | 45 +++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 406d278555f0..dd5453daa562 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -32,6 +32,15 @@
#define BXT_ROM_INIT 0x5
#define BXT_ADSP_SRAM0_BASE 0x80000
+/* BXT SSP/I2S Registers */
+#define I2S_SSC1_REG_OFF BIT(2)
+#define SET_SLAVE_MASK GENMASK(25, 24)
+
+/*BXT I2S Clock Gating*/
+#define BXT_DSP_CLK_CTL 0x378
+#define BXT_DISABLE_4_SSP_CLK_GT GENMASK(21, 18)
+#define BXT_DISABLE_ALL_SSP_CLK_GT GENMASK(23, 18)
+
/* Trace Buffer Window */
#define BXT_ADSP_SRAM2_BASE 0x0C0000
#define BXT_ADSP_W2_SIZE 0x2000
@@ -52,6 +61,36 @@
#define BXT_FW_ROM_INIT_RETRY 3
+#define GET_SSP_BASE(N) (N > 4 ? 0x2000 : 0x4000)
+
+#define BXTP_NUM_I2S_PORTS 6
+
+static void bxt_set_ssp_slave(struct sst_dsp *ctx)
+{
+ u32 mask, i2s_base_addr;
+ int i;
+
+ if (BXTP_NUM_I2S_PORTS == 4)
+ mask = BXT_DISABLE_4_SSP_CLK_GT;
+ else
+ mask = BXT_DISABLE_ALL_SSP_CLK_GT;
+
+ /* disable clock gating on all SSPs */
+ sst_dsp_shim_update_bits_unlocked(ctx,
+ BXT_DSP_CLK_CTL, mask, mask);
+
+ /* set all SSPs to slave */
+ i2s_base_addr = GET_SSP_BASE(BXTP_NUM_I2S_PORTS);
+ for (i = 0; i < BXTP_NUM_I2S_PORTS; i++) {
+ sst_dsp_shim_update_bits_unlocked(ctx,
+ (i2s_base_addr + (i * 0x1000) + I2S_SSC1_REG_OFF),
+ SET_SLAVE_MASK, SET_SLAVE_MASK);
+ }
+
+ /* re-enable clock gating */
+ sst_dsp_shim_update_bits_unlocked(ctx, BXT_DSP_CLK_CTL, mask, 0);
+}
+
static unsigned int bxt_get_errorcode(struct sst_dsp *ctx)
{
return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE);
@@ -134,6 +173,9 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
goto base_fw_load_failed;
}
+ /* DSP is powered up, set all SSPs to slave mode */
+ bxt_set_ssp_slave(ctx);
+
/* Step 2: Purge FW request */
sst_dsp_shim_write(ctx, SKL_ADSP_REG_HIPCI, SKL_ADSP_REG_HIPCI_BUSY |
(BXT_IPC_PURGE_FW | ((stream_tag - 1) << 9)));
@@ -448,6 +490,9 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
if (core_id == SKL_DSP_CORE0_ID) {
+ /* set all SSPs to slave mode */
+ bxt_set_ssp_slave(ctx);
+
/*
* Enable interrupt after SPA is set and before
* DSP is unstalled
--
https://clearlinux.org