[alsa-devel] [PATCH v2 0/3] 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(-)
From: Akshu Agrawal akshu.agrawal@amd.com
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
Signed-off-by: Akshu Agrawal akshu.agrawal@amd.com Reviewed-on: https://chromium-review.googlesource.com/678278 Tested-by: Jason Clinton jclinton@chromium.org Reviewed-by: Jason Clinton jclinton@chromium.org Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/soc/amd/Makefile | 4 ++-- sound/soc/amd/acp-pcm-dma.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index eed64ff6c73e..f07fd2e2870a 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -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 diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index e19f281afeaa..13d040a4d26f 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -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("Vijendar.Mukunda@amd.com"); MODULE_AUTHOR("Maruthi.Bayyavarapu@amd.com"); MODULE_DESCRIPTION("AMD ACP PCM Driver"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:acp-dma-audio"); +MODULE_ALIAS("platform:"DRV_NAME);
On Wed, Nov 08, 2017 at 12:24:02PM -0500, Alex Deucher wrote:
From: Akshu Agrawal akshu.agrawal@amd.com
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.
-----Original Message----- From: Mark Brown [mailto:broonie@kernel.org] Sent: Wednesday, November 08, 2017 1:09 PM To: Alex Deucher Cc: amd-gfx@lists.freedesktop.org; alsa-devel@alsa-project.org; dri- devel@lists.freedesktop.org; Mukunda, Vijendar; lgirdwood@gmail.com; tiwai@suse.de; Agrawal, Akshu; Deucher, Alexander Subject: Re: [PATCH 1/3] ASoC: AMD: Make the driver name consistent across files
On Wed, Nov 08, 2017 at 12:24:02PM -0500, Alex Deucher wrote:
From: Akshu Agrawal akshu.agrawal@amd.com
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.
This didn't not appear to be in your tree yet and I never got any confirmation it being applied. Apologies.
Alex
On Wed, Nov 08, 2017 at 06:12:34PM +0000, Deucher, Alexander wrote:
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.
From: Akshu Agrawal akshu.agrawal@amd.com
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.
Signed-off-by: Akshu Agrawal akshu.agrawal@amd.com Signed-off-by: Bard Liao bardliao@realtek.com Signed-off-by: Alex Deucher alexander.deucher@amd.com ---
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(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 23cc2cb8393f..ce5d2c3c6976 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -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);
On Wed, Nov 08, 2017 at 12:24:03PM -0500, Alex Deucher wrote:
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?
On 11/8/2017 11:39 PM, Mark Brown wrote:
On Wed, Nov 08, 2017 at 12:24:03PM -0500, Alex Deucher wrote:
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?
My bad, I should have removed the addition of register read from the patch.
From: Guenter Roeck groeck@chromium.org
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"
Signed-off-by: Guenter Roeck groeck@chromium.org Reviewed-on: https://chromium-review.googlesource.com/678919 Reviewed-by: Jason Clinton jclinton@chromium.org (cherry picked from commit 7ca726e80f21abdbaed9a5a70def1c33a26f8533) Reviewed-on: https://chromium-review.googlesource.com/681618 Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/soc/amd/acp-pcm-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 13d040a4d26f..ef7e98ad960c 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -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); }
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 groeck@chromium.org 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) Signed-off-by: Guenter Roeck groeck@chromium.org Reviewed-on: https://chromium-review.googlesource.com/678919 Reviewed-by: Jason Clinton jclinton@chromium.org Reviewed-on: https://chromium-review.googlesource.com/681618 Signed-off-by: Alex Deucher alexander.deucher@amd.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/amd/acp-pcm-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 13d040a4d26f..ef7e98ad960c 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -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); }
participants (4)
-
Agrawal, Akshu
-
Alex Deucher
-
Deucher, Alexander
-
Mark Brown