summaryrefslogtreecommitdiff
path: root/sound/soc/meson/axg-fifo.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-13Merge tag 'asoc-v6.10' of ↵Takashi Iwai1-2/+2
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v6.10 This is a very big update, in large part due to extensive work the Intel people have been doing in their drivers though it's also been busy elsewhere. There's also a big overhaul of the DAPM documentation from Luca Ceresoli arising from the work he did putting together his recent ELC talk, and he also contributed a new tool for visualising the DAPM state. - A new tool dapm-graph for visualising the DAPM state. - Substantial fixes and clarifications for the DAPM documentation. - Very large updates throughout the Intel audio drivers. - Cleanups of accessors for driver data, module labelling, and for constification. - Modernsation and cleanup work in the Mediatek drivers. - Several fixes and features for the DaVinci I2S driver. - New drivers for several AMD and Intel platforms, Nuvoton NAU8325, Rockchip RK3308 and Texas Instruments PCM6240.
2024-05-07ASoC: Constify static snd_pcm_hardwareMark Brown1-1/+1
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Static 'struct snd_pcm_hardware' is not modified by few drivers and its copy is passed to the core, so it can be made const for increased code safety.
2024-05-06ASoC: meson: Constify static snd_pcm_hardwareKrzysztof Kozlowski1-1/+1
Static 'struct snd_pcm_hardware' is not modified by the driver and its copy is passed to the core, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240429-n-asoc-const-snd-pcm-hardware-v1-3-c6ce60989834@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-06ASoC: meson: Use snd_soc_substream_to_rtd() for accessing private_dataKrzysztof Kozlowski1-1/+1
Do not open-code snd_soc_substream_to_rtd(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240430-asoc-snd-substream-clean-v1-11-6f8a8902b479@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-29ASoC: meson: axg-fifo: use threaded irq to check periodsJerome Brunet1-10/+19
With the AXG audio subsystem, there is a possible random channel shift on TDM capture, when the slot number per lane is more than 2, and there is more than one lane used. The problem has been there since the introduction of the axg audio support but such scenario is pretty uncommon. This is why there is no loud complains about the problem. Solving the problem require to make the links non-atomic and use the trigger() callback to start FEs and BEs in the appropriate order. This was tried in the past and reverted because it caused the block irq to sleep while atomic. However, instead of reverting, the solution is to call snd_pcm_period_elapsed() in a non atomic context. Use the bottom half of a threaded IRQ to do so. Fixes: 6dc4fa179fb8 ("ASoC: meson: add axg fifo base driver") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20240426152946.3078805-2-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-27ASoC: meson: axg-fifo: use FIELD helpersJerome Brunet1-12/+13
Use FIELD_GET() and FIELD_PREP() helpers instead of doing it manually. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://msgid.link/r/20240227150826.573581-1-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25ASoC: meson: convert not to use asoc_xxx()Kuninori Morimoto1-1/+1
ASoC is now unified asoc_xxx() into snd_soc_xxx(). This patch convert asoc_xxx() to snd_soc_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pm2oqnik.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11ASoC: meson: axg: extend TDM maximum sample rate to 384kHzJerome Brunet1-1/+1
The TDM HW on the axg SoC families and derivatives actually supports 384kHz sampling rate. Update the fifo and tdm interface constraints accordingly. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20230907090910.13546-1-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20ASoC: meson: Use dev_err_probe() helperKuninori Morimoto1-12/+4
Use the dev_err_probe() helper, instead of open-coding the same operation. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20211214020843.2225831-17-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-07ASoC: meson: axg-fifo: add NO_PERIOD_WAKEUP supportJerome Brunet1-5/+6
On the AXG family, the fifo irq is not necessary for the HW to operate. It is just used to notify that a period has elapsed. If userpace does not care for these wakeups (such as pipewire), we are just wasting CPU cycles. Add support for NO_PERIOD_WAKEUP and disable irq when they are no needed. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20210407145914.311479-1-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-09ASoC: meson: add missing free_irq() in error pathPavel Machek (CIP)1-2/+8
free_irq() is missing in case of error, fix that. Signed-off-by: Pavel Machek (CIP) <pavel@denx.de> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20200606153103.GA17905@amd Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-27ASoC: meson: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointerKuninori Morimoto1-1/+1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/87mu87ir6j.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-18ASoC: meson: axg-fifo: relax period size constraintsJerome Brunet1-4/+4
Now that the fifo depths and thresholds are properly in the axg-fifo driver, we can relax the constraints on period. As long as the period is a multiple of the fifo burst size (8 bytes) things should be OK. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20191218172420.1199117-5-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-18ASoC: meson: axg-fifo: improve depth handlingJerome Brunet1-2/+17
Let the fifo driver parse the fifo depth from DT. Eventually all DT should have this property. Until it is actually the case, default to 256 bytes if the property is missing. 256 bytes is the size of the smallest fifo on the supported SoCs. On the supported SoC, fifo A is usually bigger than the other ones. With depth known, we can improve the usage of the fifo and adapt the setup of request threshold. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20191218172420.1199117-4-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-18ASoC: meson: axg-fifo: fix fifo threshold setupJerome Brunet1-2/+25
On TODDR sm1, the fifo threshold register field is slightly different compared to the other SoCs. This leads to the fifo A being flushed to memory every 8kB. If the period is smaller than that, several periods are pushed to memory and notified at once. This is not ideal. Fix the register field update. With this, the fifos are flushed every 128B. We could still do better, like adapt the threshold depending on the period size, but at least it consistent across the different SoC/fifos Fixes: 5ac825c3d85e ("ASoC: meson: axg-toddr: add sm1 support") Reported-by: Alden DSouza <aldend@google.com> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20191218172420.1199117-2-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-11ASoC: meson: Use managed buffer allocationTakashi Iwai1-9/+4
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20191210142614.19405-6-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-08ASoC: meson: remove snd_pcm_opsKuninori Morimoto1-32/+24
snd_pcm_ops is no longer needed. Let's use component driver callback. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87muej90e4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-05ASoC: meson: axg-frddr: add sm1 supportJerome Brunet1-1/+1
On sm1, the output routing bits have moved to CTRL2 register Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20190905120120.31752-7-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-31ASoC: meson: axg-fifo: use devm_platform_ioremap_resource() to simplify codeYueHaibing1-3/+1
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190727150738.54764-31-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-05ASoC: meson: axg-fifo: add g12a supportJerome Brunet1-3/+31
The g12a fifos gained the ability to set the initial address of the pointer within the buffer, instead of defaulting to the buffer start address. It is not very useful to us (yet) but we need to put a copy the buffer start address in the related register for the fifo to work properly on the g12a SoC family Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-06ASoC: meson: Drop superfluous PCM preallocation error checksTakashi Iwai1-3/+4
snd_pcm_lib_preallocate_pages() and co always succeed, so the error check is simply redundant. Drop it. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-28ASoC: meson: axg-fifo: report interrupt request failureJerome Brunet1-0/+2
Return value of request_irq() was irgnored. Fix this and report the failure if any Fixes: 6dc4fa179fb8 ("ASoC: meson: add axg fifo base driver") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: meson: use IRQ_RETVAL in the fifo irq handlerJerome Brunet1-1/+1
Use IRQ_RETVAL instead of the open coded ternary operation. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-18ASoC: meson: add axg fifo base driverJerome Brunet1-0/+341
Amlogic's axg SoCs have two types of fifos which are the memory interfaces of the audio subsystem. FRDDR provides the playback interface while TODDR provides the capture interface. The way these fifos operate is very similar. Only a few settings are specific to each. They implement the same pcm driver here and the specifics of each will be dealt with the related DAI driver. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>