summaryrefslogtreecommitdiff
path: root/sound/soc/amd
AgeCommit message (Collapse)Author
2018-07-26ASoC: AMD: Fix build warningAkshu Agrawal
Fixes sound/soc/amd/acp-da7219-max98357a.c: In function 'cz_probe': sound/soc/amd/acp-da7219-max98357a.c:367:3: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: AMD: Add a fix voltage regulator for DA7219 and ADAU7002Akshu Agrawal
DA7219 for our platform need to be configured for 1.8V. Hence, we add a volatge regulator with supplies of 1.8V in the machine driver. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-16ASoC: AMD: For capture have interrupts on I2S->ACP channelAgrawal, Akshu
Having interrupts enabled for ACP<->SYSMEM DMA transfer, we are in for an interrupt storm. For both playback and capture interrupts should be enabled for I2S<->ACP DMA. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-16ASoC: AMD: Send correct channel for configuring DMA descriptorsAgrawal, Akshu
Earlier, ch1 was used to define ACP-SYSMEM transfer and ch2 for ACP-I2S transfer. With recent patches ch1 is used to define channel order number 1 and ch2 as channel order number 2. Thus, Playback: ch1:SYSMEM->ACP ch2:ACP->I2S Capture: ch1:I2S->ACP ch1:ACP->SYSMEM Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Simplify trigger handlerDaniel Kurtz
Now that the I2S channel names are fixed, and DMA data flow order is consistent (ch1 then ch2), we can simplify channel start order: start the upstream channel and then the downstream channel for both playback and capture cases. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Reset bytescount when starting transactionDaniel Kurtz
The pointer() callback gets its value by reading the I2S BYTE_COUNT register. This is a 64-bit runnning transaction counter. If a transaction was aborted in the middle of a sample buffer, the counter will stop counting on a number divisible by the buffer size. Since we actually use it as a pointer into an aligned buffer, however, we do want to ensure that it always starts at a number divisible by the buffer size when starting a transaction, hence we reset it whenever starting a transaction. To accomplish this, it wasn't necessary to zero bytescount at the termination of each transaction, so remove this unnecessary code. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Do not generate interrups for every captured sampleDaniel Kurtz
On capture, audio data is first copied from I2S to ACP memory, and then from ACP to SYSRAM. The I2S_TO_ACP_DMA interrupt fires on every sample transferred from I2S to ACP memory. That is it fires ~48000 times per second when capturing @ 48 kHz. Since we don't do anything on this interrupt anyway, disable it to save quite a few unnecessary interrupts. The real "work" (calling snd_pcm_period_elapsed()) is done when transfer from ACP to SYSRAM is complete. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Fix Capture DMA channel namesDaniel Kurtz
On capture, audio data is first copied from I2S to ACP memory, and then to SYSRAM. For each step the channel number increases, so the names in the driver were wrong. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Always subtract bytescountDaniel Kurtz
It is always correct to subtract out the starting bytescount value. Even in the case of 2^64 byte rollover (292 Million Years in the future @ 48000 Hz) the math still works out. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03ASoC: AMD: Always stop ch2 firstDaniel Kurtz
Commit 6b116dfb4633a ("ASoC: AMD: make channel 1 dma as circular") made both channels circular, so this comment and logic no longer applies. Always stop ch2 (the channel closest to the output) before ch1. This ensures that the downstream circular DMA channel does not continue to play/capture repeated samples after the upstream circular DMA channel has already stopped. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-22ASoC: AMD: Configure channel 1 or channel 0 for captureAkshu Agrawal
ST/CZ SoC have 2 channels for capture in the I2SSP path. The DMA though these channels is done using the same dma descriptors. We configure the channel and enable it on the basis of channel selected by machine driver. Machine driver knows which codec sits on which channel and thus sends the information to dma driver. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-22Merge branch 'asoc-4.18' into asoc-4.19 for amd depMark Brown
2018-06-22ASoC: AMD: Change codec to channel link as per hardware redesignAgrawal, Akshu
This is a correction to match acutal hardware configuration. The hardware configuration looks like: I2S_BT -> SPK(Max) + DMIC(Adau) I2S_SP -> DA7219 Headset No actual products have been shipped with previous configuration. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-18ASoC: AMD: Add NULL pointer checkAgrawal, Akshu
Fix crash in those platforms whose machine driver does not expose platform_info. For those platforms we rely on default value and select I2SSP channel. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-29ASoC: AMD: make channel 1 dma as circularAgrawal, Akshu
channel 1: SYSMEM<->ACP channel 2: ACP<->I2S Instead of waiting on period interrupt of ch 2 and then starting dma on ch1, we make ch1 dma as circular. This removes dependency of period granularity on hw pointer. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: amd: dma driver changes for bt i2s instanceMukunda, Vijendar
With in ACP, There are three I2S controllers can be configured/enabled ( I2S SP, I2S MICSP, I2S BT). Default enabled I2S controller instance is I2S SP. This patch provides required changes to support I2S BT controller Instance. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Add const to snd_soc_ops instancesAkshu Agrawal
Marking snd_soc_ops instances const Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Fix clocks in CZ DA7219 machine driverAkshu Agrawal
System clock on the platform is 25Mhz and not 24Mhz. PLL_OUT for da7219 codec to use DA7219_PLL_FREQ_OUT_98304 as it is for 48KHz SR. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Move clk enable from hw_params/free to startup/shutdownAkshu Agrawal
hw_param can be called multiple times and thus we can have more clk enable. The clk may not get diabled due to refcounting. startup/shutdown ensures single clk enable/disable call. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: amd: memory release for rtd structureMukunda, Vijendar
rtd structure freed early may result in kernel panic in dma close call back. moved releasing memory for rtd structure to the end of dma close callback. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: amd: sram bank update changesMukunda, Vijendar
Added sram bank variable to audio_substream_data structure. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: amd: pte offset related dma driver changesMukunda, Vijendar
Added pte offset variable in audio_substream_data structure. Added Stoney related PTE offset macros in acp header file. Modified hw_params callback to assign the pte offset value based on asic_type. PTE Offset macros used to calculate no of PTE entries need to be programmed when memory allocated for audio buffer. Depending upon allocated audio buffer size, PTE offset values will change. Compared to CZ, Stoney has SRAM memory limitation i.e 48k It is required to define separate PTE Offset macros for Stoney. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: amd: removed separate byte count variables for playback and captureVijendar Mukunda
Removed separate byte count variables for playback and capture. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: amd: added byte count register offset variables to rtdVijendar Mukunda
Added byte count register offset variables to audio_substream_data structure. Modified dma pointer callback. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: amd: dma config parameters changesVijendar Mukunda
Added dma configuration parameters to rtd structure. Moved dma configuration parameters initialization to hw_params callback. Removed hard coding in prepare and trigger callbacks. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-02ASoC: amd: fix spelling mistake: "failer" -> "failure"Colin Ian King
Trivial fix to spelling mistake in dev_err error message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-26ASoC: amd: rename audio_substream_data variableMukunda, Vijendar
In order to make audio_substream_data structure variable consistent throughout the code, changed the name from audio_config to rtd wherever applicable. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-17ASoC: amd: fixed checkpatch pl warningsMukunda, Vijendar
fixed checkpatch pl warnings. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-16ASoC: amd: acp-da7219-max98357: Make symbol da7219_dai_clk staticWei Yongjun
Fixes the following sparse warning: sound/soc/amd/acp-da7219-max98357a.c:46:12: warning: symbol 'da7219_dai_clk' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-16ASoC: AMD: Support headset button on Stoney DA7219Agrawal, Akshu
Adds headset button support. TEST=Tested Volume UP/Down, Play/Pause functionality Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-28Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5651', ↵Mark Brown
'asoc/topic/rt5659' and 'asoc/topic/rt5660' into asoc-next
2018-03-28Merge remote-tracking branches 'asoc/topic/ak5386', 'asoc/topic/ak5558', ↵Mark Brown
'asoc/topic/alc5623', 'asoc/topic/alc5632' and 'asoc/topic/amd' into asoc-next
2018-03-28Merge remote-tracking branch 'asoc/topic/component-platform' into asoc-nextMark Brown
2018-03-28ASoC: amd: don't use codec anymoreKuninori Morimoto
commit c88d31153356 ("ASoC: amd: Enable da7219 master clock using common clock framework") is using rtd->codec, but codec is replaced to component. Let's use component Fixes: c88d31153356 ("ASoC: amd: Enable da7219 master clock using common clock framework") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-21Merge branch 'topic/intel' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-amd
2018-03-20ASoC: amd: Enable da7219 master clock using common clock frameworkAkshu Agrawal
DA7219 is clock master for other codecs. DA7219 has exposed clock control by using common clock framework and same is used to enable and disable clock for all codecs in the system. TEST=aplay -D hw:0,0 -vv <file> arecord -D hw:0,0 -f dat -d 5 -vv <file> aplay -D hw:0,1 -vv <file> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-20ASoC: amd: Use single dai for da7219 playback and captureAkshu Agrawal
BT I2S is a bi-directional dai, we will use the same cpu dai for playback and capture. TEST=aplay -D hw:0,0 -vv <file> arecord -D hw:0,0 -f dat -d 5 -vv <file> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-09ASoC: amd: modifications in dma stop sequenceVijendar Mukunda
As per design, non-circular dma also need to be stopped explicitly for both playback and capture scenarios. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-09ASoC: amd: 16bit resolution support for i2s sp instanceVijendar Mukunda
Moved 16bit resolution condition check for stoney platform to acp_hw_params.Depending upon substream required register value need to be programmed rather than enabling 16bit resolution support all time in acp init. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-19ASoC: amd: Coding style changes for acp dma driverMukunda, Vijendar
Removed hardcoding in dma descriptor programming api's. These changes are required to extend the logic to support dma descriptor programming for multiple i2s controller instances. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-19ASoC: amd: renaming pcm substream names and bytescount paramsMukunda, Vijendar
With in ACP, There are three I2S controllers can be configured. (I2S SP ,I2S MICSP and I2S BT).These controllers can support both playback/capture scenarios. Default enabled i2s controller instance is i2s sp instance. Renamed stream names and bytescount params as i2ssp. These changes required to distinguish with other I2S controller instance pcm substreams and bytescount params. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-19ASoC: amd: acp-da7219-max98357: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-16ASoC: AMD: Add machine driver for ST DA7219 MAX98357Akshu Agrawal
The driver is used for AMD board using DA7219 and MAX98357 codec. TEST=Build, apply grunt_mixer_settings: iotools mmio_write32 0xfed80e40 0x040c40c0 iotools mmio_write32 0xfed80e28 0x10000 iotools mmio_write8 0xfed816de 0xc0 aplay -D plughw:0,0 ./sample_48000.wav -vv aplay -D plughw:0,0 ./sample_44100.wav -vv Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: amd: replace platform to componentKuninori Morimoto
Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Mukunda,Vijendar <vijendar.mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: rt5645/rt5677: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Because Intel/Mediatek platforms are using rt5645/rt5677, we need to update these all related drivers in same time. Otherwise compile error/warning happen rt5645: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 rt5677: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-04ASoC: amd: added error checks in dma driverMukunda, Vijendar
added additional error checks in acp dma driver v2: printed error codes for acp init & acp deinit failure cases. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-27ASoC: amd: Add error checking to probe functionGuenter Roeck
The acp_audio_dma does not perform sufficient error checking in its probe function. This can result in crashes if a critical error path is encountered. Fixes: 7c31335a03b6a ("ASoC: AMD: add AMD ASoC ACP 2.x DMA driver") Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Dominik Behr <dbehr@chromium.org> Cc: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-10Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ac97-mfd', ↵Mark Brown
'asoc/topic/amd' and 'asoc/topic/arizona-mfd' into asoc-next
2017-11-09ASoC: amd: Modified DMA transfer Mechanism for PlaybackVijendar Mukunda
Before rendering starts, DMA driver copies full buffer valid data to ACP SRAM for the first time, after that ACP SRAM to I2S FIFO DMA will be initiated. After rendering first half of ACP SRAM, IOC will be raised then Audio data will be copied from first half of System Memory to first half of ACP SRAM. Similarly after rendering second half of ACP SRAM, IOC will be raised then Audio Data will be copied from second half of the System Memory to second half of the ACP SRAM in ping-pong way till rendering stops. Old design introducing latency issues resulting stutter sound observed during playback. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Akshu Agrawal <Akshu.Agrawal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-08ASoC: amd: use do_div rather than 64 bit division to fix 32 bit buildsGuenter Roeck
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>