summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm0010.c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-27ASoC: wm*: Remove now redundant non_legacy_dai_naming flagCharles Keepax1-1/+0
The ASoC core has now been changed to default to the non-legacy DAI naming, as such drivers using the new scheme no longer need to specify the non_legacy_dai_naming flag. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220623125250.2355471-66-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-09spi: make remove callback a void functionUwe Kleine-König1-3/+1
The value returned by an spi driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Claudius Heine <ch@denx.de> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Łukasz Stelmach <l.stelmach@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18ASoC: codecs: wm0010: use DECLARE_COMPLETION_ONSTACK() macroPierre-Louis Bossart1-2/+1
Follow recommendation in Documentation/scheduler/completion.rst and use macro to declare local 'struct completion' Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20200813175442.59067-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-15ASoC: wm0010: Use kmemdup rather than duplicating its implementationFuqian Huang1-3/+1
kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20190703163224.1029-1-huangfq.daxian@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-12ASoC: wm0010: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertenly introduced[3] to the codebase from now on. This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20200211200549.GA12072@embeddedor Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-4/+1
Based on 2 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 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 # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-12ASoC: wm0010: replace codec to componentKuninori Morimoto1-92/+89
Now we can replace Codec to Component. Let's do it. Note: 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> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-27ASoC: wm0010: Delete an error message for a failed memory allocation in ↵Markus Elfring1-4/+1
wm0010_boot() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15ASoC: wm0010: Remove unneeded linux/miscdevice.h includeCorentin Labbe1-1/+0
sound/soc/codecs/wm0010.c does not use any miscdevice so this patch remove this unnecessary inclusion. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Acked-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01ASoC: constify snd_soc_codec_driver structuresJulia Lawall1-1/+1
Check for snd_soc_codec_driver structures that are only passed to snd_soc_register_codec or memcpy (2nd arg), for which the corresponding parameters are declared const. Declare as const snd_soc_codec_driver structures that have these properties. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_soc_codec_driver i@p = { ... }; @ok@ identifier r.i; expression e1,e2,e3; position p; @@ ( snd_soc_register_codec(e1,&i@p,e2,e3) | memcpy(e1,&i@p,e2) ) @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_soc_codec_driver i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on wm0010Kuninori Morimoto1-4/+6
codec driver and component driver has duplicated callback functions, and codec side functions are just copied to component side when register timing. This was quick-hack, but no longer needed. This patch moves these functions from codec driver to component driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-04Merge remote-tracking branches 'spi/topic/omap-100k', ↵Mark Brown1-1/+0
'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next
2015-10-28spi: Drop owner assignment from spi_driversAndrew F. Davis1-1/+0
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-23Merge remote-tracking branches 'asoc/fix/mtk', 'asoc/fix/psc', ↵Mark Brown1-14/+9
'asoc/fix/pxa', 'asoc/fix/spear', 'asoc/fix/sti' and 'asoc/fix/wm0010' into asoc-linus
2015-09-19ASoC: wm0010: fix error pathSudip Mukherjee1-12/+10
Fix the error path so that we can free the allocated memory on the error path instead of releasing them individually on each error. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-19ASoC: wm0010: fix memory leakSudip Mukherjee1-9/+0
We have requested for the firmware but we have missed releasing it both on success and on error path. While checking the code it turned out that the requested firmware is not even used. More over the same firmware is being loaded by wm0010_stage2_load(). Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-01ASoC: wm0010: fix memory leakSudip Mukherjee1-1/+7
We were aborting if the kzalloc of img_swap fails but without freeing the already allocated out. Similarly we were aborting if spi_sync fails without releasing out and img_swap. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08ASoC: wm0010: Remove spurious missing IRQF_ONESHOTAxel Lin1-1/+1
This reverts 58d468328646 ("ASoC: wm0010: Add missing IRQF_ONESHOT"). The coccinelle warnings is false positive because the original code does set IRQF_ONESHOT by "trigger |= IRQF_ONESHOT;". Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-06ASoC: wm0010: Remove redundant spi driver bus initializationAntonio Borneo1-1/+0
In ancient times it was necessary to manually initialize the bus field of an spi_driver to spi_bus_type. These days this is done in spi_register_driver(), so we can drop the manual assignment. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-01ASoC: wm0010: Replace direct snd_soc_codec dapm field accessLars-Peter Clausen1-2/+2
The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm.bias_level with snd_soc_codec_get_bias_level(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: Move bias level update to the coreLars-Peter Clausen1-2/+0
All drivers have the same line at the end of the set_bias_level callback to update the bias_level state. Move this update into snd_soc_dapm_force_bias_level() and remove them from the drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-04Merge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/width', ↵Mark Brown1-1/+1
'asoc/topic/wm0010', 'asoc/topic/wm8904' and 'asoc/topic/wm8962' into asoc-next
2014-06-27ASoC: wm0010.c: add static to local variableFabian Frederick1-1/+1
Also add const to array text data bss dec hex filename 10946 2904 3528 17378 43e2 sound/soc/codecs/wm0010.o-before 10891 2840 3512 17243 435b sound/soc/codecs/wm0010.o-after Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-27ASoC: wm0010: Remove redundant OOM messageSachin Kamat1-11/+1
Let memory subsystem handle the error logging. Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-08Merge remote-tracking branch 'asoc/topic/wm0010' into asoc-nextMark Brown1-4/+4
2013-11-06ASoC: wm0010: Use WARN_ON() instead of BUG_ON()Takashi Iwai1-1/+2
Use WARN_ON() and handle the error cases accordingly. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-30ASoC: wm0010: Fix possible out-of-bounds array readTakashi Iwai1-4/+4
Spotted by coverity CID 744701. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-01ASoC: wm0010: Use DMA-safe memory for SPI transfersDimitris Papastamos1-6/+6
We should be allocating our buffers for the SPI transfers from the DMA zone. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-31ASoC: wm0010: Fix resource leakDimitris Papastamos1-12/+12
If kzalloc() fails for `img' then we are going to leak the memory for `out'. We are freeing the memory of all the tx/rx transfers but the tx/rx buf pointers will be NULL if we drop out earlier. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-03ASoC: wm0010: Clear IRQ as wake source and include missing headerCharles Keepax1-0/+3
Both clear the IRQ as being a wake source when we are finished with it and include a missing header file that is required. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-05-30ASoC: wm0010: Set IRQ as a wake sourceCharles Keepax1-0/+7
The DSPs IRQ should be a wake source as several of the possible algorithms may run whilst the AP is asleepi and require to wake the AP to push or pull more data, such as compressed playback. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-14Merge remote-tracking branch 'asoc/fix/wm0010' into asoc-linusMark Brown1-0/+1
2013-05-07ASoC: wm0010: fix error return code in wm0010_boot()Wei Yongjun1-0/+1
Fix to return -ENOMEM in the memory malloc of 'out' and 'img_swap' error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29ASoC: wm0010: Report filename when we fail to load firmwareCharles Keepax1-2/+2
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29ASoC: wm0010: Constify usage of firmware filenamesCharles Keepax1-1/+1
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10ASoC: codecs: remove __dev* attributesBill Pemberton1-3/+3
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27ASoC: wm0010: Ignore interrupts in power down modeMark Brown1-1/+0
The device should not be generating interrupts when it does not have power so ignore incoming interrupts. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-23ASoC: wm0010: Add checking for .dfw info record version.Scott Ling1-1/+24
The info record at the start of the dsp firmware file has been expanded to incorporate additional version information. We need to check the version to make sure we understand the layout of the information in the record. The srec2image tool is currently used to create this record during creation of the .dfw file. Signed-off-by: Scott Ling <sl@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-21ASoC: wm0010: Up the completion timeout to 20ms instead of 10msDimitris Papastamos1-2/+2
Increase timeout to be more reliable and avoid the chance of missing interrupts during boot. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-09ASoC: wm0010: Split out the stage2 load from the boot functionScott Ling1-50/+79
Signed-off-by: Scott Ling <sl@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-09ASoC: wm0010: Split out the firmware file parsing from the bootScott Ling1-117/+146
Move the firmware load and record parsing functionality out into a separate function from the boot function. Signed-off-by: Scott Ling <sl@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-06ASoC: wm0010: Remove boot_done variable as no longer required.Scott Ling1-4/+1
Remove the boot_done counter variable and check the wm0010 state variable instead. Signed-off-by: Scott Ling <scott.ling@wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-26ASoC: wm0010: Initialise chip state before we register the interruptMark Brown1-5/+2
The interrupt handler uses the chip state. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-26ASoC: wm0010: Don't check if reset GPIO is defined when removingMark Brown1-5/+2
We will fail to probe without one. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-26ASoC: wm0010: Allow slow GPIO for resetMark Brown1-3/+5
We never set the GPIO from atomic context so there's no reason why we can't support a GPIO that needs to sleep when configuring. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06ASoC: wm0010: Fix warning, use format %zu for type size_tEmil Goode1-1/+1
Fix warning by using format specifier %zu for type size_t Sparse warning: sound/soc/codecs/wm0010.c:411:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat] Signed-off-by: Emil Goode <emilgoode@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06ASoC: wm0010: unlock on error pathDan Carpenter1-0/+2
We're holding the wm0010->lock mutex when we goto err_core. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06ASoC: wm0010: Add missing IRQF_ONESHOTFengguang Wu1-1/+1
FYI, there are new coccinelle warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-3.7 head: e3523e01869da20fdd12ffd19ae1df7bf492650e commit: e3523e01869da20fdd12ffd19ae1df7bf492650e [95/95] ASoC: wm0010: Add initial wm0010 DSP driver All coccinelle warnings: + sound/soc/codecs/wm0010.c:850:7-27: ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT -- + sound/soc/codecs/wm0010.c:660:1-7: preceding lock on line 359 vim +850 sound/soc/codecs/wm0010.c 847 trigger = IRQF_TRIGGER_FALLING; 848 trigger |= IRQF_ONESHOT; 849 > 850 ret = request_threaded_irq(irq, NULL, wm0010_irq, trigger, 851 "wm0010", wm0010); 852 if (ret) 853 dev_err(wm0010->dev, "Failed to request IRQ %d: %d\n", Please consider folding the attached diff :-) Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-25ASoC: wm0010: Move resource acquisition to device probeMark Brown1-27/+27
This is more idimatic for modern drivers. Also fix a couple of return codes while we're at it. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-25ASoC: wm0010: Tweak diagnostic outputMark Brown1-1/+1
Make it scan better by writing ROM with capitals. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>