Skip to contentSkip to conversation

Fixes for AMD Stoney ACP audio

PATCH Superseded Alex Deucher 6 participants 14 messages Nov 8, 2017 – Nov 9, 2017 4 messages not in the archive

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fixes for AMD Stoney ACP audio

This patch set is just a couple fixes for the Audio CoProcessor (ACP) on AMD Stoney platforms and a small general fix for the rt5645 codec driver.

The entire patch set can also be viewed here:
https://cgit.freedesktop.org/~agd5f/linux/log/?h=sound-for-next-stoney2

Thanks!

Alex

v2: - Add a fix for a 64 bit divide in hw_ptr patch
- rework rt5645 patch as per Mark's comments

Akshu Agrawal (2):
ASoC: AMD: Make the driver name consistent across files
ASoC: rt5645: Wait for 400msec before concluding on value of

    RT5645_VENDOR_ID2

Guenter Roeck (1):
FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

 sound/soc/amd/Makefile      | 4 ++--
 sound/soc/amd/acp-pcm-dma.c | 9 +++++----
 sound/soc/codecs/rt5645.c   | 9 +++++++++
 3 files changed, 16 insertions(+), 6 deletions(-)
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20171108172404.19118-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/3 ASoC: AMD: Make the driver name consistent across files

From: Akshu Agrawal <[email protected]>

This fixes the issue of driver not getting auto loaded with
MODULE_ALIAS.
find /sys/devices -name modalias -print0 | xargs -0 grep 'audio' /sys/devices/pci0000:00/0000:00:01.0/acp_audio_dma.0.auto/modalias:platform:acp_audio_dma

BUG=b:62103837
TEST=boot and check for device in lsmod

Reviewed-on: https://chromium-review.googlesource.com/678278

---
 sound/soc/amd/Makefile      | 4 ++--
 sound/soc/amd/acp-pcm-dma.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
sound/soc/amd/Makefile +2 -2
index eed64ff6c73e..f07fd2e2870a 100644
@@ -1,5 +1,5 @@
-snd-soc-acp-pcm-objs	:= acp-pcm-dma.o
+acp_audio_dma-objs := acp-pcm-dma.o
 snd-soc-acp-rt5645-mach-objs := acp-rt5645.o
 
-obj-$(CONFIG_SND_SOC_AMD_ACP) += snd-soc-acp-pcm.o
+obj-$(CONFIG_SND_SOC_AMD_ACP) += acp_audio_dma.o
 obj-$(CONFIG_SND_SOC_AMD_CZ_RT5645_MACH) += snd-soc-acp-rt5645-mach.o
sound/soc/amd/acp-pcm-dma.c +4 -2
index e19f281afeaa..13d040a4d26f 100644
@@ -40,6 +40,8 @@
 #define ST_MAX_BUFFER (ST_PLAYBACK_MAX_PERIOD_SIZE * PLAYBACK_MAX_NUM_PERIODS)
 #define ST_MIN_BUFFER ST_MAX_BUFFER
 
+#define DRV_NAME "acp_audio_dma"
+
 static const struct snd_pcm_hardware acp_pcm_hardware_playback = {
 	.info = SNDRV_PCM_INFO_INTERLEAVED |
 		SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP |
@@ -1189,7 +1191,7 @@ static struct platform_driver acp_dma_driver = {
 	.probe = acp_audio_probe,
 	.remove = acp_audio_remove,
 	.driver = {
-		.name = "acp_audio_dma",
+		.name = DRV_NAME,
 		.pm = &acp_pm_ops,
 	},
 };
@@ -1200,4 +1202,4 @@ MODULE_AUTHOR("[email protected]");
 MODULE_AUTHOR("[email protected]");
 MODULE_DESCRIPTION("AMD ACP PCM Driver");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:acp-dma-audio");
+MODULE_ALIAS("platform:"DRV_NAME);
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#3 lore raw

Re: [PATCH 1/3] ASoC: AMD: Make the driver name consistent across files

Quoted 4 lines · Alex Deucher

From: Akshu Agrawal <[email protected]>

This fixes the issue of driver not getting auto loaded with MODULE_ALIAS.

Please don't resubmit patches that have already been applied, you should submit patches against current code in the tree you're expecting things to be applied to. If any updates are needed to a patch that's already been applied you should submit incremental patches which make those updates. This avoids having to change published git commits which could cause problems for people working against git.

#4 lore raw

RE: [PATCH 1/3] ASoC: AMD: Make the driver name consistent across files

Quoted 16 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Wednesday, November 08, 2017 1:09 PM
To: Alex Deucher
Cc: [email protected]; [email protected]; dri- [email protected]; Mukunda, Vijendar; [email protected]; [email protected]; Agrawal, Akshu; Deucher, Alexander
Subject: Re: [PATCH 1/3] ASoC: AMD: Make the driver name consistent across files

Quoted 4 lines · Alex Deucher

From: Akshu Agrawal <[email protected]>

This fixes the issue of driver not getting auto loaded with MODULE_ALIAS.

Quoted 6 lines

Please don't resubmit patches that have already been applied, you should submit patches against current code in the tree you're expecting things to be applied to. If any updates are needed to a patch that's already been applied you should submit incremental patches which make those updates. This avoids having to change published git commits which could cause problems for people working against git.

This didn't not appear to be in your tree yet and I never got any confirmation it being applied. Apologies.

Alex

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#5 lore raw

Re: [PATCH 1/3] ASoC: AMD: Make the driver name consistent across files

Quoted 2 lines · Alexander

This didn't not appear to be in your tree yet and I never got any confirmation it being applied. Apologies.

Ah, sorry - my bad. This was one that I tried to apply but which didn't apply.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

PATCH 3/3 FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

In reply to a message not in the archive

From: Guenter Roeck <[email protected]>

ERROR: "__aeabi_uldivmod" [sound/soc/amd/snd-soc-acp-pcm.ko] undefined!

64-bit divides require special operations to avoid build errors on 32-bit systems.

BUG=b:63121716
TEST="Build i386:allmodconfig"

Reviewed-on: https://chromium-review.googlesource.com/678919

(cherry picked from commit 7ca726e80f21abdbaed9a5a70def1c33a26f8533)

Reviewed-on: https://chromium-review.googlesource.com/681618

---
 sound/soc/amd/acp-pcm-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-pcm-dma.c +1 -2
index 13d040a4d26f..ef7e98ad960c 100644
@@ -856,12 +856,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream)
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (bytescount > rtd->renderbytescount)
 			bytescount = bytescount - rtd->renderbytescount;
-		pos =  bytescount % buffersize;
 	} else {
 		if (bytescount > rtd->capturebytescount)
 			bytescount = bytescount - rtd->capturebytescount;
-		pos = bytescount % buffersize;
 	}
+	pos = do_div(bytescount, buffersize);
 	return bytes_to_frames(runtime, pos);
 }
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171108172404.19118-4-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Re: [PATCH 3/3] FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

Quoted 11 lines · Alex Deucher

From: Guenter Roeck <[email protected]>

ERROR: "__aeabi_uldivmod" [sound/soc/amd/snd-soc-acp-pcm.ko] undefined!

64-bit divides require special operations to avoid build errors on 32-bit systems.

BUG=b:63121716
TEST="Build i386:allmodconfig"

Is this an upstream submission ? Fine with me, but it should not include any chromium specific tags, neither in the subject not in the description.

Guenter

Quoted 30 lines

Reviewed-on: https://chromium-review.googlesource.com/678919

(cherry picked from commit 7ca726e80f21abdbaed9a5a70def1c33a26f8533)

Reviewed-on: https://chromium-review.googlesource.com/681618

---
 sound/soc/amd/acp-pcm-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-pcm-dma.c +1 -3
index 13d040a4d26f..ef7e98ad960c 100644
@@ -856,12 +856,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct
 snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                if (bytescount > rtd->renderbytescount)
                        bytescount = bytescount - rtd->renderbytescount;
-               pos =  bytescount % buffersize;
        } else {
                if (bytescount > rtd->capturebytescount)
                        bytescount = bytescount - rtd->capturebytescount;
-               pos = bytescount % buffersize;
        }
+       pos = do_div(bytescount, buffersize);
        return bytes_to_frames(runtime, pos);
 }
 
--
Quoted 3 lines

2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CABXOdTdgxOFJb0B7VRivFaf1ihfKQWiyXRX9hFnKetTanmjd5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw

Re: [PATCH 3/3] FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Alex Deucher

From: Guenter Roeck <[email protected]>

ERROR: "__aeabi_uldivmod" [sound/soc/amd/snd-soc-acp-pcm.ko] undefined!

64-bit divides require special operations to avoid build errors on 32-bit systems.

Quoted 6 lines
Quoted 3 lines

BUG=b:63121716
TEST="Build i386:allmodconfig"

Is this an upstream submission ? Fine with me, but it should not include any chromium specific tags, neither in the subject not in the description.

I'm not familiar with which are chromium specific (TEST, BUG, FIXUP, FROMLIST I guess?). The info seems useful to have in the bug, but I can respin if it's a big deal.

Alex

Quoted 33 lines

Guenter

Quoted 30 lines

Reviewed-on: https://chromium-review.googlesource.com/678919

(cherry picked from commit 7ca726e80f21abdbaed9a5a70def1c33a26f8533)

Reviewed-on: https://chromium-review.googlesource.com/681618

---
 sound/soc/amd/acp-pcm-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-pcm-dma.c +1 -2
index 13d040a4d26f..ef7e98ad960c 100644
@@ -856,12 +856,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct
 snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                if (bytescount > rtd->renderbytescount)
                        bytescount = bytescount - rtd->renderbytescount;
-               pos =  bytescount % buffersize;
        } else {
                if (bytescount > rtd->capturebytescount)
                        bytescount = bytescount - rtd->capturebytescount;
-               pos = bytescount % buffersize;
        }
+       pos = do_div(bytescount, buffersize);
        return bytes_to_frames(runtime, pos);
 }
Quoted 4 lines
Quoted 3 lines

--
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw

Re: [PATCH 3/3] FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

Quoted 14 lines · Alex Deucher
Quoted 13 lines · Guenter Roeck
Quoted 11 lines · Alex Deucher

From: Guenter Roeck <[email protected]>

ERROR: "__aeabi_uldivmod" [sound/soc/amd/snd-soc-acp-pcm.ko] undefined!

64-bit divides require special operations to avoid build errors on 32-bit systems.

BUG=b:63121716
TEST="Build i386:allmodconfig"

Quoted 6 lines
Quoted 2 lines

Is this an upstream submission ? Fine with me, but it should not include any chromium specific tags, neither in the subject not in the description.

I'm not familiar with which are chromium specific (TEST, BUG, FIXUP, FROMLIST I guess?). The info seems useful to have in the bug, but I can respin if it's a big deal.

s/bug/commit message/

Alex

Quoted 40 lines

Alex

Quoted 37 lines

Guenter

Quoted 33 lines

Reviewed-on: https://chromium-review.googlesource.com/678919

(cherry picked from commit 7ca726e80f21abdbaed9a5a70def1c33a26f8533)

Reviewed-on: https://chromium-review.googlesource.com/681618

---
 sound/soc/amd/acp-pcm-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-pcm-dma.c +1 -3
index 13d040a4d26f..ef7e98ad960c 100644
@@ -856,12 +856,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct
 snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                if (bytescount > rtd->renderbytescount)
                        bytescount = bytescount - rtd->renderbytescount;
-               pos =  bytescount % buffersize;
        } else {
                if (bytescount > rtd->capturebytescount)
                        bytescount = bytescount - rtd->capturebytescount;
-               pos = bytescount % buffersize;
        }
+       pos = do_div(bytescount, buffersize);
        return bytes_to_frames(runtime, pos);
 }
 
--

2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#12 lore raw

Re: [PATCH 3/3] FIXUP: FROMLIST: ASoC: amd: Report accurate hw_ptr during dma

Quoted 7 lines · Alex Deucher
Quoted 3 lines · Alex Deucher

I'm not familiar with which are chromium specific (TEST, BUG, FIXUP, FROMLIST I guess?). The info seems useful to have in the bug, but I can respin if it's a big deal.

s/bug/commit message/

All of those are Chrome specific. If in doubt look at what other people are using.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#13 lore raw

Applied "ASoC: amd: use do_div rather than 64 bit division to fix 32 bit builds" to the asoc tree

In reply to Alex Deucher

The patch

ASoC: amd: use do_div rather than 64 bit division to fix 32 bit builds

has been applied to the asoc tree at

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

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

From 7db08b2cb36cbfbcb06c44dc8e48ccb6a119466f Mon Sep 17 00:00:00 2001
From: Guenter Roeck <[email protected]>
Date: Wed, 8 Nov 2017 16:34:54 -0500
Subject: [PATCH] ASoC: amd: use do_div rather than 64 bit division to fix 32
bit builds

ERROR: "__aeabi_uldivmod" [sound/soc/amd/snd-soc-acp-pcm.ko] undefined!

64-bit divides require special operations to avoid build errors on 32-bit systems.

[Reword the commit message to make it clearer - Alex]

Fixes 61add8147942 (ASoC: amd: Report accurate hw_ptr during dma)

Reviewed-on: https://chromium-review.googlesource.com/678919

Reviewed-on: https://chromium-review.googlesource.com/681618

---
 sound/soc/amd/acp-pcm-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-pcm-dma.c +1 -2
index 13d040a4d26f..ef7e98ad960c 100644
@@ -856,12 +856,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream)
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (bytescount > rtd->renderbytescount)
 			bytescount = bytescount - rtd->renderbytescount;
-		pos =  bytescount % buffersize;
 	} else {
 		if (bytescount > rtd->capturebytescount)
 			bytescount = bytescount - rtd->capturebytescount;
-		pos = bytescount % buffersize;
 	}
+	pos = do_div(bytescount, buffersize);
 	return bytes_to_frames(runtime, pos);
 }
 
Signature · 6 lines
2.15.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH v2 2/3 ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2

In reply to Alex Deucher

From: Akshu Agrawal <[email protected]>

Minimum time required between power On of codec and read of RT5645_VENDOR_ID2 is 400msec. We should wait that long before reading the value.

TEST=Cold boot the device and check for sound device.

---

v2: rework the patch based on mailing list discussion.
Just wait before reading the register.

 sound/soc/codecs/rt5645.c | 9 +++++++++
 1 file changed, 9 insertions(+)
sound/soc/codecs/rt5645.c +9 -0
index 23cc2cb8393f..ce5d2c3c6976 100644
@@ -55,6 +55,8 @@ MODULE_PARM_DESC(quirk, "RT5645 pdata quirk override");
 
 #define RT5645_HWEQ_NUM 57
 
+#define TIME_TO_POWER_MS 400
+
 static const struct regmap_range_cfg rt5645_ranges[] = {
 	{
 		.name = "PR",
@@ -3786,6 +3788,13 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 	}
 	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
 
+	/*
+	 * Read after 400msec, as it is the interval required between
+	 * read and power On.
+	 */
+	msleep(TIME_TO_POWER_MS);
+	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
+
 	switch (val) {
 	case RT5645_DEVICE_ID:
 		rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);
Signature · 6 lines
2.13.6

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#15 lore raw

Re: [PATCH v2 2/3] ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2

sound/soc/codecs/rt5645.c static int rt5645_i2c_probe(struct i2c_client *i2c, · line 3797

Quoted 9 lines · Alex Deucher
sound/soc/codecs/rt5645.c +7 -0
 	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
 
+	/*
+	 * Read after 400msec, as it is the interval required between
+	 * read and power On.
+	 */
+	msleep(TIME_TO_POWER_MS);
+	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
+

This leaves the original read in there so we've both got the early read (which might upset things potentially) and the delayed read. Shouldn't we just be adding a msleep() before the existing read?

A message that is not in the archive (sent off-list or not yet received): 20171108180957.ddcdyzu2fschypbx-7j8lgAiuQgnQXOPxS62xeg@public.gmane.org

#17 lore raw

Re: [PATCH v2 2/3] ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2

Quoted 4 lines · Mark Brown
Quoted 2 lines · Alex Deucher
  	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
Quoted 12 lines

sound/soc/codecs/rt5645.c static int rt5645_i2c_probe(struct i2c_client *i2c, · line 3797

Quoted 7 lines
sound/soc/codecs/rt5645.c +7 -0
+	/*
+	 * Read after 400msec, as it is the interval required between
+	 * read and power On.
+	 */
+	msleep(TIME_TO_POWER_MS);
+	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
+

This leaves the original read in there so we've both got the early read (which might upset things potentially) and the delayed read. Shouldn't we just be adding a msleep() before the existing read?

My bad, I should have removed the addition of register read from the patch.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx