Skip to contentSkip to conversation

Fixes for avs driver

PATCH In review Amadeusz Sławiński 3 participants 6 messages Jan 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fixes for avs driver

First patch fixes problems reported when performing shutdown. Second one is for a problem reported by LKP. Last one fixes problem reported by checkpatch.

Amadeusz Sławiński (3):
ASoC: Intel: avs: Implement PCI shutdown
ASoC: Intel: avs: Correctly access topology fiels
ASoC: Intel: avs: Use min_t instead of min with cast

 sound/soc/intel/avs/core.c     | 24 ++++++++++++++++++++++++
 sound/soc/intel/avs/topology.c |  2 +-
 sound/soc/intel/avs/trace.c    |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 ASoC: Intel: avs: Implement PCI shutdown

On shutdown reference to i915 driver needs to be released to not spam logs with unnecessary warnings. While at it do some additional cleanup to make sure DSP is powered down and interrupts from device are disabled.

Fixes 1affc44ea5dd ("ASoC: Intel: avs: PCI driver implementation")
---
 sound/soc/intel/avs/core.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
sound/soc/intel/avs/core.c +24 -0
index 2ca24273c491..637501850728 100644
@@ -481,6 +481,29 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
 	return ret;
 }
 
+static void avs_pci_shutdown(struct pci_dev *pci)
+{
+	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct avs_dev *adev = hdac_to_avs(bus);
+
+	cancel_work_sync(&adev->probe_work);
+	avs_ipc_block(adev->ipc);
+
+	snd_hdac_stop_streams(bus);
+	avs_dsp_op(adev, int_control, false);
+	snd_hdac_ext_bus_ppcap_int_enable(bus, false);
+	snd_hdac_ext_bus_link_power_down_all(bus);
+
+	snd_hdac_bus_stop_chip(bus);
+	snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
+
+	if (avs_platattr_test(adev, CLDMA))
+		pci_free_irq(pci, 0, &code_loader);
+	pci_free_irq(pci, 0, adev);
+	pci_free_irq(pci, 0, bus);
+	pci_free_irq_vectors(pci);
+}
+
 static void avs_pci_remove(struct pci_dev *pci)
 {
 	struct hdac_device *hdev, *save;
@@ -739,6 +762,7 @@ static struct pci_driver avs_pci_driver = {
 	.id_table = avs_ids,
 	.probe = avs_pci_probe,
 	.remove = avs_pci_remove,
+	.shutdown = avs_pci_shutdown,
 	.driver = {
 		.pm = &avs_dev_pm,
 	},
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 ASoC: Intel: avs: Correctly access topology fiels

In reply to Amadeusz Sławiński

Fixes following warning:
sound/soc/intel/avs/topology.c:1636:20: sparse: sparse: restricted __le32 degrades to integer

---
 sound/soc/intel/avs/topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/topology.c +1 -1
index 5fee7a8ec06a..cdb4ec500261 100644
@@ -1633,7 +1633,7 @@ avs_control_load(struct snd_soc_component *comp, int index, struct snd_kcontrol_
 	size_t block_size;
 	int ret;
 
-	switch (hdr->type) {
+	switch (le32_to_cpu(hdr->type)) {
 	case SND_SOC_TPLG_TYPE_MIXER:
 		tmc = container_of(hdr, typeof(*tmc), hdr);
 		tuples = tmc->priv.array;
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 ASoC: Intel: avs: Use min_t instead of min with cast

In reply to Amadeusz Sławiński

Checkpatch script recommends using min_t instead of min with the cast.

Fixes 69b23b3937a1 ("ASoC: Intel: avs: Event tracing")
---
 sound/soc/intel/avs/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/trace.c +1 -1
index fcb7cfc823d6..c63eea909b5e 100644
@@ -24,7 +24,7 @@ void trace_avs_msg_payload(const void *data, size_t size)
 	while (remaining > 0) {
 		u32 chunk;
 
-		chunk = min(remaining, (size_t)MAX_CHUNK_SIZE);
+		chunk = min_t(size_t, remaining, MAX_CHUNK_SIZE);
 		trace_avs_ipc_msg_payload(data, chunk, offset, size);
 
 		remaining -= chunk;
Signature · 1 line
2.25.1
maintainer Reviewed-by on the v1 series
#4 lore raw
In reply to Amadeusz Sławiński
Quoted 9 lines · Amadeusz Sławiński

First patch fixes problems reported when performing shutdown. Second one is for a problem reported by LKP. Last one fixes problem reported by checkpatch.

Amadeusz Sławiński (3):
ASoC: Intel: avs: Implement PCI shutdown
ASoC: Intel: avs: Correctly access topology fiels
ASoC: Intel: avs: Use min_t instead of min with cast

Quoted 5 lines
  sound/soc/intel/avs/core.c     | 24 ++++++++++++++++++++++++
  sound/soc/intel/avs/topology.c |  2 +-
  sound/soc/intel/avs/trace.c    |  2 +-
  3 files changed, 26 insertions(+), 2 deletions(-)

Series has been reviewed by me internally before sending, so:

maintainer
#5 lore raw
In reply to Amadeusz Sławiński
Quoted 10 lines · Amadeusz Sławiński

First patch fixes problems reported when performing shutdown. Second one is for a problem reported by LKP. Last one fixes problem reported by checkpatch.

Amadeusz Sławiński (3):
ASoC: Intel: avs: Implement PCI shutdown
ASoC: Intel: avs: Correctly access topology fiels
ASoC: Intel: avs: Use min_t instead of min with cast

[...]

Applied to

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

Thanks!

[1/3] ASoC: Intel: avs: Implement PCI shutdown

      commit: f89d783d68dcc6b2ce4fe3bda972ae0f84df0dca

[2/3] ASoC: Intel: avs: Correctly access topology fiels
(no commit info)
[3/3] ASoC: Intel: avs: Use min_t instead of min with cast
(no commit info)

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