Board file support for Ventana is not yet mainlined, and probably won't
ever be given the move to Device-Tree. Consequently, the Ventana entry
is being removed from arch/arm/tools/mach-types in the next merge window,
since it was registered over a year ago.
This will also remove function machine_is_ventana(), which is used by
the ASoC Tegra WM8903 machine driver. This will cause compilation
failures. Drop Ventana support to resolve this.
Hopefully, in the not-too-distant future, tegra_wm8903.c will be able to
configure itself from Device-Tree, and hence we'll be able to re-instate
Ventana support just by creating a .dts file for the board.
Also note that Aebl support is in a similar boat. However, that board
isn't scheduled for deprecation for at least another 5 months, and
perhaps we will have completely removed non-Device-Tree support from
tegra_wm8903.c by then and/or adjusted mach-types policy.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Two issues were preventing module snd-soc-tegra-wm8903.ko from being
removed and re-inserted:
a) The speaker-enable GPIO is hosted by the WM8903 chip. This GPIO must
be freed before snd_soc_unregister_card() is called, because that
triggers wm8903.c:wm8903_remove(), which calls gpiochip_remove(), which
then fails if any of the GPIOs are in use. To solve this, free all GPIOs
first, so the code doesn't care where they come from.
b) We need to call snd_soc_jack_free_gpios() to match the call to
snd_soc_jack_add_gpios() during initialization. Without this, the
call to snd_soc_jack_add_gpios() fails during any subsequent modprobe
and initialization, since the GPIO and IRQ are already registered. In
turn, this causes the headphone state not to be monitored, so the
headphone is assumed not to be plugged in, and the audio path to it is
never enabled.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Cc: stable@kernel.org
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Not all PCM devices have all sub-streams. Specifically, the SPDIF driver
only supports playback and hence has no capture substream. Check whether
a substream exists before dereferencing it, when de-allocating DMA
buffers in tegra_pcm_deallocate_dma_buffer.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
This is a minimal driver for the Tegra SPDIF controller.
In hardware, the SPDIF output signal is always routed to any active HDMI
display controllers, and may also be routed to external pins on Tegra
using the pinmux.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The clock needed by the I2S driver is associated with the I2S device name
in the standard fashion. Hence, use clk_get(dev) instead of clk_get_sys(clk_name).
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The I2S controller needs a clock to respond to register writes. Without
this, register writes will at worst hang the CPU. In practice, I've only
observed writes being dropped.
Luckily, the dropped register writes historically had no effect:
TEGRA_I2S_TIMING: The value we wrote was the reset default.
TEGRA_I2S_FIFO_SCR: The default was for the FIFOs to request more data
when one slot was empty. The requested value was for the FIFOs to request
when four slots were empty. The DMA controller in the mainline kernel is
configured to burst a single entry at a time into the FIFO, hence there
was no issue. The only negative effect was on bus efficiency losses due
to an increased number of arbitration attempts.
However, in various non-upstream changes, the DMA controller now bursts
four entries at a time into the FIFO. If there is only space for one
entry, the data is simply dropped. In practice, this resulted in 3/4 of
samples being dropped, and playback at 4x the expected rate and pitch.
By fixing the clocking issue, this is solved.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Currently pcm_new() passes in 3 arguments :- card, pcm and DAI.
Refactor this to only pass in 1 argument (i.e. the rtd) since struct rtd contains
card, pcm and DAI along with other members too that are useful too.
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
We want the default state of the HP_MUTE signal to be asserted, so that
the headphones are muted before the first audio playback. Without this,
the headphones are left unmuted until shortly after the first audio
playback completes.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The prototype of the inline dummy version of tegra_i2s_debug_add
was not consistent with the real version.
Reported-by: Rhyland-Klein <rklein@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
There needs to be a strong reason for overriding the Kconfig default.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
CONFIG_SND_SOC_TEGRA_WM8903 is useful for many Tegra boards. To avoid the
ASoC tegra/Kconfig enumerating them all, instead have the Tegra machine
Kconfig select MACH_HAS_SND_SOC_TEGRA_WM8903 where appropriate, and have
SND_SOC_TEGRA_WM8903 depend on this.
[Redid ASoC diff so it applies. -- broonie]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Replace calls to a variety of registration functions by updating
struct snd_soc_card snd_soc_tegra_wm8903 to directly point at the
various control/widget/map tables instead. The ASoC core now
performs any required registration based on these data fields.
(Applying Mark's TrimSlice review comments to the existing driver)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Card widgets are created in the card's DAPM context, not any codec's DAPM
context. Hence, w->codec==NULL. Instead, find the card from the widget
through the DAPM context of the widget, not the codec of the widget.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Only the clock programming code needs to know whether the clocks changed,
and that is encapsulated within tegra_asoc_utils_set_rate(). The machine
driver's call to snd_soc_dai_set_sysclk(codec_dai, ...) is safe
irrespective of whether the clocks changed.
(Applying Mark's TrimSlice review comments to the existing driver)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
When the driver is not initialized/registered, nothing should be touching
these fields anyway, so there's no point clearing them out.
(Applying Mark's TrimSlice review comments to the existing driver)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This machine driver is a platform driver, and hence will only be
instantiated on the correct machines. Hence, there is no need to
check the current machine during probe.
(Applying Mark's TrimSlice review comments to the existing driver)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Ventana is identical to Harmony.
* Seaboard, Kaen, and Aebl are all pretty similar, mainly with slightly
different sets of GPIOs, and slightly different WM8903 pin connectivity.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Storing the struct in an array makes the assignments to the GPIO member a
little non-obvious, and is pointless when there's only a single GPIO.
(I thought I fixed this during the review cycle when first submitting this
driver, but I guess I overlooked that)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The previous commit renames SND_TEGRA_SOC_HARMONY to SND_TEGRA_SOC_WM8903.
While we're breaking people's .config files, rename all Tegra/SOC-related
Kconfig variables to be more consistent with at least the core codec
variables. Note that there exist machines that name their variables both
ways.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Soon, this machine driver will be updated to handle a number of Tegra boards
using the WM8903 codec. Rename the file in advance to reflect this.
Fix the content of tegra_wm8903.c to match the rename; replace references
to Harmony board with something more generic.
* s/struct tegra_harmony/struct tegra_wm8903/
* s/harmony/machine/ # variable name
* Similar rename for some functions
* Similar comment fix
* Similar MODULE_DESCRIPTION fix
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Soon, this machine driver will be updated to handle a number of Tegra boards
using the WM8903 codec. Rename the platform device in advance to reflect this.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The audio driver will soon support more than just the Tegra Harmony board.
Rename the platform data header file and data type to reflect this.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC machine drivers that are their own platform_driver (as opposed to
those using the soc-audio platform_driver) need to explicitly set up
power-management operation callbacks.
To avoid cut/paste, snd_soc_pm_ops also needs to be exported.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
tegra_dma_allocate_channel() returns NULL on errors, not an error pointer.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The utilities will be required by every machine driver. Including the
utility object directly into every machine driver causes a build failure
if the modules are actually built into the kernel, since each will define
the symbols exported by the utility file. Solve this by moving the
utility object into a separate module.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
With the appropriate MODULE_ALIAS in place, the audio modules will be
automatically loaded; there is no longer a need for manual modprobes.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Harmony has both an external mic (a regular mic jack) and an internal mic
(a 0.1" two-pin header on the board).
The external mic is connected to the WM8903's IN1L pin, and is supported
by the current driver.
The internal mic is connected to the WM8903's IN1R pin, and is not supported
by the current driver.
It appears that no Harmony systems were shipped with any internal mic
connected; users were expected to provide their own. This makes the
internal mic connection less interesting.
The WM8903's Mic Bias signal is used for both of these mics. For each mic,
a GPIO drives a transistor which gates whether the mic bias signal is
actively connected to that mic, or isolated from it.
The dual use of the mic bias for both mics makes a general-purpose complete
implementation of mic detection using the mic bias complex. So, for
simplicity, the internal mic is currently ignored by the driver.
This patch configures the relevant GPIOs to enable the mic bias connection
to the external mic, and disable the mic bias connection to the internal
mic. Note that in practice, this is the default state if these GPIOs aren't
configured.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Add jack definition for mic jack
* Request wm8903 to enable mic detection
* Force mic bias on, since it's required for mic detection
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
It causes noisy -codecs to appear in things like .codec_name.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
gpio_set_value* should accept logic values not just 0 or 1. The WM8903 GPIO
driver has been fixed to work this way, so remove the redundant !!
previously required when it didn't accept values >1.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Instead, have the machine driver provide storage for the utility data
somehow.
For Harmony in particular, store this within struct tegra_harmony, itself
referenced by snd_soc_card's drvdata.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Indent with TABs not spaces.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Add DAPM widget definitions for the internal speaker paths. Currently, this
path is always enabled while playback is active.
Add code to control the speaker amplifier GPIO.
The GPIO is requested during _init, since that's the first time it is
guaranteed that the WM8903 module is loaded, probed, and hence has exported
its GPIO chip.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Previously, snd-soc-tegra-harmony internally instantiated a platform device
object whenever the module was loaded. Instead, switch to a more typical model
where arch/arm/mach-tegra defines a platform device, and snd-soc-tegra-harmony
acts as a driver for such a platform device.
Define a new struct tegra_harmony to store driver data in the future.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
With this change, I can capture from a microphone plugged into the
mic jack on Harmony (after unmuting Left Input PGA, and maybe turning
up the gain there too).
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
That config variable doesn't exist in the mainline kernel, and hence
the dependency shouldn't either.
In linux-tegra-2.6.36, the dependency did exist to avoid a conflict with
the old non-ALSA Tegra I2S driver. However, this isn't and won't be
upstreamed.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
A recent discussion on linux-arm-kernel noted that the value returned by
clk_get_sys is an opaque token, and not strictly a pointer; it is
meaningful only to the clock API, clients should not dereference the value,
and the clock API must accept any non-IS_ERR value it returned.
Hence, only IS_ERR is appropriate to interpret the result, not
IS_ERR_OR_NULL.
I checked that clk_get_sys in both ASoC's for-next and Tegra's for-next
do behave as described; NULL is not returned in the case of error.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Everything else is using snd_soc_ so we should use it here too.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>