Commit graph

99 commits

Author SHA1 Message Date
Stephen Warren a9005b67b3 ASoC: tegra: set a sensible initial clock rate
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>
2012-04-06 18:25:16 +01:00
Stephen Warren 17933db2e4 ASoC: tegra: use devm_ APIs in SPDIF driver
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>
2012-04-06 18:22:06 +01:00
Stephen Warren 7613c508df ASoC: tegra: sort includes, remove mach/iomap.h
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-06 18:22:06 +01:00
Stephen Warren 896637ac1b ASoC: tegra: complete Tegra->Tegra20 renaming
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>
2012-04-06 17:36:15 +01:00
Stephen Warren ef280d3907 ASoC: tegra: rename Tegra20-specific driver files
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>
2012-04-06 14:17:45 +01:00
Stephen Warren a7fda2ba82 ASoC: tegra: make Tegra20 drivers depend on Tegra20 support
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>
2012-04-05 21:57:37 +01:00
Stephen Warren 063dd9d448 ASoC: tegra: drop Kconfig description for SND_SOC_TEGRA_DAS
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>
2012-04-05 21:57:37 +01:00
Stephen Warren 30d436a644 ASoC: tegra: remove open-coded clk reference counting
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>
2012-04-01 11:28:32 +01:00
Stephen Warren c0d5a47ca8 ASoC: tegra: sort Makefile into common and per-SoC files
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>
2012-04-01 11:28:32 +01:00
Stephen Warren d9bba496d4 ASoC: tegra: introduce separate Kconfig variable for DAS driver
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>
2012-04-01 11:28:32 +01:00
Stephen Warren 7deb2b450d ASoC: tegra: fix some checkpatch warnings
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>
2012-04-01 11:28:31 +01:00
Stephen Warren 4df8271e1f ASoC: tegra: fix Kconfig SND_SOC_TEGRA_ALC5632 indentation
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>
2012-04-01 11:28:31 +01:00
Stephen Warren fcff5f9974 ASoC: tegra: remove unnecessary includes
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-01 11:28:31 +01:00
Stephen Warren 518de86ba1 ASoC: tegra: register 'platform' from DAIs, get rid of pdev
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-01 11:28:28 +01:00
Stephen Warren 1ae93b9d34 ASoC: tegra: fix comment indentation in ALC5632 machine
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-04-01 11:28:28 +01:00
Stephen Warren c25cd15439 ASoC: tegra: Remove unused variable
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-03-06 20:06:59 +00:00
Leon Romanovsky dd7d3a2417 ASoC: tegra+alc5632: Added digital microphone DAPM widget.
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-13 11:37:35 -08:00
Leon Romanovsky 9f71770b88 ASoC: tegra: Remove unused DAPM route structure.
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-02 22:27:52 +00:00
Leon Romanovsky d559f1e5ad ASoC: Tegra+ALC5632: Enable headset autodetection on PAZ00 board.
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-02-02 22:27:52 +00:00
Leon Romanovsky b4dc0a75af ASoC: Tegra+ALC5632: Implement device tree support in board file
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>
2012-01-31 19:34:48 +00:00
Joachim Eastwood 350e16d529 ASoC: replace 0xffffffff with DMA_BIT_MASK macro
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 13:58:26 +00:00
Joachim Eastwood 25e9e7565f ASoC: check for substream not channels_min in pcm engines
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>
2012-01-07 11:18:05 -08:00
Axel Lin b16eaf9fd3 ASoC: tegra: Add .owner to struct snd_soc_card
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-22 17:34:35 +00:00
Stephen Warren 07cdf36d8c ASoC: Tegra+WM8903 machine: Add device tree binding
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>
2011-12-20 01:05:34 +00:00
Leon Romanovsky 58783faf28 ASoC: Tegra machine ASoC driver for boards using ALC5332 codec
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>
2011-12-20 00:41:29 +00:00
Stephen Warren 7b9b5e1170 ASoC: Tegra: Move DAS configuration into DAS driver
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>
2011-12-08 12:34:07 +08:00
Stephen Warren bf55499e6e ASoC: Tegra I2S: Add device tree binding
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-30 09:38:13 +00:00
Axel Lin af3c2621a9 ASoC: Convert tegra_spdif to use module_platform_driver()
Use the module_platform_driver() macro which makes
the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 22:12:15 +00:00
Mark Brown 5032dc3429 ASoC: Convert WM8903 MICBIAS to a supply widget
Also rename it to MICBIAS to reflect the pin name and help any out of tree
users notice the change.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
2011-11-28 17:02:07 +00:00
Stephen Warren 504855d171 ASoC: TrimSlice machine: Set the new fully_routed flag
Set card.fully_routed to request the ASoC core calculated unused codec
pins, and call snd_soc_dapm_nc_pin() for them. Remove the open-coded
calls.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 21:35:03 +00:00
Stephen Warren 6e5fdba9c9 ASoC: Tegra+WM903 machine: Set the new fully_routed flag
Set card.fully_routed to request the ASoC core calculated unused codec
pins, and call snd_soc_dapm_nc_pin() for them. Remove the open-coded
calls.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 21:34:59 +00:00
Stephen Warren d4a2eca781 ASoC: Tegra I2S: Remove dependency on pdev->id
When devices are instantiated from device-tree, pdev->id is set to -1.
Rework the driver so it doesn't depend on the ID.

Tegra I2S instantiated from board files are configured with pdev
name "tegra-i2s" and ID 0 or 1. The driver core then names the
device "tegra-i2s.0" or "tegra-i2s.1". This is not changing.

When a device is instantiated from device-tree, it will have
pdev->name="" and pdev->id=-1. For this reason, the pdev->id value is
not something we can rely on.

This patch doesn't actually change any names though:

When a device is instantiated from device-tree, the overall device name
will be "${unit_address}.${node_name}". This causes issues such as
clk_get() failures due to lack of a device-name match. To solve that,
AUXDATA was invented, to force a specific device name, thus allowing
dev_name() to return the same as the non-device-tree case. Tegra
currently uses AUXDATA for the I2S controllers. Eventually, AUXDATA will
go away, most likely replaced by phandle-based references within the
device tree.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 21:34:48 +00:00
Stephen Warren 45c2609120 ASoC: Tegra TrimSlice machine: Use devm_ APIs and module_platform_driver
module_platform_driver saves some boiler-plate code.

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>
2011-11-23 11:10:52 +00:00
Stephen Warren e4e4c18a93 ASoC: Tegra+WM8903 machine: Use devm_ APIs and module_platform_driver
module_platform_driver saves some boiler-plate code.

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>
2011-11-23 11:09:13 +00:00
Stephen Warren 186bcda6f6 ASoC: Tegra DAS: Add device tree binding
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 11:05:08 +00:00
Lars-Peter Clausen 85e7652d89 ASoC: Constify snd_soc_dai_ops structs
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure")
introduced the possibility to have constant DAI ops structures, yet this is
barley used in both existing drivers and also new drivers being submitted,
although none of them modifies its DAI ops structure. The later is not
surprising since existing drivers are often used as templates for new drivers.
So this patch just constifies all existing snd_soc_dai_ops structs to eliminate
the issue altogether.

The patch was generated with the following coccinelle semantic patch:
// <smpl>
@@
identifier ops;
@@
-struct snd_soc_dai_ops ops =
+const struct snd_soc_dai_ops ops =
{ ... };
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 10:40:46 +00:00
Stephen Warren bea0ed0825 ASoC: Tegra I2S: Use devm_ APIs and module_platform_driver
module_platform_drive saves some boiler-plate code.

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>
2011-11-23 10:24:10 +00:00
Stephen Warren 65713ce844 ASoC: Tegra: Move DAS configuration into machine drivers
This removes potentially machine-specific routing knowledge from the
I2S driverinto the machine drivers, which is better equipped to know
what the appropriate routing configuration is.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 10:24:10 +00:00
Stephen Warren f2296d7bf1 ASoC: Tegra DAS: Use devm_ APIs and module_platform_driver
module_platform_drive saves some boiler-plate code.

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>
2011-11-23 10:24:10 +00:00
Stephen Warren 99c92ae4ff ASoC: Tegra PCM: Use module_platform_driver
This saves some boiler-plate code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 10:24:10 +00:00
Paul Gortmaker da155d5b40 sound: Add module.h to the previously silent sound users
Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up.  So
fix up those users now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:21 -04:00
Olof Johansson 01840bbe5f ASoC: Tegra: sparse cleanup
Fixes the following sparse warnings:

sound/soc/tegra/tegra_das.c:215:8: warning: Using plain integer as NULL pointer
sound/soc/tegra/tegra_das.c:237:8: warning: Using plain integer as NULL pointer
sound/soc/tegra/tegra_pcm.c:370:32: warning: symbol 'tegra_pcm_platform' was not declared. Should it be static?

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-17 22:43:16 +01:00
Mark Brown 87bea31c7b ASoC: Remove redundant snd_soc_dapm_sync() calls from machine drivers
The core will sync DAPM as part of the card initialization, there is no
need for machine drivers to do so during their setup.

OMAP drivers are omitted as I know Peter already has patches for them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-08 14:10:54 +01:00
Axel Lin 4b8713fd54 ASoC: Remove unused srate variable in tegra_spdif_hw_params
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-02 19:58:45 +01:00
Axel Lin 019cd3b25a ASoC: tegra: Staticise tegra_i2s_dai and tegra_spdif_dai
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-02 19:58:44 +01:00
Stephen Warren ee1a4d4b7f ASoC: Tegra: wm8903 machine driver: Drop Ventana support
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>
2011-08-24 10:38:05 +01:00
Stephen Warren 29591ed4ac ASoC: Tegra: wm8903 machine driver: Allow re-insertion of module
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>
2011-08-09 09:42:11 +09:00
Stephen Warren a96edd59b2 ASoC: Tegra: tegra_pcm_deallocate_dma_buffer: Don't OOPS
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
2011-08-09 09:40:57 +09:00
Stephen Warren 774fec338b ASoC: Tegra: Implement SPDIF CPU DAI
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>
2011-07-05 12:20:56 -07:00
Mark Brown 469bb638dc Merge branch 'for-3.0' into for-3.1 2011-07-04 08:54:40 -07:00