Commit graph

321 commits

Author SHA1 Message Date
Mark Brown a7c4183be2 ASoC: wm8994: Disable line output discharge prior to ramping VMID
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-08 19:52:00 +00:00
Mark Brown f647e1526f ASoC: wm8994: Fix typo in VMID ramp setting
The VMID ramp rate is supposed to be 0x3, not 11b. Fix that.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-02-08 19:51:53 +00:00
Mark Brown 87092e3ca4 ASoC: wm8994: Bring WM8994 accessory detection up to date
Make the mechanism used for WM8994 more like that for WM1811 and WM8958:
provide the logic to distinguish between headphone and headset and hard
code the reporting of sensible SND_JACK values. Should integration with
other detection mechanisms be required we can add appropriate callbacks
(though some integrations should be able to use the subsystem ones).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06 19:06:19 +00:00
Mark Brown 27060b3c64 ASoC: wm8994: Unsuspend the device while reading GPIO statuses
Otherwise we might get an error if the GPIO is configured as an input
since that makes the register volatile and a suspended device can't be
read from.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06 19:06:18 +00:00
Mark Brown 5fab517476 ASoC: wm8994: We don't need to runtime resume by default
This is the default state that the runtime PM infrastructure expects so
instead just kick the runtime PM core to suspend us if we're not doing
anything (as is default).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06 19:06:01 +00:00
Mark Brown 839e5fadc6 ASoC: wm8994: Don't bring up to STANDBY by default
In cases where we should enter STANDBY DAPM will power us up, otherwise
there is no need to power up and we can remain in OFF.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06 14:05:27 +00:00
Mark Brown db966f8abb ASoC: wm8994: Enabling VMID should take a runtime PM reference
We can enable VMID independently of the bias in some use cases so we need
to ensure that the core device is powered up.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-02-06 12:08:33 +00:00
Liam Girdwood 022658beab ASoC: core: Add support for DAI and machine kcontrols.
Currently ASoC can only add kcontrols using codec and platform component device
handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for
SoC card machine drivers too. This allows the kcontrol to have a direct handle to
the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily
get it's private data.

This change makes snd_soc_add_controls() static and wraps it in the folowing
calls (card and dai are new) :-

snd_soc_add_card_controls()
snd_soc_add_codec_controls()
snd_soc_add_dai_controls()
snd_soc_add_platform_controls()

This patch also does a lot of small mechanical changes in individual codec drivers
to replace snd_soc_add_controls() with snd_soc_add_codec_controls().

It also updates the McBSP DAI driver to use snd_soc_add_dai_controls().

Finally, it updates the existing machine drivers that register controls to either :-

1) Use snd_soc_add_card_controls() where no direct codec control is required.
2) Use snd_soc_add_codec_controls() where there is direct codec control.

In the case of 1) above we also update the machine drivers to get the correct
component data pointers from the kcontrol (rather than getting the machine pointer
via the codec pointer).

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-04 12:40:11 +00:00
Mark Brown f959dee9c7 ASoC: wm_hubs: Push check for idle_bias_off out into drivers
For later wm_hubs devices we have much less need to keep the biases up
even when using single ended line outputs so flag idle_bias_off for
everything except the WM8993 and WM8994.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-31 19:29:58 +00:00
Mark Brown 67f97f5c3e ASoC: wm8994: Remove ASoC level register cache sync
Now we've switched over to regmap the ASoC level cache sync will be
ineffectual and potentially harmful as there is no longer an ASoC level
cache.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-31 15:24:58 +00:00
Mark Brown 7c08b51f2f ASoC: wm8994: Report any low impedance accessory as a headphone
Report any accessory with a low impedance as a headphone, previously
anything other than a short or microphone would not be reported at all.
The most likely reason is a microphone with incorrect polarity.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-26 18:41:03 +00:00
Mark Brown 99b0292d94 ASoC: 24 bits are significant on wm_hubs DAIs
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 13:58:30 +00:00
Mark Brown 1b39bf3468 ASoC: Enable ASoC register map dump for some regmap CODECs
It's still useful to be able to poke around in the register map at
runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-30 01:59:39 +00:00
Mark Brown a421a0e41c ASoC: Remove unused label from wm8994 probe()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29 11:54:43 +00:00
Mark Brown cae59c7b21 ASoC: Remove WM8994 register cache
Now that the mfd is using the register map cache there's no need for the
CODEC driver to do any register cache management or any funny dances to
interact with the other drivers using the device so just remove the cache
initialisation and volatility information.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-13 00:20:11 +08:00
Mark Brown d9a7666ff3 ASoC: Remove ASoC-specific WM8994 I/O code
Just go directly to the regmap API, saving code and making integration
that bit more direct.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-13 00:20:06 +08:00
Mark Brown 4105ab846c ASoC: Rely on core enabling the wm8994 with runtime PM
No need to do this in the driver now.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-08 09:22:48 +08:00
Mark Brown 33e57f221a Merge branch 'for-3.2' into for-3.3 2011-12-02 17:44:55 +00:00
Mark Brown 87b86ade8b ASoC: Mark WM8994 ADC muxes as virtual
Since they don't actually have power bits but do have events associated
with them it's important that we bootstrap their state properly which
making them virtual does.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02 17:44:37 +00:00
Mark Brown 3631e8d43e ASoC: Add missing err label
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02 10:55:12 +00:00
Lars-Peter Clausen 84b315ee89 ASoC: Drop unused state parameter from CODEC suspend callback
The existence of this parameter is purely historical. None of the CODEC drivers
uses it and we always pass in the same value anyway, so it should be safe to
remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02 10:32:03 +00:00
Mark Brown 7270cebef2 ASoC: Convert WM8994 to devm_kzalloc()
Still have a manual free in there for some realloc()ed memory as there's
no devm version of that.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:22:03 +00:00
Mark Brown cd1707a99a ASoC: Add platform data for WM8958/WM1811 microphone detection rates
Allow systems to override the default microphone detection rates using
platform data in case the settings are not suitable (eg, due to an
unusually noisy jack).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:22:01 +00:00
Mark Brown 52ac7ab247 ASoC: Ensure we reconfigure WM8958 microphone detection on rate changes
We don't need to rerun DAPM if the clock source is the same but we do
need to adjust the microphone detection rate in case we are moving from
an audio to a non-audio rate.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:58 +00:00
Mark Brown af6b6fe41c ASoC: Implement support for WM1811A jack detection
The WM1811A features an advanced low power accessory detection subsystem
which allows the device to be maintained in a very low power state while
the system is idle without sacrificing any accessory detection features.

Implement software support for this, automatically managing the power
configuration of the device depending on the detected accessory.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:55 +00:00
Mark Brown 157a75e664 ASoC: Rename WM8994 detecting flag to mic_detecting
More specific and avoids confusion with a following change.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:53 +00:00
Mark Brown 4585790d1c ASoC: Allow more WM8958/WM1811 button levels with default handler
The WM8958 and WM1811 support detecting a range of buttons. Allow the
user to provide platform data enabling more of these levels without
having to write a custom detection handler.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:51 +00:00
Mark Brown 604533de0f ASoC: Tune down active mode detection rate for WM8958 mic detection
Saves a little power.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:48 +00:00
Mark Brown 2a8a856d42 ASoC: Don't use control_data to get struct wm8994
This will support refactoring to make use of the regmap API more directly
in the core.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-01 14:21:41 +00:00
Mark Brown a1691343a3 ASoC: Provide debug log of accessory status on WM8958
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-30 20:50:28 +00:00
Mark Brown b00adf76a6 ASoC: Enhance default WM8958 microphone detection
Actively manage the detection rate for microphones with WM8958, providing
improved power consumption and maximising the benefit from the hardware
debounce.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-29 20:22:00 +00:00
Mark Brown 500fa30ed5 ASoC: Put WM8958 and WM1811 MICBIAS into bypass mode when no audio
When we don't have any active audio we can put the microphone biases into
bypass mode to save power at the expense of performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-29 19:59:18 +00:00
Mark Brown 4cdf5e49ce ASoC: Ensure SYSCLK is enabled for WM8958 accessory detection
Ensure SYSCLK is enabled while running accessory detection on WM8958.
It is always required so there is no sense in requiring machine drivers
to individually do this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-29 17:23:29 +00:00
Mark Brown fd8f2e496f Merge branch 'for-3.2' into for-3.3 2011-11-28 23:18:39 +00:00
Mark Brown fc8e6e8668 ASoC: Supply dcs_codes for newer WM1811 revisions
Based on initial data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 23:18:38 +00:00
Mark Brown 49b72776f3 Merge branch 'for-3.2' into for-3.3 2011-11-28 22:13:14 +00:00
Mark Brown fc07ecd851 ASoC: Error out if we can't generate a LRCLK at all for WM8994
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 22:10:05 +00:00
Mark Brown 5bbcc3c0d0 ASoC: Convert CODEC drivers to module_platform_driver
Factors out a bit of boilerplate.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 11:33:29 +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
Mark Brown 19940b3d55 ASoC: Ensure we get an impedence reported for WM8958 jack detect
Occasionally we may see an accessory reported before we have a stable
impedance for the accessory. If this happens then reread the status in
order to ensure that the handler can take the appropriate action for the
status change.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-04 23:24:59 +00:00
Mark Brown 5a3ad6bd6a ASoC: Don't use wm8994->control_data when requesting IRQs
The field is no longer initialised so this will crash if running on
wm8958.

Reported-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-04 23:24:58 +00:00
Mark Brown 8eeea521d9 ASoC: Don't use wm8994->control_data in wm8994_readable_register()
The field is no longer initialised so this will crash if running on
wm8958.

Reported-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-11-04 23:24:58 +00:00
Axel Lin 35024f4922 ASoC: wm8994: Use SND_SOC_DAPM_AIF_OUT for AIF3 Capture
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-10-20 15:03:05 +01:00
Mark Brown 6473a14805 ASoC: Update WM1811 DCS codes for latest evaluation results
Evaluation of larger quantities of material has provided new DCS codes
values to be applied for WM1811.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-10-18 11:15:36 +01:00
Axel Lin 48df93d4c7 ASoC: Remove impossible case from wm8994_hw_params
We set hw_params callback for wm8994_aif3_dai_ops to wm8994_aif3_hw_params.
Thus no need to check wm8994-aif3 in wm8994_hw_params.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-12 11:25:58 +01:00
Mark Brown 5d224e8f18 Merge branch 'for-3.1' into for-3.2 2011-10-04 15:44:43 +01:00
Axel Lin c527e6aadc ASoC: wm8994: Fix setting rate_reg for wm8994-aif2
For wm8994-aif2, the rate_reg should be WM8994_AIF2_RATE.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-10-04 15:43:29 +01:00
Axel Lin 04f45c493a ASoC: wm8994: Slightly optimize configure_clock
snd_soc_update_bits() will only write new register value
if the old value is different from the new value.
In additional, snd_soc_update_bits() returns 0 for no change.
No need to read WM8994_CLOCKING_1 register before calling snd_soc_update_bits().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04 13:09:55 +01:00
Mark Brown 81204c84ca ASoC: Add WM1811 support
The WM1811 is mostly register compatible with the WM8994 and WM8958,
providing a high performance audio hub CODEC in a small form factor
suitable for ultra compact system designs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04 11:59:46 +01:00
Mark Brown 60e3ee62af ASoC: Fix backport of WM8994 thermal warning
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
2011-08-17 15:20:45 +09:00
Mark Brown f0b182b003 ASoC: Implement WM8994 thermal warning and shutdown interrupt support
ALSA doesn't really have good mechanisms for dealing with these so we just
log them - the hardware already has automatic shutdown support.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-17 00:49:03 +09:00
Mark Brown 1ddc07d0f1 ASoC: Add WM8958 noise gate support
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-17 00:48:47 +09:00
Mark Brown d09f3ecf1a ASoC: Disable pulls on WM8994 AIF2 when starting it
Pull control is availalbe for WM8994 AIF2, generally disabled as part of
the GPIO configuration in order to save power after system startup. As on
newer devices in the series there is no GPIO functionality on these pins
this will happen less naturally so have the driver disable the pulls as the
AIF is probed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-15 23:54:12 +09:00
Mark Brown 4b7ed83aa3 ASoC: Disable WM8994 VMID for digital only paths
On WM8994 class devices only the analogue portions of the CODEC require
VMID so when running digital only paths we can leave VMID disabled.
On some earlier devices the FLL uses VMID so we don't use DAPM reference
counting alone, we maintain an internal reference count which is also
enabled and disabled by the FLL startup.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-08-14 13:44:23 +09:00
Mark Brown 4e04adaf87 ASoC: Add VMID widget for wm_hubs devices
Currently this does not actually do anything, it is being introduced in
order to facilitate additional power optimisations for current generation
devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-08-14 13:44:14 +09:00
Mark Brown 4158a05741 Merge branch 'for-3.1' into for-3.2 2011-08-11 10:43:40 +09:00
Mark Brown 280ec8b718 ASoC: Add missing break in WM8994 probe
This error would have no effect on current silicon revisions, the fall
through case has the same behaviour.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-08-11 10:43:20 +09:00
Mark Brown 4537c4e761 ASoC: Support separate left and right channel dcs_codes values
Some devices can have performance optimized by setting different offsets
for left and right channels.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-08-01 22:14:49 +09:00
Mark Brown 79ef0abcd8 ASoC: Implement new DC servo readback mode for late WM8994 revisions
Later WM8994 devices implement a new DC servo readback mode with the
register used to access the offset moved to register 0x59. Implement
support for this and enable it on the appropriate devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-08-01 22:14:30 +09:00
Mark Brown 4400855986 Merge branch 'for-3.0' into for-3.1 2011-07-17 18:25:58 +09:00
Mark Brown b793eb60a0 ASoC: Correct WM8994 MICBIAS supply widget hookup
The WM8994 and WM8958 series of devices have two MICBIAS supplies rather
than one, the current widget actually manages the microphone detection
control register bit (which is managed separately by the relevant API).

Fix this, hooking the relevant supplies up to the MICBIAS1 and MICBIAS2
widgets.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-07-17 18:24:29 +09:00
Mark Brown 7d02173cd1 ASoC: Reduce power consumption for idle DAIs in WM8994
If DAIs are idle but their clocks are in use for some reason (eg, as
SYSCLK or for accessory detect) then set the clock dividers to the maximum
to reduce slightly the power consumption of the unclocked circuits.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-17 17:51:10 +09:00
Mark Brown f0f5039c3d ASoC: Handle failed WM8994 FLL lock waits
Try the completion before we start the FLL so that if an interrupt was
delayed long enough for us to miss it we don't wait for the completion
it signalled.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-17 13:15:00 +09:00
Mark Brown 47d90a03eb Merge branch 'for-3.0' into for-3.1 2011-07-15 22:43:07 +09:00
Mark Brown b35e160a11 ASoC: Fix shift in WM8958 accessory detection default implementation
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-07-15 22:41:38 +09:00
Mark Brown 3b1af3f8c8 ASoC: Log WM8994 FIFO errors from the interrupt
We should spot them anyway on state changes but logging them gives us
better time information about when the misconfiguration happened.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-14 17:17:23 +09:00
Mark Brown f05bdb8bb6 ASoC: Don't warn on low WM8994/58 AIFnCLKs
We can have valid but very low clocks in accessory detection modes.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-14 00:38:30 +09:00
Mark Brown c7ebf932e5 ASoC: Use WM8994 FLL lock interrupt
If we have interrupts then wait for the FLL lock interrupt rather than
using dead reckoning when waiting for the FLL to start.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-14 00:38:22 +09:00
Mark Brown b30ead5f39 ASoC: Hook up DC servo completion IRQ for WM8994 and WM8958
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-14 00:38:14 +09:00
Mark Brown b70a51bab9 ASoC: Use late enable handling for direct voice, speaker and headphone
This ensures appropriate clocking for bypass paths to speaker and
headphone and direct voice paths on affected revisions.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-14 00:37:52 +09:00
Mark Brown 5b7396709e ASoC: Conditionalize the enable of WM8994 ADC TDM mode
Future devices will not benefit from this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-07-09 23:16:48 +09:00
Mark Brown 469bb638dc Merge branch 'for-3.0' into for-3.1 2011-07-04 08:54:40 -07:00
Mark Brown 8e9ddf811b ASoC: Ensure we delay long enough for WM8994 FLL to lock when starting
This delay is very conservative.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@kernel.org
2011-07-04 08:51:44 -07:00
Mark Brown f9acf9fe5b ASoC: Trigger wm_hubs series update startup off a separate flag
Allowing the two to be used independently.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-06-23 20:05:23 +01:00
Jarkko Nikula 9d03545d88 ASoC: Fix wrong data type access in a few codec drivers
Commit fafd217 ("ASoC: Store a list of widgets in a DAPM mux/mixer kcontrol")
changed the control private data type that is passed to snd_soc_cnew when
creating dapm mixer and mux controls. Commit did not update a few codec
drivers that are using their own put callbacks and thus are accessing a
wrong data type.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-05-16 09:06:47 -07:00
Mark Brown ca629928b9 ASoC: Disable WM8994/58 microphone detection over suspend
It will be non-functional with the basises and clocks off anyway, if the
system needs microphone detection enabled over suspend then it should be
causing the CODEC to ignore suspend using the APIs for that to prevent
the biases being disabled.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-05-11 15:56:32 +02:00
Mark Brown d9b3e4c515 Merge branch 'for-2.6.39' into for-2.6.40 2011-04-07 08:27:06 +09:00
Mark Brown baa8160382 ASoC: Set left channel volume update bits for WM8994
Ensures that we apply volume updates that don't affect the right channel.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-04-07 08:26:09 +09:00
Mark Brown 312158718f ASoC: Add WM8958 enhanced EQ support
DSP2 in the WM8958 can be used to support an upgraded EQ for use in
demanding applications.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-03-22 18:41:28 +00:00
Mark Brown 09e10d7fe5 ASoC: Add WM8958 VSS support
With appropriate firmware the WM8958 can support Virtual Surround Sound or
VSS, widening the stereo audio image for improved user experience. Enable
support for this mode of operation when the appropriate firmware can be
loaded at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-03-22 18:41:27 +00:00
Mark Brown fbbf592002 ASoC: Support download of WM8958 MBC firmware
Allow userspace to supply an update to the ROM firmware. The firmware
request is non-blocking so userspace can load the firmware at its
leisure without delaying startup, the driver will begin using the
firmware the next time MBC is started after it has been supplied.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-03-22 18:41:20 +00:00
Mark Brown af9af86602 ASoC: Mark WM8958 DSP2 registers readable
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-18 10:53:25 +00:00
Mark Brown c6b7b57012 ASoC: Handle startup sequencing of WM8958 DSP2 with deferred clocking
The DSP2 startup requires that the clock be enable so if we've deferred
clock startup we need to defer DSP2 startup

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-18 10:52:50 +00:00
Mark Brown f701a2e594 ASoC: Factor WM8958 DSP2 handling into separate file
DSP2 on the WM8958 has a default ROM which provides a multi-band
compressor for enhanced performance on mobile devices but can also
support runtime download of alternative firmware. In preparation for
more exploiting this functionality refactor the code to split the
handling of DSP2 into a separate file.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-18 10:52:40 +00:00
Mark Brown 780e280698 ASoC: Treat WM8958 revision A as WM8994 revision D
The first WM8958 revision requires similar treatment.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-18 10:52:25 +00:00
Mark Brown 80e1b84ffe Merge branch 'for-2.6.38' into for-2.6.39 2011-03-10 14:16:35 +00:00
Mark Brown 7c2de63386 ASoC: Ensure WM8958 gets all WM8994 late revision widgets
Without this fix the driver won't instantiate properly on relevant
devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@kernel.org
2011-03-09 20:30:29 +00:00
Mark Brown 0627bd2575 ASoC: Fix typo in late revision WM8994 DAC2R name
Without this fix the driver won't instantiate properly on relevant
devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@kernel.org
2011-03-09 20:30:22 +00:00
Dimitris Papastamos b462c6e69a ASoC: WM8994: Ensure MICBIAS is provided with a clock
The patch 'ASoC: WM8994: Improve Playback Robustness' did not handle
this case properly.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-03-01 23:29:12 +00:00
Mark Brown c496ccd5db Merge branch 'for-2.6.38' into for-2.6.39 2011-03-01 23:29:04 +00:00
Dimitris Papastamos 04d286819b ASoC: WM8994: Ensure late enable events are processed for the ADCs
Ensure that the ADCs are provided with a clock as the previous patch
"ASoC: WM8994: Improve playback robustness" did not handle this case
properly.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-03-01 23:27:07 +00:00
Dimitris Papastamos a3cff81ac1 ASoC: WM8994: Don't disable the AIF[1|2]CLK_ENA unconditionaly
Since we began using the late clock disable functionality, ensure that
we don't disable the clock if any of the ADC or DAC paths are still
enabled.  This happens when we have simultaneous playback and recording.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-03-01 23:27:00 +00:00
Mark Brown 864c4bd248 ASoC: Simplify default WM8958 jack detection code
The default WM8958 jack detection handler implements a full set of buttons
and also support for video detection. Support for multi-button jacks is
fairly system specific and will usually require some tuning for headsets
so simplify the implementation to only report a simple short to ground
button, leaving multi-button headsets to be handled by system specific
code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-02-22 10:42:33 -08:00
Mark Brown 48e028ecca ASoC: Support configuration of WM8958 microphone bias analogue parameters
The WM8958 has a different microphone bias architecture to WM8994 so needs
different configuration to WM8994. Support this in platform data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-02-22 10:42:06 -08:00
Mark Brown 9b7c525dfa ASoC: Support WM8958 direct microphone detection IRQ
Allow direct routing of the WM8958 microphone detection signal to a GPIO
to be used, saving the need to demux the interrupt.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-02-22 10:41:41 -08:00
Mark Brown 4c090edfbb Merge branch 'for-2.6.38' into for-2.6.39 2011-02-22 10:38:13 -08:00
Mark Brown 406e56c9df ASoC: Fix WM8958 default microphone detection argument ordering
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-02-22 10:37:32 -08:00
Mark Brown 4a8d929d14 ASoC: Fix missing space in WM8994
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-02-18 09:13:30 -08:00
Mark Brown f98dedcefd Merge branch 'for-2.6.38' into for-2.6.39 2011-02-13 19:51:04 +00:00
Dimitris Papastamos c52fd021bc ASoC: WM8994: Improve playback robustness
On WM8994 revision D and earlier ensure proper playback robustness
as some rare use cases can trigger issues.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-02-13 19:45:01 +00:00
Dimitris Papastamos 173efa09e4 ASoC: WM8994: Improve robustness in some use cases
Ensure that on disabling certain registers such as AIF1DAC1L,
AIF1DAC1R etc. the AIF1CLK and AIF2CLK remain enabled.  Similarly
when enabling those registers, AIF1CLK and AIF2CLK will remain
disabled.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-02-13 19:44:54 +00:00
Mark Brown 7d7a7e0438 Merge branch 'for-2.6.38' into for-2.6.39 2011-02-03 20:17:54 +00:00
Mark Brown 6ed8f1485f ASoC: Improve WM8994 digital power sequencing
On WM8994 revision D and earlier ensure optimal sequencing with
simultaneous usage of AIF1 and AIF2 by tying the signals together
so if paths through both are connected the streams are started
simultaneously.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: stable@kernel.org
2011-02-03 20:17:13 +00:00
Mark Brown 7f94de483f ASoC: Create an AIF1ADCDAT signal widget to match AIF2
Due to the different routing for AIF1 and AIF2 we weren't using a
single widget to represent the ADCDAT signal. For consistency add
one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: stable@kernel.org
2011-02-03 20:16:46 +00:00
Mark Brown e66ef2f81f Merge branch 'for-2.6.38' into for-2.6.39 2011-01-19 14:50:22 +00:00
Qiao Zhou 78b3fb4675 ASoC: WM8994: fix wrong value in tristate function
fix wrong value in wm8994_set_tristate func. when updating reg bits,
it should use "value", not "reg".

Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-01-19 14:49:32 +00:00
Dimitris Papastamos d4754ec91c ASoC: Update users of readable_register()/volatile_register()
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-01-13 14:17:43 +00:00
Mark Brown 7116f452c8 ASoC: Yet more x86 tracepoint workarounds
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-12-29 13:06:18 +00:00
Mark Brown 2bbb5d6679 ASoC: Trace Wolfson jack detection IRQs
Add jack detection interrupt trace to Wolfson CODEC drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-22 11:08:55 +00:00
Mark Brown 458350b31f ASoC: Fix WM8994/58 3D stereo control definitions
Cut'n'paste in the register names.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-21 12:43:01 +00:00
Mark Brown 49db7e7b99 ASoC: Fix widgets for WM8994/58 AIF2 source control
The compiler really ought to have been warning about unreferenced
variables...

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-13 11:33:14 +00:00
Mark Brown 154b26aa9e ASoC: Implement WM8994/58 DAC and ADC oversampling control
The oversampling rate of the DAC and ADC can be controlled to optimise
for either low power consumption or maximum performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-10 17:39:54 +00:00
Uk Kim 146fd574ec ASoC: Add ADC high pass filter support to WM8994
Signed-off-by: Uk Kim <w0806.kim@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-12-08 15:46:49 +00:00
Mark Brown b1e43d933a ASoC: Support WM8994 mono AIF configurations
The WM8994 supports mono signals - enable this in the driver. With DSP
mode an automatic data channel selector is available, activate this
when in mono mode.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-08 13:56:31 +00:00
Mark Brown 4514e8997f ASoC: When disabling WM8994 FLL force a source selection
When we disable the WM8994 FLL code path sharing means that we end up
writing out a configuration. Currently this is the currently active
input and output frequency (which causes snd_soc_update_bits() to
suppress actual writes both immediately and in the common case where
we reenable the same configuration later) but we allow machine drivers
to pass through a source of zero. Since the register values written
are one less than the source constants this causes corruption of other
bitfields in the register.

Fix this by using the most recently configured FLL source when none is
provided.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: stable@kernel.org
2010-12-03 16:45:12 +00:00
Mark Brown 8bc3c2c207 ASoC: Tune performance of WM8958 revision A
Update some of the default configuration for the device to improve
the performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-02 13:03:53 +00:00
Mark Brown 131d81061e ASoC: Allow user-specified WM8958 multiband compressor configurations
The paramters of the WM8958 multiband compressor can be tuned by the
user for their system using a graphical configuration tool on the host.
Allow the user to specify a set of such paramters in platform data and
select between them at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-01 11:47:29 +00:00
Mark Brown b2822a8c22 ASoC: Correct event flags for WM8958 AIF DACs
We need a post notification as we need to shut down the MBC after the
data stops flowing rather than before.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-01 11:46:10 +00:00
Mark Brown 39fb51a123 ASoC: Implement runtime PM for WM8994/58
This allows us to communicate our power management state back to the
parent device, allowing it to do a full power down when the device is
idle.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:14 +00:00
Mark Brown 2e19b0c8c2 ASoC: Enable rbtree compression for WM8994/58 register cache
The WM8994 and WM8958 register map is relatively sparse so benefits
from compression. The rbtree compression gives better results than
LZO for both memory and CPU consumption on a map as sparse as this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:14 +00:00
Mark Brown ca9aef5072 ASoC: Convert WM8994 to use soc-cache.c cache functions
In the process we convert the driver to read registers one at a time
when initialising the cache. This has the effect of working around
limitations in the sizes of I2C transactions which can be done by some
CPUs. Due to the sparseness of the register map the overhead from this
should be minimual unless I2C transactions are very expensive to start.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:14 +00:00
Mark Brown 821edd2fb5 ASoC: Add WM8958 microphone detection support
The WM8958 contains an advanced accessory detection feature which allows
detection of up to seven different impedence levels on the microphone
bias output, including detection of video outputs. Since some of the
more involved accessory interfaces may involve noticable interactions
with external components a simple detection scheme is provided by
default with the option to provide custom handling of accessory detect.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:13 +00:00
Mark Brown d6addcc9d8 ASoC: Add WM8958 Multi-band compressor support
The WM8958 features a multi-band compressor which can be enabled on
any of the AIF inputs. The MBC allows different gains to be applied to
differnt audio bands, providing an improvement in perceived loudness
of the signal by avoiding overdriving the output transducers. This
patch enables support for the MBC.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:13 +00:00
Mark Brown c4431df050 ASoC: Implement support for enhanced AIF3 on WM8958
Additional audio routing options are available on the WM8958 audio
interface 3. Add support for these.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:13 +00:00
Mark Brown 3a42315740 ASoC: Initial WM8958 audio configuration
The WM8958 is a WM8994 derivative. This patch merely ensures that some
revision specific configuration for WM8994 is not enabled on WM8994,
additional patches will add support for the new features introduced on
the WM8958.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-27 10:32:13 +00:00
Mark Brown d50a87402e Merge branch 'for-2.6.37' into for-2.6.38 2010-11-23 14:30:41 +00:00
Axel Lin 24fb2b1174 ASoC: wm8994 - fix memory leaks
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-23 14:30:12 +00:00
Mark Brown cbe80def41 Merge branch 'for-2.6.37' into for-2.6.38 2010-11-22 20:33:12 +00:00
Mark Brown eba19fdd81 ASoC: Restore WM8994 volatile and readable register operations
They went AWOL during the multi-component merge.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-22 20:30:04 +00:00
Jarkko Nikula 505fb824e7 ASoC: Do not include soc-dapm.h
There is no need to include soc-dapm.h since soc.h includes it.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-22 14:04:41 +00:00
Mark Brown 7b306dae22 ASoC: Move WM8994 read/write access data into separate file
Makes the WM8994 driver file itself substantially smaller.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-19 11:44:41 +00:00
Mark Brown 96b101efae ASoC: Provide ADC left/right channel source selection on WM8994
Allow the application to choose if the ADC data presented on the left
and right channels is sourced from the internal left or right channel.
This allows a mono recording to be presented as stereo on the external
bus.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-19 11:17:27 +00:00
Mark Brown 3df94756fe Merge branch 'for-2.6.37' into for-2.6.38 2010-11-17 18:59:19 +00:00
Mark Brown 11e713a07e ASoC: Fix register cache setup WM8994 for multi-component
During the multi-component conversion the WM8994 register cache init
got lost.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-17 18:32:51 +00:00
Liam Girdwood ce6120cca2 ASoC: Decouple DAPM from CODECs
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is
required when developing ASoC further. Such as for other ASoC components to
have DAPM widgets or when extending DAPM to handle cross-device paths.

This patch decouples DAPM related variables from struct snd_soc_codec and
moves them to new struct snd_soc_dapm_context that is used to encapsulate
DAPM context of a device. ASoC core and API of DAPM functions are modified
to use DAPM context instead of codec.

This patch does not change current functionality and a large part of changes
come because of structure and internal API changes.

Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some
minor core changes, codecs and machine driver conversions from
Jarkko Nikula <jhnikula@gmail.com>.

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Cliff Cai <cliff.cai@analog.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: Timur Tabi <timur@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Jassi Brar <jassi.brar@samsung.com>
Cc: Daniel Gloeckner <dg@emlix.com>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-06 11:28:29 -04:00
Mark Brown 7b0f42b59a ASoC: Remove register write trace from WM8994
We now have trace in the ASoC core so we don't need to our own trace in
the driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-03 14:28:53 -04:00
Mark Brown fec6dd833e ASoC: Store DC offset correction for wm_hubs devices in class W mode
Providing the analogue configuration of the output path remains the same
the DC offset corrected by the DC servo will remain identical so we can
skip the callibration, reducing the startup time for the headphone output.
Implement this for the wm_hubs devices as has been done for several other
CODECs.

Don't do this if we have any analogue paths enabled since offsets may be
being introduced by the analogue paths which could vary outside the
control of the driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28 11:34:03 -07:00
Joe Perches c14c05c19f ASoC: Remove unused vol field from WM8994 access mask table
Remove unused vol from struct access_mask

Reduces object size ~3kb.

$ size sound/soc/codecs/wm8994.o*
   text	   data	    bss	    dec	    hex	filename
  40727	   4384	   4480	  49591	   c1b7	sound/soc/codecs/wm8994.o.new
  43879	   4384	   4480	  52743	   ce07	sound/soc/codecs/wm8994.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-10-15 11:54:25 +01:00
Mark Brown 8c7f78b3c3 ASoC: Restore DAI ID specification for WM8994
WM8994 relies on the DAIs having IDs that match the AIF numbers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-13 10:37:29 +01:00
Mark Brown 5ab230a768 ASoC: Fix cut'n'paste comment in WM8994
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-09-06 17:44:07 +01:00
Ian Lartey 3079aed5f5 ASoC: Added a missing 32-bit PCM format, to the wm8994 codec.
Signed-off-by: Ian Lartey <ian@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-09-01 12:45:51 +01:00
Mark Brown f554885f92 ASoC: Implement WM8994 DAC data source muxes
Allow selection of the channel used for input to the AIFnDAC signals.
This isn't integrated into DAPM since we treat the data as a single
mono channel until just beyond this selection so it ends up having
no visible effect on the routing.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-09-01 12:14:44 +01:00
Mark Brown 7d83d21383 ASoC: Log WM8994 separate ADC LRCLKs every time we configure
This makes it that little bit easier to spot the diagnostics in the
logs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-23 13:31:45 +01:00
Mark Brown ec62dbd7eb Merge branch 'for-2.6.36' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into for-2.6.37
Trivial overlap with the removal of the local revision variable.

Conflicts:
	sound/soc/codecs/wm8994.c
2010-08-15 14:56:40 +01:00
Mark Brown b6b056911a ASoC: Only tweak WM8994 chip configuration on devices up to rev D
Any subsequent revisions will have these configuration changes applied
by default.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-13 14:55:13 +01:00
Mark Brown 0c17b39394 ASoC: Optimise DSP performance for WM8994
Change the chip defaults to optimise performance of some of the DSP
functionality.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-13 14:55:01 +01:00
Liam Girdwood f0fba2ad1b ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.

 struct snd_soc_codec    --->  struct snd_soc_codec (device data)
                          +->  struct snd_soc_codec_driver (driver data)

 struct snd_soc_platform --->  struct snd_soc_platform (device data)
                          +->  struct snd_soc_platform_driver (driver data)

 struct snd_soc_dai      --->  struct snd_soc_dai (device data)
                          +->  struct snd_soc_dai_driver (driver data)

 struct snd_soc_device   --->  deleted

This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.

The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.

This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.

Other notable multi-component changes:-

 * Stream operations now de-reference less structures.
 * close_delayed work() now runs on a DAI basis rather than looping all DAIs
   in a card.
 * PM suspend()/resume() operations can now handle N CODECs and Platforms
   per sound card.
 * Added soc_bind_dai_link() to bind the component devices to the sound card.
 * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
   DAI link components.
 * sysfs entries can now be registered per component per card.
 * snd_soc_new_pcms() functionailty rolled into dai_link_probe().
 * snd_soc_register_codec() now does all the codec list and mutex init.

This patch changes the probe() and remove() of the CODEC drivers as follows:-

 o Make CODEC driver a platform driver
 o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
 o Removed all static codec pointers (drivers now support > 1 codec dev)
 o snd_soc_register_pcms() now done by core.
 o snd_soc_register_dai() folded into snd_soc_register_codec().

CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>

Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>

TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>

MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>

i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-12 14:00:00 +01:00
Mark Brown d1ce6b200c ASoC: Unconditionally enable WM8994 AIF1ADC TDM mode
AIF1ADC TDM mode has no effect other than causing the ADCDAT line to
be tristated rather than driven low on clock cycles where there is no
data to be transmitted. If the clock cycle is idle then there should
be no devices using the data so tristating should have no adverse
effects.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-20 10:27:05 +01:00
Mark Brown a3257ba869 ASoC: Implement WM8994 AIF1ADC2 paths
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-20 09:48:25 +01:00
Mark Brown 66b47fdb85 ASoC: Implement WM8994 OPCLK support
The WM8994 can output a clock derived from its internal SYSCLK, called
OPCLK.  The rate can be selected as a sysclk, with a division from the
SYSCLK rate specified (multiplied by 10 since a division of 5.5 is
supported) and the clock can be disabled by specifying a divisor of
zero.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-09 08:50:12 +09:00
Mark Brown e88ff1e6db ASoC: Include WM8994 GPIO and interrupt registers in codec_reg
Very handy for debug.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-09 01:37:06 +09:00
Takashi Iwai d71f4cece4 Merge branch 'topic/asoc' into for-linus
Conflicts:
	sound/soc/codecs/ad1938.c
2010-05-20 12:00:43 +02:00
Mark Brown 6a2f1ee1f9 ASoC: Don't restart unconfigured WM8994 FLLs
If the FLL is not configured attempting to resume it will produce a
warning message so skip the resume.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-05-11 14:18:52 +01:00
Mark Brown fd5722e5cd ASoC: Add register write logging for WM8994
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-05-11 14:18:18 +01:00
Mark Brown 5e5e2bef28 ASoC: Warn on low WM8994 AIFCLK
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-04-26 15:26:13 +01:00
Mark Brown 7add84aa77 ASoC: Allow unspecified source when stopping WM8994 FLLs
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-22 02:29:01 +09:00
Mark Brown ee839a2127 ASoC: Tone down debugging for WM8994 class W
It's a little verbose during path changes.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-21 01:41:28 +09:00
Mark Brown 7d48a6acbc ASoC: Set full range of WM8994 FLL Fratio values
Use all the available Fratio values when configuring the WM8994 FLL, not
just 0 and 3, following more complete characterisation of the device
performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-21 01:41:27 +09:00
Mark Brown 136ff2a272 ASoC: Support FLL input clock selection on WM8994
The WM8994 FLL can be clocked from one of four inputs, the two MCLKs and
the LRCLK and BCLK of the AIF associated with the FLL. Allow all four
inputs to be used rather than defaulting to MCLK1.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-21 01:41:26 +09:00
Mark Brown b2c812e22d ASoC: Add indirection for CODEC private data
One of the features of the multi CODEC work is that it embeds a struct
device in the CODEC to provide diagnostics via a sysfs class rather than
via the device tree, at which point it's much better to use the struct
device private data rather than having two places to store it. Provide
an accessor function to allow this change to be made more easily, and
update all the CODEC drivers are updated.

To ensure use of the accessor the private data structure member is
renamed, meaning that if code developed with older an older core that
still uses private_data is merged it will fail to build.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-04-17 10:46:22 +09:00
Linus Torvalds 84db18bbeb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: mixart: range checking proc file
  ALSA: hda - Fix a wrong array range check in patch_realtek.c
  ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream
  ALSA: hda - Enable amplifiers on Acer Inspire 6530G
  ASoC: Only do WM8994 bias off transition from standby
  ASoC: Don't use DCS_DATAPATH_BUSY for WM hubs devices
  ASoC: Don't do runtime wm_hubs DC servo updates if using offset correction
  ASoC: Support second DC servo readback method for wm_hubs
  ASoC: Avoid wraparound in wm_hubs DC servo correction
  ALSA: echoaudio - Eliminate use after free
  ALSA: i2c: cleanup: change parameter to pointer
  ALSA: hda - Add MSI blacklist for Aopen MZ915-M
  ASoC: OMAP: Fix capture pointer handling for OMAP1510 to work correctly with recent ALSA PCM code
  ALSA: hda - Update document about MSI and interrupts
  ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981
  ALSA: hda - Add missing printk argument in previous patch
  ASoC: Fix passing platform_data to ac97 bus users and fix a leak
  ALSA: hda - Fix ADC/MUX assignment of ALC269 codec
  ALSA: hda - Fix invalid bit values passed to snd_hda_codec_amp_stereo()
  ASoC: wm8994: playback => capture
2010-04-07 08:42:25 -07:00
Mark Brown 53a61d967a Merge branch 'for-2.6.34' into for-2.6.35
Conflicts due to context changes next to the backported DMA data change:
	include/sound/soc.h
2010-04-05 19:19:32 +01:00
Mark Brown 8876698406 ASoC: Implement interrupt based WM8994 microphone detection
Support interrupt based microphone bias detection. The WM8994 has two
microphone bias supplies, with detection supported on both. Detection
using GPIOs together with the standard GPIO based jack framework is
already supported via the platform data for the WM8994 core driver.

Note that as well as the microphone bias itself the system clock and
whichever AIF clock is supplying the system clock will need to be
enabled for detection to function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-05 19:18:12 +01:00
Mark Brown d522ffbfb9 ASoC: Only do WM8994 bias off transition from standby
Otherwise we may try to power down multiple times when the using
idle bias off and the driver is removed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-04-05 16:20:49 +01:00
Mark Brown 8437f7006b ASoC: Support second DC servo readback method for wm_hubs
More recent Wolfson hubs devices add the ability to read back the DC
servo calibration information from the register used to write offsets,
and later still ones remove the old readback registers. Add support
for the new scheme, and use it for WM8994 device revisions that
support it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-04-05 16:19:09 +01:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Mark Brown 2c9504228f Merge branch 'for-2.6.34' into for-2.6.35 2010-03-29 21:03:20 +01:00
Dan Carpenter a8462bde78 ASoC: wm8994: playback => capture
Sparse caught that initialize "playback" two times instead of
initializing "capture".

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-03-24 14:05:28 +00:00
Mark Brown 778a76e2db ASoC: Implement WM8994 DAI tristate support
This also adds the first DAI operation for AIF3 so fill out the ID and
the ops for that too.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-23 10:57:11 +00:00
Joonyoung Shim 07cd8ada1a ASoC: Fix BCLK calculation of WM8994
This fixes BCLK calculation and removes unnecessary check code.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-02-02 11:21:11 +00:00
Mark Brown 9e6e96a197 ASoC: Add WM8994 CODEC driver
The WM8994 is a highly integrated ultra-low power hi-fi audio subsystem
designed for smartphones and other portable devices rich in multimedia
features.  It provides advanced digital mixing facilities enabling low
power high quality interconnection of CPU, baseband and other audio
sources through flexible digital and analogue routing, and integrates
a class W headphone driver and stereo class D speaker drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-02-01 18:37:01 +00:00