summaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra/tegra_alc5632.c
AgeCommit message (Collapse)AuthorFilesLines
2021-06-15ASoC: tegra: Unify ASoC machine driversDmitry Osipenko1-260/+0
Squash all machine drivers into a single-universal one. This reduces code duplication, eases addition of a new drivers and upgrades older code to a modern Linux kernel APIs. Suggested-by: Jonathan Hunter <jonathanh@nvidia.com> Co-developed-by: Ion Agorria <ion@agorria.com> Signed-off-by: Ion Agorria <ion@agorria.com> Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20210529154649.25936-3-digetx@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-15ASoC: tegra: Set driver_name=tegra for all machine driversDmitry Osipenko1-0/+1
The driver_name="tegra" is now required by the newer ALSA UCMs, otherwise Tegra UCMs don't match by the path/name. All Tegra machine drivers are specifying the card's name, but it has no effect if model name is specified in the device-tree since it overrides the card's name. We need to set the driver_name to "tegra" in order to get a usable lookup path for the updated ALSA UCMs. The new UCM lookup path has a form of driver_name/card_name. The old lookup paths that are based on driver module name continue to work as before. Note that UCM matching never worked for Tegra ASoC drivers if they were compiled as built-in, this is fixed by supporting the new naming scheme. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20210529154649.25936-2-digetx@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-11ASoC: tegra: Don't warn on probe deferralJon Hunter1-2/+2
Deferred probe is an expected return value for snd_soc_register_card(). Given that the driver deals with it properly, there's no need to output a warning that may potentially confuse users. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20201111103245.152189-1-jonathanh@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-23ASoC: tegra: use asoc_substream_to_rtd()Kuninori Morimoto1-1/+1
Now we can use asoc_substream_to_rtd() macro, let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sgdn0yv1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-21ASoC: tegra: Use device managed resource APIs to get the clockSowjanya Komatineni1-6/+1
tegra_asoc_utils uses clk_get() to get the clock and clk_put() to free them explicitly. This patch updates it to use device managed resource API devm_clk_get() so the clock will be automatically released and freed when the device is unbound and removes tegra_asoc_utils_fini() as its no longer needed. Tested-by: Dmitry Osipenko <digetx@gmail.com> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Reviewed-by: Sameer Pujar <spujar@nvidia.com> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2020-03-27ASoC: tegra: 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/877dzbir3w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-28ASoC: tegra: tegra_alc5632: consider CPU-Platform possibilityKuninori Morimoto1-1/+6
commit e7fc99e641da ("ASoC: tegra: tegra_alc5632: don't select unnecessary Platform") Current ALSA SoC avoid to add duplicate component to rtd, and this driver was selecting CPU component as Platform component. Thus, above patch removed Platform settings from this driver, because it assumed these are same component. But, some CPU driver is using generic DMAEngine, in such case, both CPU component and Platform component will have same of_node/name. In other words, there are some components which are different but have same of_node/name. In such case, Card driver definitely need to select Platform even though it is same as CPU. It is depends on CPU driver, but is difficult to know it from Card driver. This patch reverts above patch. Fixes: commit e7fc99e641da ("ASoC: tegra: tegra_alc5632: don't select unnecessary Platform") Signed-off-by: Kuninori Morimoto <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-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-06-19ASoC: tegra: tegra_alc5632: don't select unnecessary PlatformKuninori Morimoto1-6/+1
ALSA SoC is now supporting "no Platform". Sound card doesn't need to select "CPU component" as "Platform" anymore if it doesn't need special Platform. This patch removes such settings. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-06ASoC: tegra: tegra_alc5632: use modern dai_link styleKuninori Morimoto1-16/+21
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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-30ASoC: tegra_alc5632: fix device_node refcountingAlexey Khoroshilov1-2/+15
tegra_alc5632_probe() increments reference count of device nodes with of_parse_phandle(), but there is no code decrementing them in the driver. The patch adds of_node_put() to tegra_alc5632_remove() and to error handling paths in the probe. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-01Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5720', ↵Mark Brown1-1/+0
'asoc/topic/tegra', 'asoc/topic/tlv320aic32x4' and 'asoc/topic/tlv320aic3x' into asoc-next
2017-08-22ASoC: tegra: Remove superfluous snd_soc_jack_free_gpios() callTakashi Iwai1-13/+0
Since jack gpios are managed via devres, we don't have to call snd_jack_free_gpios() at release any longer. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21ASoC: tegra: Remove unnecessary function callDonglin Peng1-1/+0
First of all,the address of pdev->dev is assigned to card->dev,then the function platform_set_drvdata copies the value the variable card to pdev->dev.driver_data, but when calling snd_soc_register_card,the function dev_set_drvdata(card->dev, card) will also do the same copy operation,so i think that the former copy operation can be removed. Signed-off-by: Peng Donglin <dolinux.peng@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-07ASoC: tegra: Remove unnecessary 'out of memory' messageCodrut Grosu1-3/+1
This was reported by checkpatch.pl Signed-off-by: Codrut GROSU <codrut.cristian.grosu@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24ASoC: tegra: constify snd_soc_ops structuresJulia Lawall1-1/+1
Check for snd_soc_ops structures that are only stored in the ops field of a snd_soc_dai_link structure. This field is declared const, so snd_soc_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_soc_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_dai_link e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i, e; position p; @@ struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., }; @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_soc_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_soc_ops i = { ... }; // </smpl> The effect on the layout of the .o files is shown by the following output of the size command, first before then after the transformation: text data bss dec hex filename 3143 1888 384 5415 1527 sound/soc/tegra/tegra_alc5632.o 3191 1840 384 5415 1527 sound/soc/tegra/tegra_alc5632.o text data bss dec hex filename 3672 2176 768 6616 19d8 sound/soc/tegra/tegra_max98090.o 3720 2128 768 6616 19d8 sound/soc/tegra/tegra_max98090.o text data bss dec hex filename 2770 1856 384 5010 1392 sound/soc/tegra/tegra_rt5640.o 2818 1808 384 5010 1392 sound/soc/tegra/tegra_rt5640.o text data bss dec hex filename 4412 2176 768 7356 1cbc sound/soc/tegra/tegra_rt5677.o 4460 2128 768 7356 1cbc sound/soc/tegra/tegra_rt5677.o text data bss dec hex filename 2442 1536 0 3978 f8a sound/soc/tegra/tegra_sgtl5000.o 2490 1480 0 3970 f82 sound/soc/tegra/tegra_sgtl5000.o text data bss dec hex filename 2105 1536 0 3641 e39 sound/soc/tegra/tegra_wm8753.o 2153 1480 0 3633 e31 sound/soc/tegra/tegra_wm8753.o text data bss dec hex filename 3755 1888 768 6411 190b sound/soc/tegra/tegra_wm8903.o 3803 1840 768 6411 190b sound/soc/tegra/tegra_wm8903.o text data bss dec hex filename 2121 1536 0 3657 e49 sound/soc/tegra/trimslice.o 2169 1480 0 3649 e41 sound/soc/tegra/trimslice.o Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-01ASoC: tegra_alc5632: check return valueSudip Mukherjee1-4/+8
We have been returning success even if snd_soc_card_jack_new() fails. Lets check the return value and return error if it fails. Fixes: 12cc6d1dca4d ("ASoC: tegra_alc5632: Register jacks at the card level") Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-08ASoC: tegra_alc5632: Use card DAPM context to access widgetsLars-Peter Clausen1-4/+1
The dapm field of the snd_soc_codec struct will eventually be removed (replaced with the DAPM context from the component embedded inside the CODEC). Replace its usage with the card's DAPM context. The idea is that DAPM is hierarchical and with the card at the root it is possible to access widgets from other contexts through the card context. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-04ASoC: tegra_alc5632: Register jacks at the card levelLars-Peter Clausen1-5/+4
The jacks are card level elements so use snd_soc_card_jack_new() instead of snd_soc_jack_new() to register them. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20ASoC: tegra: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-07-22ASoC: tegra: Replace instances of rtd->codec->card with rtd->cardLars-Peter Clausen1-3/+2
No need to go via the CODEC to get a pointer to the card. This will help to eventually remove the card field from the snd_soc_codec struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26ASoC: tegra: free jack GPIOs before the sound card is freedStephen Warren1-3/+13
snd_soc_jack_add_gpios() schedules a work queue item to poll the GPIO to generate an initial jack status report. If sound card initialization fails, that work item needs to be cancelled, so it doesn't run after the card has been freed. Specifically, freeing the card calls snd_jack_dev_free() which calls snd_jack_dev_disconnect() which sets jack->input_dev = NULL, and input_dev is used by snd_jack_report(), which is called from the work queue item. snd_soc_jack_free_gpios() cancels the work item. The Tegra ASoC machine drivers do call this function in the platform driver remove() callback. However, this happens after the sound card is freed, at least when the card is freed due to errors late during snd_soc_instantiate_card(). This leaves a window where the work item can execute after the card is freed. In next-20140522, sound card initialization does fail for unrelated reasons, and hits the problem described above. To solve this, fix the Tegra ASoC machine drivers to clean up the Jack GPIOs during the snd_soc_card's .remove() callback, which is executed before the overall card object is freed. also, gGuard the cleanup call based on whether we actually setup up the GPIOs in the first place. Ideally, we'd do the cleanup in a struct snd_soc_dai_link .fini/remove function to match where the GPIOs get set up. However, there is no such callback. This change fixes all Tegra machine drivers. By code inspection, I believe some non-Tegra machine drivers have the same issue. I'll send a patch for that separately, once this is reviewed. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17ASoC: tegra: Remove unneeded mach-type.h inclduesMark Brown1-2/+0
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2013-03-04ASoC: tegra_alc5632: assume CONFIG_OF, and other cleanupStephen Warren1-11/+4
Tegra only supports, and always enables, device tree. Remove all runtime checks for DT support from the driver. Also, various minor cleanups so that the probe() body more closely resembles other drivers, for easier comparison. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10ASoC: tegra: 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-20ASoC: remove use of __devinitconstBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinitconst is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-28sound: tegra_alc5632: remove HP detect GPIO inversionStephen Warren1-1/+0
Both the schematics and practical testing show that the HP detect GPIO is high when the headphones are plugged in. Hence, the snd_soc_jack_gpio should not specify to invert the signal. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Andrey Danin <danindrey@mail.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: <stable@vger.kernel.org> # v3.4 v3.5
2012-07-26sound: tegra_alc5632: Adjust to of_get_named_gpio() changeRoland Stigge1-1/+1
of_get_named_gpio() was changed to return -EPROBE_DEFER in case of gpios not probed yet. This patch adjusts tegra_alc5632 to this. Signed-off-by: Roland Stigge <stigge@antcom.de> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-08ASoC: tegra: remove usage of rtd->codecStephen Warren1-2/+3
rtd->codec_dai->codec can be used instead. This is a slight step along the way to not needing the rtd->codec field any more. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-03ASoC: make snd_soc_dai_link more symmetricalStephen Warren1-3/+3
Prior to this patch, the CPU side of a DAI link was specified using a single name. Often, this was the result of calling dev_name() on the device providing the DAI, but in the case of a CPU DAI driver that provided multiple DAIs, it needed to mix together both the device name and some device-relative name, in order to form a single globally unique name. However, the CODEC side of the DAI link was specified using separate fields for device (name or OF node) and device-relative DAI name. This patch allows the CPU side of a DAI link to be specified in the same way as the CODEC side, separating concepts of device and device-relative DAI name. I believe this will be important in multi-codec and/or dynamic PCM scenarios, where a single CPU driver provides multiple DAIs, while also booting using device tree, with accompanying desire not to hard-code the CPU side device's name into the original .cpu_dai_name field. Ideally, both the CPU DAI and CODEC DAI loops in soc_bind_dai_link() would now be identical. However, two things prevent that at present: 1) The need to save rtd->codec for the CODEC side, which means we have to search for the CODEC explicitly, and not just the CODEC side DAI. 2) Since we know the CODEC side DAI is part of a codec, and not just a standalone DAI, it's slightly more efficient to convert .codec_name/ .codec_of_node into a codec first, and then compare each DAI's .codec field, since this avoids strcmp() on each DAI's CODEC's name within the loop. However, the two loops are essentially semantically equivalent. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-03ASoC: tegra+alc5632: unconditionally free jack GPIOs in removeStephen Warren1-9/+2
The headphone jack GPIOs are added/initialized in the DAI link's init() method, and hence in theory may not always have been added before remove() is called in some unusual cases. In order to prevent calling snd_soc_jack_free_gpios() if snd_soc_jack_add_gpios() had not been, the code kept track of the initialization state to avoid the free call when necessary. However, it appears that snd_soc_jack_free_gpios() is robust in the face of being called without snd_soc_jack_add_gpios() first succeeding, so there is little point manually tracking this information. Hence, remove the tracking code. All other machine drivers already operate this way. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-03ASoC: tegra+alc5632: move all GPIO setup into probeStephen Warren1-4/+6
Now that deferred probe exists, we can parse device tree and request GPIOs from probe(), rather than deferring this to the DAI link's init(). Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: tegra: remove unnecessary includesStephen Warren1-3/+0
These include aren't needed, and some of the files are about to be renamed. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: tegra: register 'platform' from DAIs, get rid of pdevStephen Warren1-18/+3
Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a platform_device. This didn't represent the hardware well, since there was no separate hardware associated with this platform_device; it was a virtual device with sole purpose to call snd_soc_register_platform(). This mechanism required all board files to register this device, and all ASoC machine drivers to create and register this device when booting using device tree. This change removes the platform_device completely. Each Tegra DAI now registers the ASoC 'platform' itself. Machine drivers are adjusted for the new 'platform' name. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: tegra: fix comment indentation in ALC5632 machineStephen Warren1-12/+12
Fix comment indentation to clear checkpatch errors in a later patch. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-06ASoC: tegra: Remove unused variableStephen Warren1-1/+0
Fixes the following warning: sound/soc/tegra/tegra_alc5632.c: In function 'tegra_alc5632_asoc_init': sound/soc/tegra/tegra_alc5632.c:118:6: warning: unused variable 'ret' [-Wunused-variable] Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-13ASoC: tegra+alc5632: Added digital microphone DAPM widget.Leon Romanovsky1-0/+1
ALC5632 codec supports digital microphone. This patch adds DAPM widget. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-02ASoC: tegra: Remove unused DAPM route structure.Leon Romanovsky1-16/+0
All DAPM routes are configured via device tree, and there is no need in DAPM route structures in board file. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-02ASoC: Tegra+ALC5632: Enable headset autodetection on PAZ00 board.Leon Romanovsky1-4/+35
This patch is adding device tree support of headset autodetection on PAZ00 board. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-31ASoC: Tegra+ALC5632: Implement device tree support in board fileLeon Romanovsky1-9/+69
This patch implements device tree support for Tegra boards with ALC5632 codec. Signed-off-by: Leon Romanovsky <leon@leon.nu> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-22ASoC: tegra: Add .owner to struct snd_soc_cardAxel Lin1-0/+1
Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20ASoC: Tegra machine ASoC driver for boards using ALC5332 codecLeon Romanovsky1-0/+213
At this stage only Toshiba AC100/Dynabook supported. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>