summaryrefslogtreecommitdiffstats
path: root/sound/soc/stm/stm32_i2s.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: Switch back to struct platform_driver::remove()Uwe Kleine-König2024-09-091-1/+1
| | | | | | | | | | | | | | | After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers. Convert all drivers below sound/soc to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240909151230.909818-2-u.kleine-koenig@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: use snd_pcm_direction_name()Kuninori Morimoto2024-08-011-2/+2
| | | | | | | | We already have snd_pcm_direction_name(). Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87o76fk51p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Use device_get_match_data()Rob Herring2023-10-091-5/+2
| | | | | | | | | | Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-5-13a4f0f7fee6@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: merge DAI call back functions into opsKuninori Morimoto2023-08-141-1/+1
| | | | | | | | | ALSA SoC merges DAI call backs into .ops. This patch merge these into one. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87edkdb0tq.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: stm32_i2s: Convert to platform remove callback returning voidUwe Kleine-König2023-03-201-4/+2
| | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Link: https://lore.kernel.org/r/20230315150745.67084-138-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Use of_property_present() for testing DT property presenceRob Herring2023-03-111-1/+1
| | | | | | | | | | | | | It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144732.1546328-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: remove irqf_oneshot flagOlivier Moysan2022-11-101-1/+1
| | | | | | | | | | | | | | | | The IRQF_ONESHOT flag allows to ensure that the interrupt is not unmasked after the hard interrupt context handler has been executed and the thread has been woken. The interrupt line is unmasked after the thread handler function has been executed. The STM32 I2S driver does not implement a threaded IRQ handler. So, the IRQF_ONESHOT flag is not useful in I2S driver. Remove this flag to allow the interrupt routine to be managed as a thread in RT mode. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20221110084406.287117-1-olivier.moysan@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probeZhang Qilong2022-09-271-2/+2
| | | | | | | | | | | | | | The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of stm32_i2s_probe. Fixes:32a956a1fadf ("ASoC: stm32: i2s: add pm_runtime support") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20220927142640.64647-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: Migrate to new style legacy DAI naming flagCharles Keepax2022-06-271-0/+1
| | | | | | | | | | | Change the legacy DAI naming flag from opting in to the new scheme (non_legacy_dai_naming), to opting out of it (legacy_dai_naming). These drivers appear to be on the CPU side of the DAI link and currently uses the legacy naming, so add the new flag. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220623125250.2355471-9-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: Rename set_fmt_new back to set_fmtCharles Keepax2022-06-061-1/+1
| | | | | | | | | | Now the core has been migrated across to the new direct clock specification we can move the drivers back to the normal set_fmt callback. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-49-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: Update to use set_fmt_new callbackCharles Keepax2022-06-061-5/+5
| | | | | | | | | | As part of updating the core to directly tell drivers if they are clock provider or consumer update these CPU side drivers to use the new direct callback. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-22-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm: Use dev_err_probe() helperKuninori Morimoto2021-12-201-41/+21
| | | | | | | | | 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-22-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'for-5.16' of ↵Mark Brown2021-12-011-1/+1
|\ | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.17 so we can apply new Tegra work
| * ASoC: stm32: i2s: fix 32 bits channel length without mclkOlivier Moysan2021-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Fix divider calculation in the case of 32 bits channel configuration, when no master clock is used. Fixes: e4e6ec7b127c ("ASoC: stm32: Add I2S driver") Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20211117104404.3832-1-olivier.moysan@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: stm32: i2s: add pm_runtime supportOlivier Moysan2021-11-221-0/+4
|/ | | | | | | | | Enable support of pm_runtime on STM32 I2S driver to allow I2S power state monitoring. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20211119104752.13564-2-olivier.moysan@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: Use devm_platform_get_and_ioremap_resource()Yang Yingliang2021-06-171-2/+1
| | | | | | | | | Use devm_platform_get_and_ioremap_resource() to simplify code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210617043847.1113092-2-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: add master clock providerOlivier Moysan2021-02-051-44/+266
| | | | | | | | | Add master clock generation support in STM32 I2S driver. The master clock provided by I2S can be used to feed a codec. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20210205104404.18786-3-olivier.moysan@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: manage rebind issueOlivier Moysan2020-03-181-11/+29
| | | | | | | | | | | | | | | | The commit e894efef9ac7 ("ASoC: core: add support to card rebind") allows to rebind the sound card after a rebind of one of its component. With this commit, the sound card is actually rebound, but may be no more functional. Corrections: - Call snd_dmaengine_pcm_register() before snd_soc_register_component(). - Call snd_dmaengine_pcm_unregister() and snd_soc_unregister_component() explicitly from I2S driver. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Link: https://lore.kernel.org/r/20200318144125.9163-4-olivier.moysan@st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: improve error management on probe deferralOlivier Moysan2020-02-111-6/+19
| | | | | | | | | Do not print an error trace when deferring probe for I2S driver. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Link: https://lore.kernel.org/r/20200203100814.22944-7-olivier.moysan@st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: manage error when getting reset controllerOlivier Moysan2020-02-111-5/+9
| | | | | | | | | | Return an error when the i2s driver fails to get a reset controller. Also add an error trace, except on probe defer status. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Link: https://lore.kernel.org/r/20200203100814.22944-4-olivier.moysan@st.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-021-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-50-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'v5.2-rc6' into asoc-5.3Mark Brown2019-06-261-11/+1
|\ | | | | | | Linux 5.2-rc6
| * treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner2019-05-301-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that 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 655 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Merge tag 'v5.2-rc1' into asoc-5.3Mark Brown2019-05-201-1/+2
|\| | | | | | | Linux 5.2-rc1
| * ASoC: stm32: i2s: update pcm hardware constraintsOlivier Moysan2019-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | - Set period minimum size. Ensure at least 5ms period up to 48kHz/16 bits to prevent underrun/overrun. - Remove MDMA constraints on period maximum size and set period maximum to half the buffer maximum size. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: stm32: i2s: manage identification registersOlivier Moysan2019-05-081-3/+57
|/ | | | | | | Add support of identification registers in STM32 I2S. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'asoc-5.1' into asoc-5.2Mark Brown2019-04-261-2/+3
|\
| * ASoC: stm32: i2s: return the get_irq errorFabien Dessenne2019-04-251-2/+3
| | | | | | | | | | | | | | | | During probe, return the "get_irq" error value instead of -ENOENT. This allows the driver to be deferred probed if needed. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge branch 'for-5.1' of ↵Mark Brown2019-03-181-2/+1
|\| | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.2
| * ASoC: stm32: i2s: fix registers declaration in regmapOlivier Moysan2019-03-111-2/+1
| | | | | | | | | | | | | | | | | | - Declare SR as volatile, as it is changed by hardware. - Remove TXDR from readable and volatile register list, as it is intended for write accesses only. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: stm32: i2s: use default dai nameOlivier Moysan2019-03-111-7/+0
| | | | | | | | | | | | | | Use default DAI name based on dev_name function. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: stm32: i2s: improve channel capabilities handlingOlivier Moysan2019-03-111-6/+4
| | | | | | | | | | | | | | | | | | Use alsa snd_pcm_hw_constraint_single service to manage channels restriction. This provides better status on driver limitations, to the application. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: stm32: i2s: change trigger tracesOlivier Moysan2019-03-111-3/+5
|/ | | | | | | Update traces to log capture/playback stream start/stop. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: skip useless write in slave modeOlivier Moysan2019-02-261-2/+2
| | | | | | | | | Dummy write in capture master mode is used to gate bus clocks. This write is useless in slave mode as the clocks are not managed by slave. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: fix race condition in irq handlerOlivier Moysan2019-02-261-3/+14
| | | | | | | | | When snd_pcm_stop_xrun() is called in interrupt routine, substream context may have already been released. Add protection on substream context. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: remove useless callbackOlivier Moysan2019-02-261-11/+0
| | | | | | | | | Clocks do not need to be released on driver removal, as this is already managed before. Remove useless remove callback. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: fix dma configurationOlivier Moysan2019-02-261-7/+7
| | | | | | | | DMA configuration is not balanced on start/stop. Move DMA configuration to trigger callback. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: fix stream count managementOlivier Moysan2019-02-261-7/+5
| | | | | | | | Move counter handling to trigger start section to manage multiple start/stop events. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: fix 16 bit format supportOlivier Moysan2019-02-261-1/+1
| | | | | | | | | I2S supports 16 bits data in 32 channel length. However the expected driver behavior, is to set channel length to 16 bits when data format is 16 bits. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: fix IRQ clearingOlivier Moysan2019-02-261-7/+6
| | | | | | | | | | Because of regmap cache, interrupts may not be cleared as expected. Declare IFCR register as write only and make writings to IFCR register unconditional. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* SoC: stm32: i2s: manage clock powerOlivier Moysan2019-02-081-29/+15
| | | | | | | | | | | Kernel clock management: Enable/disable I2S kernel clock on audio stream startup/shutdown. Peripheral clock management: Manage I2S peripheral clock power through regmap services. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: i2s: add power managementOlivier Moysan2019-02-081-3/+30
| | | | | | | | Add suspend and resume sleep callbacks, to support system low power modes. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: explicitly request exclusive reset controlPhilipp Zabel2017-07-191-1/+1
| | | | | | | | | | | | | | | | | | Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting reset lines") started to transition the reset control request API calls to explicitly state whether the driver needs exclusive or shared reset control behavior. Convert all drivers requesting exclusive resets to the explicit API call so the temporary transition helpers can be removed. No functional changes. Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: alsa-devel@alsa-project.org Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: Add full duplex support to i2solivier moysan2017-05-191-41/+46
| | | | | | | | | | | This patch allows to use i2s interface either as single audio path (rx or tx), or bidirectional audio path. This patch is added separately, as the driver does not follow recommended use of the interface, to support this configuration. Signed-off-by: olivier moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: stm32: Add I2S driverolivier moysan2017-05-191-0/+941
Add I2S ASoC driver for STM32. This version of the driver supports only exclusive playback and capture interface. Signed-off-by: olivier moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>