summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rt5514-spi.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-11ASoC: rt5514-spi: Use managed buffer allocationTakashi Iwai1-6/+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: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20191210142614.19405-19-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-09ASoC: rt5514-spi: Convert to the common vmalloc memallocTakashi Iwai1-10/+11
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Since it requires the specific buffer type (SNDRV_DMA_TYPE_VMALLOC), it's set in the pcm_new ops now. Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20191108094641.20086-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-08ASoC: rt5514-spi: remove snd_pcm_opsKuninori Morimoto1-20/+21
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/87ftkb90df.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-26Merge tag 'v5.2-rc6' into asoc-5.3Mark Brown1-4/+1
Linux 5.2-rc6
2019-06-20ASoC: rt5514-spi: don't use snd_soc_lookup_component()Kuninori Morimoto1-3/+1
rt5514-spi can use dev_get_drvdata() to get its component because it is using snd_soc_component_set_drvdata(); static int rt5514_spi_pcm_probe(...) { ... => snd_soc_component_set_drvdata(component, ...); ... } We don't need to use snd_soc_lookup_component() for it. This patch uses dev_get_drvdata() instead of snd_soc_lookup_component(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 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>
2019-01-15ASoC: rt5514-spi: Fix potential NULL pointer dereferenceGustavo A. R. Silva1-0/+2
There is a potential NULL pointer dereference in case devm_kzalloc() fails and returns NULL. Fix this by adding a NULL check on rt5514_dsp. This issue was detected with the help of Coccinelle. Fixes: 6eebf35b0e4a ("ASoC: rt5514: add rt5514 SPI driver") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-21Merge branch 'asoc-4.19' into asoc-linusMark Brown1-6/+8
2018-09-17ASoC: rt5514-spi: Get the period_bytes in the copy work to make sure the ↵Oder Chiou1-6/+8
value correctly The value of period_bytes will get the zero before the hw_params() is not run completely. Move the function snd_pcm_lib_period_bytes() to copy work, and make sure that is not zero. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-18ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()Takashi Iwai1-1/+0
snd_pcm_lib_mmap_vmalloc() was supposed to be implemented with somewhat special for vmalloc handling, but in the end, this turned to just the default handler, i.e. NULL. As the situation has never changed over decades, let's rip it off. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-03-28Merge remote-tracking branches 'asoc/topic/rt298', 'asoc/topic/rt5514', ↵Mark Brown1-2/+2
'asoc/topic/rt5616', 'asoc/topic/rt5631' and 'asoc/topic/rt5640' into asoc-next
2018-02-12ASoC: rt5514-spi: replace platform to componentKuninori Morimoto1-18/+14
Now platform can be replaced to component, let's do it. This patch merges rt5514_spi_dai_component into rt5514_spi_component Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: rt5514: replace codec to componentKuninori Morimoto1-2/+2
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> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-05Merge remote-tracking branches 'asoc/topic/rl6231', 'asoc/topic/rt5514' and ↵Mark Brown1-0/+1
'asoc/topic/rt5645' into asoc-next
2017-12-19ASoC: rt5514-spi: only enable wakeup when fully initializedBrian Norris1-2/+2
If an rt5514-spi device is probed but the platform hasn't linked it in, we might never fully request the SPI IRQ, nor configure the rt5514 DSP, but we still might try to enable the SPI IRQ (enable_irq_wake()). This is bad, and among other things, can cause the interrupt to trigger every time we try to suspend the system (e.g., because the interrupt trigger setting was never set properly). Instead of setting our wakeup capabilities in the SPI driver probe routine, let's wait until we've actually requested the IRQ. Fixes issues seen on the "kevin" Chromebook (Samsung Chromebook Plus). Fixes: 58f1c07d23cd ("ASoC: rt5514: Voice wakeup support.") Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-27ASoC: rt5514: Add the sanity check for the driver_data in the resume functionoder_chiou@realtek.com1-4/+7
If the rt5514 spi driver is loaded, but the snd_soc_platform_driver is not loaded by the correct DAI settings, the NULL pointer will be gotten by snd_soc_platform_get_drvdata in the resume function. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-11ASoC: rt5514: mark PM functions as __maybe_unusedArnd Bergmann1-2/+2
The new functions are only used when CONFIG_PM is enabled, leading to a harmless warning: sound/soc/codecs/rt5514-spi.c:474:12: error: 'rt5514_resume' defined but not used [-Werror=unused-function] sound/soc/codecs/rt5514-spi.c:464:12: error: 'rt5514_suspend' defined but not used [-Werror=unused-function] This marks them as __maybe_unused to make the build silent again. Fixes: 58f1c07d23cd ("ASoC: rt5514: Voice wakeup support.") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-09ASoC: rt5514-spi: check irq status to schedule data copy in resume functionoder_chiou@realtek.com1-0/+10
For wake on voice use case, we need to copy data from DSP buffer to PCM stream when system wakes up by voice. However the edge triggered IRQ could be missed when system wakes up, in that case the irq function will not be called. If the substream was constructed beforce suspend, we will schedule data copy in resume function. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-09ASoC: rt5514: Voice wakeup support.oder_chiou@realtek.com1-0/+27
If the rt5514 Wake on Voice device is opened while suspended, it will be able to wake up the system when a voice command is detected. This patch also supports user-space policy to override wakeup behavior by /sys/bus/spi/drivers/rt5514/spi2.0/power/wakeup. Signed-off-by: Chinyue Chen <chinyue@chromium.org> Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-08ASoC: rt5514-spi: Let the buf_size to align with period_bytesOder Chiou1-0/+9
The patch lets the buf_size to align with period_bytes to prevent the buffer reading over the real size of the DSP buffer and also avoid to calculate the wrong size of remaining data. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-07ASoC: rt5514: The DSP clock can be calibrated by the other clock sourceoder_chiou@realtek.com1-0/+1
Add the option for the DSP clock that can be calibrated by the other clock source. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-13ASoC: rt5514-spi: check irq status to schedule data copyHsin-Yu Chao1-2/+15
For wake on voice use case, we need to copy data from DSP buffer to PCM stream when system wakes up by voice. However the edge triggered IRQ could be missed when system wakes up, in that case the irq function will not be called. Fix that by checking the irq status bit and schedule data copy accordingly. Signed-off-by: Hsin-Yu Chao <hychao@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-01Merge remote-tracking branches 'asoc/topic/rk3036', 'asoc/topic/rockchip', ↵Mark Brown1-66/+78
'asoc/topic/rt274' and 'asoc/topic/rt5514' into asoc-next
2017-08-14ASoC: codecs: make snd_soc_platform_driver constBhumika Goyal1-1/+1
Make these const as they are either passed as the 2nd argument to the function devm_snd_soc_register_platform or snd_soc_register_platform, and the arguments are of type const. Done using Coccinelle. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-07ASoC: rt5514: reset dma_offset at hw_paramsoder_chiou@realtek.com1-1/+1
dma_offset needs reset every time otherwise for consecutive PCM open the last dma_offset value will cause incorrect pointer position be reported to user space. Signed-off-by: Hsin-Yu Chao <hychao@chromium.org> Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-01ASoC: rt5514: Add the sanity checks of the buffer related addressoder_chiou@realtek.com1-1/+6
The patch add the sanity checks of the buffer related address to make sure the addresses are valid. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5514: Support the DSP recording continuously after the hotwording ↵oder_chiou@realtek.com1-66/+73
triggered The patch uses the IRQ to copy the PCM data to userspace continuously after the hotwording triggered from DSP. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15ASoC: rt5514-spi: Remove unneeded linux/miscdevice.h includeCorentin Labbe1-1/+0
sound/soc/codecs/rt5514-spi.c does not use any miscdevice so this patch remove this unnecessary inclusion. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-16ASoC: rt5514: Remove superfluous linux/kthread.h inclusionTakashi Iwai1-1/+0
It's nowhere used in this driver code. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12ASoC: constify snd_pcm_ops structuresJulia Lawall1-1/+1
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. 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_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-14ASoC: rt5514-spi: Convert to use devm_* APIAxel Lin1-19/+6
Use devm_* API to simplify the code. This patch also fixes the return value in probe error paths. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-22ASoC: rt5514: Fix the issue that the variable dereferenced before checkingOder Chiou1-1/+2
The patch fixes the issue that variable dereferenced before checking 'rt5514_dsp->substream'. Move the assignment to after the variable checking of 'rt5514_dsp->substream'. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-07ASoC: rt5514: add rt5514 SPI driverOder Chiou1-0/+459
The device has multiple control interfaces, I2C and SPI. The I2C interface mainly controls the register settings of codec. The SPI interface is in order to provide the high speed transmission of data. For example, high bandwidth memory read/write of DSP. The patch adds the rt5514 SPI driver for loading the firmware of DSP and retrieving the voice data from DSP after the system is waked up by specific voice. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>