We shouldn't assume CPU physical address we get from page_to_phys()
is same as DMA address we get from dma_alloc_coherent(). On x86_64,
we won't run into any problem with the assumption when dma_ops is
nommu_dma_ops. However, DMA address is IOVA when IOMMU is enabled.
And it's most likely different from CPU physical address when AMD
IOMMU is not in passthrough mode.
This patch fixes page faults when IOMMU is enabled.
Signed-off-by: Vijendar Mukunda <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
AMD platform device acp3x_rv_i2s created by parent PCI device
driver. Pass struct device of the parent to
snd_pcm_lib_preallocate_pages() so dma_alloc_coherent() can use
correct dma_ops. Otherwise, it will use default dma_ops which
is nommu_dma_ops on x86_64 even when IOMMU is enabled and
set to non passthrough mode.
Signed-off-by: Vijendar Mukunda <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: Kuninori Morimoto <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: Kuninori Morimoto <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms and conditions of the gnu general public license
version 2 as published by the free software foundation this program
is distributed in the hope it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 263 file(s).
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Allison Randal <[email protected]>
Reviewed-by: Alexios Zavras <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
acp3x dma pointer callback has issues in reporting hw_ptr.
Modified logic to use linear position registers to
retrieve accurate hw_ptr.
Signed-off-by: Ravulapati Vishnu vardhan rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Fix sparse warning:
sound/soc/amd/raven/acp3x-pcm-dma.c:561:24: warning:
symbol 'acp3x_dai_i2s_ops' was not declared. Should it be static?
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
With CCF support in da7219, we can now set the correct rate of
wclk and bclk.
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
When using bare externs outside include files that types should
at least match. This fixes a type confusion between bool
and int.
Cc: [email protected]
Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
As the DAI clocks for DA7219 have now been split into BCLK and WCLK,
the clock lookup name needs to be udpated here to select BCLK to
achieve the same functionality as before with regards to DAI clock
gating.
Signed-off-by: Adam Thomson <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant. Drop it.
Reviewed-by: Jaroslav Kysela <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
We should pass a proper non-NULL device object to memory allocators
although it was accepted in the past. The card->dev points to the
most appropriate device object in such a case, so let's put it.
Acked-by: Christoph Hellwig <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Check return value from call to devm_kzalloc() in order to prevent a
potential NULL pointer dereference.
Also, notice that it makes no sense to allocate any resources if
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); fails,
so move the call to devm_kzalloc() below the mentioned code.
Lastly, improve the use of sizeof in the call to devm_kzalloc() by
changing it from sizeof(struct i2s_dev_data) to sizeof(*adata)
This issue was detected with the help of Coccinelle.
Fixes: ac289c7ec0 ("ASoC: amd: add ACP3x PCM platform driver")
Cc: [email protected]
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
AMD platform device acp_audio_dma can only be created by parent PCI
device driver (drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c). Pass struct
device of the parent to snd_pcm_lib_preallocate_pages() so
dma_alloc_coherent() can use correct dma_ops. Otherwise, it will
use default dma_ops which is nommu_dma_ops on x86_64 even when
IOMMU is enabled and set to non passthrough mode.
Though platform device inherits some dma related fields during its
creation in mfd_add_device(), we can't simply pass its struct device
to snd_pcm_lib_preallocate_pages() because dma_ops is not among the
inherited fields. Even it were, drivers/iommu/amd_iommu.c would
ignore it because get_device_id() doesn't handle platform device.
This change shouldn't give us any trouble even struct device of the
parent becomes null or represents some non PCI device in the future,
because get_dma_ops() correctly handles null struct device or uses
the default dma_ops if struct device doesn't have it set.
Signed-off-by: Yu Zhao <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
We shouldn't assume CPU physical address we get from page_to_phys()
is same as DMA address we get from dma_alloc_coherent(). On x86_64,
we won't run into any problem with the assumption when dma_ops is
nommu_dma_ops. However, DMA address is IOVA when IOMMU is enabled.
And it's most likely different from CPU physical address when AMD
IOMMU is not in passthrough mode.
Signed-off-by: Yu Zhao <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The platform_device_register_full() function doesn't return NULL, it
returns error pointers.
Fixes: 7894a7e7ea ("ASoC: amd: create ACP3x PCM platform device")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
There is a spelling mistake in a dev_err message. Fix this.
Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Fixes gcc '-Wunused-but-set-variable' warning:
sound/soc/amd/raven/acp3x-pcm-dma.c: In function 'acp3x_dma_hw_params':
sound/soc/amd/raven/acp3x-pcm-dma.c:333:25: warning:
variable 'dma_buffer' set but not used [-Wunused-but-set-variable]
It never used since introduction in commit
8de1b5ed03 ("ASoC: amd: add acp3x system resume pm op")
Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Fixed build errors.
- Implicit declaration of pci_enable_msi() & pci_disable_msi()
api's for openrisc architecture.
- type defaults to 'int' in declaration of 'module_pci_driver'
Enabled build for x86 architecture.
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Currently when snd_pcm_hw_constraint_integer fails there is
a memory leak of i2s_data on the error return path. Fix this by
kfree'ing i2s_data before returning.
Detected by CoverityScan, CID#1475479 ("Resource leak")
Fixes: 0b87d6bcd6 ("ASoC: amd: add acp3x pcm driver dma ops")
Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP3x drivers can be built by selecting necessary kernel config option.
The patch enables build support of the same.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
When system wide suspend happens, ACP will be powered off.
When system resumes, all the runtime configuration data for
ACP needs to be programmed again.
Added 'resume'pm call back to ACP pm ops.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP3x I2S (CPU DAI) can act in normal I2S and TDM modes.
Added support for TDM mode.
Desired mode can be selected from ASoC machine driver.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP3x has a i2s controller block for playback and capture.
This patch adds ACP3x i2s DAI operations.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP3x has a DMA controller to access system memory.
This controller transfers data from/to system memory
to/from the ACP internal FIFO.
The patch adds PCM driver DMA operations.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Whenever audio data equal to the I2S FIFO watermark level are
produced/consumed, interrupt is generated.
Acknowledge the interrupt.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
PCM platform driver binds to the platform device created by ACP3x PCI
device. PCM driver registers ALSA DMA and CPU DAI components with ASoC
framework.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP 3x IP has I2S controller device as one of IP blocks.
Create a platform device for it, so that the PCM platform driver
can be bound to this device. Pass PCI resources like MMIO, irq
to the platform device.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP 3.0 is a PCI audio device. This patch adds PCI driver to bind
to this device and get PCI resources.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Signed-off-by: Sanju R Mehta <[email protected]>
Tested-by: Ravulapati Vishnu vardhan Rao <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP 3.x is a new audio block in raven. Added register header
of the same.
Signed-off-by: Maruthi Bayyavarapu <[email protected]>
Signed-off-by: Vijendar Mukunda <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The regulator_desc structure can be const as it is only passed as the
second argument of devm_regulator_register and the corresponding
parameter is declared as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Some 3 pole connectors report impedance greater than threshold of
1000Ohm. Thus, da7219 reports them as LINEOUT.
Adding the SND_JACK_LINEOUT type so that we don't fail to detect
any 3 pole jack type.
Also, changing
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE -> SND_JACK_HEADSET
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
alsa_conformance_test -C hw:0,4 -p 1024 --debug
would sometime show:
TIME_DIFF(s) HW_LEVEL READ RATE
0.000095970 1024 1024 10670001.041992
0.042609555 1024 2048 24032.168372
0.021330364 1024 3072 48006.681930
0.021339559 1024 4096 47985.996337
The issue is that in dma pointer function we can have stale value
of the register for current descriptor of channel.
The register retains the number of the last descriptor that
was transferred.
Fix ensures that we report position, 0, till the one period worth of
data is transferred. After one period of data, in handler of period
completion interrupt we update the config and correct value of descriptor
starts reflecting.
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
If capture and playback are started on different channel (I2S/BT)
there is a possibilty that channel information passed from machine driver
is overwritten before the configuration is done in dma driver.
Example:
113.597588: cz_max_startup: ---playback sets BT channel
113.597694: cz_dmic1_startup: ---capture sets I2S channel
113.597979: acp_dma_hw_params: ---configures capture for I2S channel
113.598114: acp_dma_hw_params: ---configures playback for I2S channel
This is fixed by having 2 separate instance for playback and capture.
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
HW register descriptions says:
"DMA Channel Reset...Software must confirm that this bit is
cleared before reprogramming any of the channel configuration registers."
There could be cases where dma stop errored out leaving dma channel
in reset state. We need to ensure that before the start of another dma,
channel is out of the reset state.
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
25Mhz MCLK which was earlier used was of spread type.
Thus, we were not getting accurate rate. The 48Mhz system
clk is of non-spread type and we are changing to it to get
accurate rate.
Signed-off-by: Akshu Agrawal <[email protected]>
Reviewed-by: Daniel Kurtz <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
We support dual channel, 48Khz. This constraint was set only for
da7219. It is being extended to DMIC and MAX98357a.
Signed-off-by: Akshu Agrawal <[email protected]>
Reviewed-by: Daniel Kurtz <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
ACP->SYSMEM DMA happens at every I2S->SYSMEM period
completion. Thus, there is delay of x frames till
I2S->SYSMEM reaches a period length. This delay is
communicated to user space.
Signed-off-by: Akshu Agrawal <[email protected]>
Signed-off-by: Mark Brown <[email protected]>