2022-11-11 04:45:55

by Bard Liao

[permalink] [raw]
Subject: [PATCH 0/8] ASoC/soundwire: revisit interrupt and lcount handling

The code in drivers/soundwire/intel_init.c is hardware-dependent and the
code does not apply to new generations starting with MeteorLake. Refactor
and clean-up the code to make this intel_init.c hardware-agnostic and
move all hardware-dependencies in the SOF driver using chip descriptors.

The ASoC patches are dependent on some patches that are applied to ASoC
tree recently. So, this series won't apply to SoundWire tree. @Vinod Could
you Ack if it looks good to you, and lets go through ASoC tree?

Pierre-Louis Bossart (8):
soundwire: intel_init: remove useless interrupt enablement in
interrupt thread
ASoC: SOF: Intel: hda: add per-chip enable_sdw_irq() callback
ASoC: SOF: Intel: mtl: factor interrupt enable/disable interrupt
functions
ASoC: SOF: Intel: mtl: move SoundWire interrupt enabling to callback
ASoC: SOF: Intel: hda: add callback to check SoundWire lcount
information
soundwire: intel_init: remove sdw_intel_enable_irq()
soundwire: intel_init: remove check on number of links
ASoC: SOF: Intel: hda: read multi-link capabilities earlier

drivers/soundwire/intel_init.c | 37 --------
include/linux/soundwire/sdw_intel.h | 2 -
sound/soc/sof/intel/cnl.c | 4 +
sound/soc/sof/intel/hda.c | 63 ++++++++++++-
sound/soc/sof/intel/hda.h | 12 +++
sound/soc/sof/intel/icl.c | 2 +
sound/soc/sof/intel/mtl.c | 131 +++++++++++-----------------
sound/soc/sof/intel/shim.h | 2 +
sound/soc/sof/intel/tgl.c | 8 ++
9 files changed, 139 insertions(+), 122 deletions(-)

--
2.25.1



2022-11-11 05:03:46

by Bard Liao

[permalink] [raw]
Subject: [PATCH 4/8] ASoC: SOF: Intel: mtl: move SoundWire interrupt enabling to callback

From: Pierre-Louis Bossart <[email protected]>

There's no real rationale for enabling the SoundWire interrupt in the
init, this can be done from the enable_sdw_irq() callback.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Signed-off-by: Bard Liao <[email protected]>
---
sound/soc/sof/intel/mtl.c | 44 ++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c
index 43ffcccec0be..a0839804a6da 100644
--- a/sound/soc/sof/intel/mtl.c
+++ b/sound/soc/sof/intel/mtl.c
@@ -134,6 +134,31 @@ static void mtl_disable_ipc_interrupts(struct snd_sof_dev *sdev)
MTL_DSP_REG_HFIPCXCTL_BUSY | MTL_DSP_REG_HFIPCXCTL_DONE, 0);
}

+static void mtl_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable)
+{
+ u32 hipcie;
+ u32 mask;
+ u32 val;
+ int ret;
+
+ /* Enable/Disable SoundWire interrupt */
+ mask = MTL_DSP_REG_HfSNDWIE_IE_MASK;
+ if (enable)
+ val = mask;
+ else
+ val = 0;
+
+ snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, MTL_DSP_REG_HfSNDWIE, mask, val);
+
+ /* check if operation was successful */
+ ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, MTL_DSP_REG_HfSNDWIE, hipcie,
+ (hipcie & mask) == val,
+ HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_RESET_TIMEOUT_US);
+ if (ret < 0)
+ dev_err(sdev->dev, "failed to set SoundWire IPC interrupt %s\n",
+ enable ? "enable" : "disable");
+}
+
static int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
{
u32 hfintipptr;
@@ -184,23 +209,6 @@ static int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
return ret;
}

- /* Enable/Disable SoundWire interrupt */
- mask = MTL_DSP_REG_HfSNDWIE_IE_MASK;
- if (enable)
- val = mask;
- else
- val = 0;
-
- snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, MTL_DSP_REG_HfSNDWIE, mask, val);
-
- /* check if operation was successful */
- ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, MTL_DSP_REG_HfSNDWIE, hipcie,
- (hipcie & mask) == val,
- HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_RESET_TIMEOUT_US);
- if (ret < 0)
- dev_err(sdev->dev, "failed to set SoundWire IPC interrupt %s\n",
- enable ? "enable" : "disable");
-
return ret;
}

@@ -568,6 +576,7 @@ static void mtl_ipc_dump(struct snd_sof_dev *sdev)

static int mtl_dsp_disable_interrupts(struct snd_sof_dev *sdev)
{
+ mtl_enable_sdw_irq(sdev, false);
mtl_disable_ipc_interrupts(sdev);
return mtl_enable_interrupts(sdev, false);
}
@@ -645,6 +654,7 @@ const struct sof_intel_dsp_desc mtl_chip_info = {
.sdw_shim_base = SDW_SHIM_BASE_ACE,
.sdw_alh_base = SDW_ALH_BASE_ACE,
.d0i3_offset = MTL_HDA_VS_D0I3C,
+ .enable_sdw_irq = mtl_enable_sdw_irq,
.check_sdw_irq = mtl_dsp_check_sdw_irq,
.check_ipc_irq = mtl_dsp_check_ipc_irq,
.cl_init = mtl_dsp_cl_init,
--
2.25.1


2022-11-11 05:32:23

by Bard Liao

[permalink] [raw]
Subject: [PATCH 8/8] ASoC: SOF: Intel: hda: read multi-link capabilities earlier

From: Pierre-Louis Bossart <[email protected]>

There's no reason to delay the multi-link parsing, this can be done
earlier before checking the SoundWire capabilities.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Signed-off-by: Bard Liao <[email protected]>
---
sound/soc/sof/intel/hda.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 2f9d69e64091..14a2f8701350 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -944,6 +944,8 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
return ret;
}

+ hda_bus_ml_get_capabilities(bus);
+
/* scan SoundWire capabilities exposed by DSDT */
ret = hda_sdw_acpi_scan(sdev);
if (ret < 0) {
@@ -972,8 +974,6 @@ static int hda_init_caps(struct snd_sof_dev *sdev)

skip_soundwire:

- hda_bus_ml_get_capabilities(bus);
-
/* create codec instances */
hda_codec_probe_bus(sdev);

--
2.25.1


2022-11-25 15:08:42

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/8] ASoC/soundwire: revisit interrupt and lcount handling

On Fri, 11 Nov 2022 12:26:45 +0800, Bard Liao wrote:
> The code in drivers/soundwire/intel_init.c is hardware-dependent and the
> code does not apply to new generations starting with MeteorLake. Refactor
> and clean-up the code to make this intel_init.c hardware-agnostic and
> move all hardware-dependencies in the SOF driver using chip descriptors.
>
> The ASoC patches are dependent on some patches that are applied to ASoC
> tree recently. So, this series won't apply to SoundWire tree. @Vinod Could
> you Ack if it looks good to you, and lets go through ASoC tree?
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/8] soundwire: intel_init: remove useless interrupt enablement in interrupt thread
commit: c5e5da1eb3d3009ed861f1514b41bec323c191d1
[2/8] ASoC: SOF: Intel: hda: add per-chip enable_sdw_irq() callback
commit: 8ebc90741e96646af7320336ac4433eea175390a
[3/8] ASoC: SOF: Intel: mtl: factor interrupt enable/disable interrupt functions
commit: 00f4f3380745da4950de2bf65f15af767d54dfe1
[4/8] ASoC: SOF: Intel: mtl: move SoundWire interrupt enabling to callback
commit: aa70a580930a42781f57ac0d8b281ed2f6b0d8ec
[5/8] ASoC: SOF: Intel: hda: add callback to check SoundWire lcount information
commit: 625339caaea15c0e69d833227652d2f5b6e365cc
[6/8] soundwire: intel_init: remove sdw_intel_enable_irq()
commit: 562bb228cebea475cc967c4a53df97ca62aa90b5
[7/8] soundwire: intel_init: remove check on number of links
commit: 2cd24c318cc943b54cbd2d855cee798314619c4e
[8/8] ASoC: SOF: Intel: hda: read multi-link capabilities earlier
commit: 5e2cbc4a813e866885f812f1b64fdf33a9a16700

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark