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>
Define the DAI format statically in the dai_link, rather than executing
code to set it each time the hw params are set.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This is certainly required if the I2S and SPDIF controllers are converted
to be CODECs, and is probably good practice irrespective.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
In kernel 3.6, Seaboard will only be supported when booting using device
tree; the board files are being removed. Hence, remove the non-DT support
for Seaboard and derivatives Kaen and Aebl from the audio driver.
Harmony is the only remaining board supported by this driver when not
using DT. This support is currently scheduled for removal in 3.7.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
By the time any widget callbacks could be called, if the GPIO ID they
will manipulate is valid, it must have already been requested, or the
card would have failed to probe or initialize. So, testing for GPIO
validity is equivalent to testing whether the GPIO was successfully
requested at this point in the code. Making this change will allow later
patches to remove the gpio_requested variable.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
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>
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. Almost 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>
By using this function, the driver no longer needs to explicitly free
the GPIOs. Hence, we can also remove the flags we use to track whether
we allocated these GPIOs.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
This binding doesn't include the nvidia,model or nvidia,audio-routing
properties the other Tegra audio DT bindings have, because this binding
is targetted at a single machine, rather than for any machine using the
tlv320aic23 codec.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
All Tegra ASoC drivers will be reworked to use MMIO regmaps. Select
this in Kconfig.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This adds Kconfig options for the Tegra30 AHUB and I2S controller, and
updates the Tegra+WM8903 machine driver Kconfig to select those.
Includes a squashed bugfix from Sumit Bhattacharya <sumitb@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This provides an ASoC DAI interface for Tegra 30's I2S controller.
Includes a squashed bugfix from Sumit Bhattacharya <sumitb@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The AHUB (Audio Hub) is a mux/crossbar which links all audio-related
devices except the HDA controller on Tegra30. The devices include the
DMA FIFOs, DAM (Digital Audio Mixers), I2S controllers, and SPDIF
controller. Audio data may be routed between these devices in various
combinations as required by board design/application.
Includes a squashed bugfix from Nikesh Oswal <noswal@nvidia.com>
Includes squashed bugfixes from Sumit Bhattacharya <sumitb@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Recent list discussions concluded that drivers should not be calling
of_have_populated_dt(), and hence of_have_populated_dt() should not be
exported. Use a different mechanism to detect DT vs. non-DT boot.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tegra30 has some additional clocks that need to be manipulated, names
some clocks differently, runs PLLs at different base rates, etc. The
utility code needs to handle this.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Initialize the audio clock tree appropriately for some reasonable rate.
This makes sure the PLLs etc. are actually programmed to something
reasonable when the audio driver is loaded.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The devm_ APIs remove the need to manually clean up allocations,
thus removing some code.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Rename Tegra20-specific Kconfig variables, module filenames, all internal
symbol names, clocks, and platform devices, to reflect the fact the DAS
and I2S drivers are for a specific HW version.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Rename these files so they include a specific hardware version in their
filenames. The contents is only touched minimally so that git's rename
tracking operates correctly; renaming all symbols in the files results
in a diff so large that the rename detection fails.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Without this, the Tegra20 drivers can be built into a kernel that's
built only for Tegra30.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The DAS, I2S, and SPDIF Kconfig options are intended to be selected by
the Kconfig options for ASoC machine drivers. As such, they don't need
to be user-visible themselves. Drop the description from the DAS variable
to achieve this. I2S and SPDIF already don't have a description.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
clk_enable/disable() already reference count the enable calls, so there's
no need for the callers to do the same.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The DAS, I2S, and SPDIF drivers are Tegra20-specific. Group these
together so that when Tegra30-specific equivalents are added later, the
file ordering makes sense.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This is mainly for symmetry with a future Tegra30 driver, where the
equivalent of the DAS (the AHUB) is useful separately from the I2S driver.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ERROR: trailing whitespace
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
ERROR: "foo * bar" should be "foo *bar"
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Indent with TABs to be consistent with the rest of the file.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
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>
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>
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>
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>
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>
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>
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>
This is a follow up on 53dea36c70 which fixes the other affected
pcm engines.
Description from 53dea36c70:
Don't rely on the codec's channels_min information to decide wheter or
not allocate a substream's DMA buffer. Rather check if the substream
itself was allocated previously.
Without this patch I was seeing null-pointer dereferenc in atmel-pcm.
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
This driver is parameterized in two ways:
a) Platform data, which supplies the set of GPIOs used by the driver.
These GPIOs can now be parsed out of device tree.
b) Machine-specific DAPM route arrays embedded into the ASoC machine
driver itself. Historically, the driver picks the appropriate array
to use using machine_is_*(). The driver now requires this array to
be parsed from device tree when instantiated through device tree,
using the core ASoC support for this parsing.
Based on work by John Bonesio, but significantly reworked since then.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
Move DAS routing setup into the DAS driver itself. This removes the need
to duplicate this in each machine driver, of which we'll soon have three.
An added advantage is that the machine drivers no longer call the Tegra20-
specific DAS functions by name, so the machine driver no longer needs to
be split up into Tegra20 and Tegra30 versions.
If individual machine drivers need a different routing setup to this
default, they can still call the DAS functions to set that up.
Long-term, DAS will be a codec driver, and user-space will be able to
control its routing, possibly within constraints that the machine driver
sets up. Configuring the DAS routing from the DAS driver is a very slight
move in that direction.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>