History log of /linux-master/sound/soc/codecs/twl4030.c
Revision Date Author Comments
# 67860d2a 18-Oct-2022 Colin Ian King <colin.i.king@gmail.com>

ASoC: twl4030: make read-only array ramp_base static const

Don't populate the read-only array ramp_base on the stack but
instead make it static const. Also makes the object code a
little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20221018152928.942186-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5947b42c 23-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: twl*: Remove now redundant non_legacy_dai_naming flag

The ASoC core has now been changed to default to the non-legacy DAI
naming, as such drivers using the new scheme no longer need to specify
the non_legacy_dai_naming flag.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220623125250.2355471-64-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7adadfb0 16-Jun-2022 Peter Ujfalusi <peter.ujfalusi@gmail.com>

ASoC: twl4030: Drop legacy, non DT boot support

Legacy or non DT boot is no longer possible on systems where the
tw4030/5030 is used.

Drop the support for handling legacy pdata and replace it with a local
board_params struct to allow further cleanups on the mfd side.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220616153521.29701-1-peter.ujfalusi@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7effe2cd 22-Feb-2022 Mark Brown <broonie@kernel.org>

ASoC: twl4030: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the twl4030 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220223003046.1697784-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2b27bdcc 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program if not write to the free
software foundation inc 51 franklin st fifth floor boston ma 02110
1301 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 246 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c68e7f5b 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: twl4030: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8146acff 25-Jan-2018 Tony Lindgren <tony@atomide.com>

ASoC: Fix twl4030 and 6040 regression by adding back read and write

Commit 3bb0f7c31b1a ("ASoC: don't use snd_soc_write/read on twl4030")
caused regressions for both twl4030 and twl6040 as it assumes the
ASoC driver is using regmap. As a side effect, this also causes a
considerable increase in idle power consumption omap3 boards using
twl4030 as the PMIC.

This is because the removal of read and write function pointers
causes some of the ASoC IO functions to not do anything. For example,
snd_soc_register_card() calls snd_soc_dapm_new_widgets() that calls
snd_soc_codec_drv_read() that now does nothing.

A long term solution suggested by Mark Brown <broonie@kernel.org>
is to make the twl drivers use regmap by adding a call to
snd_soc_codec_set_regmap(). This however needs more consideration
as currently the driver internal reads do caching and we would have
both regmap access and internal read/write access accessing the same
hardware registers.

So to fix the regression, let's just do a partial revert adding back
the read and write function pointers. Note that other non-regmap
ASoC drivers may need similar patches.

Fixes: 3bb0f7c31b1a ("ASoC: don't use snd_soc_write/read on twl4030")
Fixes: 93a00c467fe9 ("ASoC: don't use snd_soc_write/read on twl6040")
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3bb0f7c3 13-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: don't use snd_soc_write/read on twl4030

twl4030 doesn't use regmap nor reg_cache. Its write/read are done
through twl4030_reg_write/read. This driver directly calling these
functions, but sometimes using snd_soc_write/read.
As part of cleanup, snd_soc_codec_driver::write, read will be
removed soon. Then, write/read access through snd_soc_write/read
will doesn't work on this driver, since it doesn't use regmap nor
reg_cache.
This patch replace snd_soc_write/read to twl4030_write/read.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2dbb29cd 23-Nov-2017 Markus Elfring <elfring@users.sourceforge.net>

ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 15f8c5f2 12-Nov-2017 Johan Hovold <johan@kernel.org>

ASoC: twl4030: fix child-node lookup

Fix child-node lookup during probe, which ended up searching the whole
device tree depth-first starting at the parent rather than just matching
on its children.

To make things worse, the parent codec node was also prematurely freed,
while the child node was leaked.

Fixes: 2d6d649a2e0f ("ASoC: twl4030: Support for DT booted kernel")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable <stable@vger.kernel.org>


# a2054256 14-Aug-2017 Wolfram Sang <wsa@kernel.org>

mfd: twl: Move header file out of I2C realm

include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# a180ba45 03-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ASoC: codecs: add const to snd_soc_codec_driver structures

Declare snd_soc_codec_driver structures as const as they are only passed
as an argument to the function snd_soc_register_codec. This argument is
of type const, so declare the structures with this property as const.
In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in
a copy operation along with getting passed to snd_soc_register_codec.
So, it can be made const too.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
position p;
@@
static struct snd_soc_codec_driver s@p={...};

@good1@
identifier match.s;
position p;
@@
snd_soc_register_codec(...,&s@p,...)

@bad@
identifier match.s;
position p!={match.p,good1.p};
@@
s@p

@depends on !bad disable optional_qualifier@
identifier match.s;
@@
static
+const
struct snd_soc_codec_driver s={...};

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e4b918ea 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codec duplicated callback function goes to component on twl4030

codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch moves these functions from codec driver to component driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e795d831 18-Oct-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Use snd_pcm_hw_constraint_single()

Use the new snd_pcm_hw_constraint_single() helper function instead of
calling snd_pcm_hw_constraint_minmax() with the same value for min and max
to install a constraint that limits the possible configuration values to a
single value. Using snd_pcm_hw_constraint_single() makes the indented
result clearer and is slightly shorter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2524911e 02-Aug-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE

DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

// <smpl>
@@
declarer name DECLARE_TLV_DB_RANGE;
identifier tlv;
constant x;
@@
-unsigned int tlv[] = {
- TLV_DB_RANGE_HEAD(x),
+DECLARE_TLV_DB_RANGE(tlv,
...
-};
+);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1682c8e5 14-May-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Replace direct snd_soc_codec dapm field access

The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f4bf8d77 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move bias level update to the core

All drivers have the same line at the end of the set_bias_level callback to
update the bias_level state. Move this update into
snd_soc_dapm_force_bias_level() and remove them from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a36ac9b3 14-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Replace w->codec snd_soc_dapm_to_codec(w->dapm)

The codec field of the snd_soc_widget struct is eventually going to be
removed, use snd_soc_dapm_to_codec(w->dapm) instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3ec8d203 26-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Cleanup manual bias level transitions

Since the ASoC core now takes care of setting the bias level to
SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually
anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c756e83d 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

ASoC: codecs: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 04f630d8 30-Jul-2014 Mark Brown <broonie@linaro.org>

ASoC: twl4030: Convert to params_width()

The CODEC doesn't care how data is laid out in memory.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


# bb17bc78 30-Jun-2014 Sachin Kamat <sachin.kamat@samsung.com>

ASoC: twl4030: Remove unused variable

'status' is not used in the function. Remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 04cc41a8 20-Jun-2014 Sachin Kamat <sachin.kamat@samsung.com>

ASoC: twl4030: Remove redundant OOM message

Let memory subsystem handle the error logging.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ea53bf77 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add snd_soc_kcontrol_codec() helper function

For CODEC controls snd_kcontrol_chip() currently returns a pointer to the
CODEC that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_codec() helper function that will hide the implementation
details of how the CODEC for a control can be obtained. This will allow us to
change this easily in the future.

The patch also updates all CODEC drivers to use the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9f04fba7 18-Feb-2014 Takashi Iwai <tiwai@suse.de>

ASoC: twl4030: Use SOC_ENUM_SINGLE_DECL()

Just replace with the helper macro. No functional change at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 6b207c0f 18-Feb-2014 Takashi Iwai <tiwai@suse.de>

ASoC: twl4030: Clean up duplicated code

Remove the open code in snd_soc_put_twl4030_opmode_enum_double() but
just call snd_soc_put_enum_double() instead, which does the very same
thing (even correctly with a lock).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9a8d38db 18-Feb-2014 Takashi Iwai <tiwai@suse.de>

ASoC: Rename soc_enum.max field with items

The name "max" in struct soc_enum is rather confusing since it
actually takes the number of items. With "max", one might try to
assign (nitems - 1) value.

Rename the field to a more appropriate one, "items", which is also
used in struct snd_ctl_elem_info, too.

This patch also rewrites some code like "if (x > e->nitems - 1)" with
"if (x >= e->nitems)". Not only the latter improves the readability,
it also fixes a potential bug when e->items is zero.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b703b504 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Pass the twl4030_priv directly to twl4030_can_write_to_chip()

To avoid another lookup for the twl4030_priv in there.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a450aa6f 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Move the ctl cache update local to twl4030_write() function

There's no other users of this functionality, the code can be moved inside
of twl4030_write.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 7ded5fe0 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Parameter alignment fixes (for code consistency)

Over time the multi line alignment got messed up. Correct them in one go
so the code will look consistent.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# efc8acff 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Remove local reg cache

Depend on the regmap reg cache implementation for register caching done in
the twl-core driver.
The local register cache can be removed and we can keep only shadow copies
of certain ctl registers for pop noise reduction.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8b3bca29 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Introduce local ctl register cache

Few registers need to be cached in the codec driver level. These registers
should only be written when the path is active to avoid pop noise on the
given path.
This patch adds an array which covers the range where the sensitive registers
are located and uppon loadinf the driver the ctl cache will be initialized.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0dc41562 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Remove reset registers functionality

The register states now tracked by the regmap implementation in the core which
makes the reset registers functionality 'redundant' since we know the state
of the registers now all the time.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 7bfbdfea 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Remove check defaults functionality

No need to keep the check defaults functionality anymore.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a8fc415c 03-Jan-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Separate write condition checking from I/O function

Simplifies the code a bit and prepares it to the removal of local caching.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 052901f4 06-Oct-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Use virtual DAPM mixer controls

By using the new virtual DAPM mixer controls it is possible to remove the
twl4030 specific implementation of virtual controls.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0d59ff3a 06-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: twl4030: Remove embedded snd_soc_codec structs from private data structs

It is unused and a leftover of the pre multi-component era.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 09a8b671 11-Jan-2013 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Remove suspend/resume soc driver operations

With idle_bias_off these are no longer needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5712ded9 31-Dec-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Configure extmute pinmux when the dedicated pin is in use

When HS extmute is enabled without custom GPIO we should configure the mux
to allow the pin to be used as extmute signal.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e04d6e55 31-Dec-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Convert MICBIAS to SUPPLY widget

In order to avoid breakage update the machine drivers at the same time using
twl4030: omap3pandora, sdp3430 and zoom2

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 927a7747 31-Dec-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Correct the support for Voice port

In order to be able to use the Voice port of twl4030 three bits need to be
handled in VOICE_IF register:
VIF_EN: to enable the voice port (needed for both playback and capture)
VIF_DIN_EN: Need to be enabled for playback only (input to the codec)
VIF_DOUT_EN: Need to be enabled for capture only (output from codec)

Use DAPM_SUPPLY for the VIF_EN bit and add DAPM_AIF_IO/OUT widget to handle
the playback/capture bit.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 05c4c6f7 07-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ASoC: twl4030: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2d6d649a 10-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Support for DT booted kernel

When the kernel has been booted with DT blob the platform data is NULL for
the driver.
We need to construct the pdata based on the DT information for runtime use.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 182f73f6 10-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Add pointer to pdata within the private data

Access the pdata via a pointer within the twl4030_priv structure.
In preparation for DeviceTree support.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f2b1ce49 10-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Convert to use devm_kzalloc

Allocate the private data with devm_kzalloc.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d0b3847b 10-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC/mfd: twl4030: Remove set_hs_extmute callback from platform data

We no longer have users for the set_hs_extmute callback which has been
replaced by hs_extmute_gpio so the codec driver can handle the external
mute if it is needed by the board.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 281ecd16 10-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Move hs_extmute GPIO handling to driver

The external mute (if it is in use) is handled by a GPIO line. Prepare to
remove the set_hs_extmute callback and replace it with:
hs_extmute_gpio: the GPIO number to use for external mute

When the users of set_hs_extmute has been converted the callback can be removed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7f51e7d3 20-Sep-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Convert to use DAI DAPM widgets

Use DAPM mapping for stream events and give unique names for the streams.
This change also fixes the following warning:
twl4030-codec twl4030-codec: Failed to create Capture debugfs file

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 86767b7d 14-Sep-2012 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Avoid recalculating the bitmask for SOC_ENUM controls

For ENUM controls the bitmask is calculated based on the number of items.
Currently this is done each time the control is accessed. And while the
performance impact of this should be negligible we can easily do better. The
roundup_pow_of_two macro performs the same calculation which is currently done
manually, but it is also possible to use this macro with compile time constants
and so it can be used to initialize static data. So we can use it to initialize
the mask field of a ENUM control during its declaration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e6968a17 04-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: codecs: Remove rtd->codec usage from CODEC drivers

In order to support CODEC<->CODEC links remove the assumption that there
is only a single CODEC on a DAI link by removing the use of the CODEC
pointer in the rtd from the CODEC drivers. They are already being passed
their DAI whenever they are passed an rtd and can get the CODEC from
there.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3b8a0795 21-Feb-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Debug code cleanup

Replace the printk(KERN_ERR* instances with dev_err in the driver.
While we are here clean up some of the debug messages as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1f5ff883 09-Feb-2012 Masanari Iida <standby24x7@gmail.com>

ASoC: Fix typo in twl4030.c

Correct spelling "memroy" to "memory" in
sound/soc/codecs/twl4030.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# eb3032f8 27-Jan-2012 Axel Lin <axel.lin@gmail.com>

ASoC: Set idle_bias_off flag in snd_soc_codec_driver

Since commit 33c5f969 "ASoC: Allow idle_bias_off to be specified in CODEC
drivers", now we can set idle_bias_off flag in struct snd_soc_codec_driver
for devices can unconditionally support idle_bias_off.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8819f65c 17-Jan-2012 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Use core to set the msbits constraint

Core can set the msbits constraint in behalf of the dai.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 84b315ee 02-Dec-2011 Lars-Peter Clausen <lars@metafoo.de>

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>


# 5bbcc3c0 23-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Convert CODEC drivers to module_platform_driver

Factors out a bit of boilerplate.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 85e7652d 23-Nov-2011 Lars-Peter Clausen <lars@metafoo.de>

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>


# f7c93f01 11-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: twl4030: Convert to table based init

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0f9887d1 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: Consolidate use of controls with custom get/put function

Use the macros for controls require custom get/put function.
This is to make sure that the soc_mixer_control is used
consistently among the drivers.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Arun KS <arunks@mistralsolutions.com>
Cc: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4ae6df5e 31-May-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

MFD: twl4030-audio: Rename platform data

Allign the platform data names for twl4030 audio submodule:
twl4030_audio_data: for the core MFD driver
twl4030_codec_data: for ASoC codec driver
twl4030_vibra_data: for the input/ForceFeedback driver

To avoid breakage, change all depending drivers, files
to use the new types.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>


# 57fe7251 30-May-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

MFD: twl4030-codec -> twl4030-audio: Rename the driver

Rename the driver, and header file from twl4030-codec to
twl4030-audio.
To avoid breakage change depending drivers at the same time.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Misael Lopez Cruz <misael.lopez@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>


# a4579ad2 06-Apr-2011 Samuel Ortiz <sameo@linux.intel.com>

mfd: Use mfd cell platform_data for twl4030 codec cells platform bits

With the addition of a platform device mfd_cell pointer, MFD drivers
can go back to passing platform data back to their sub drivers.
This allows for an mfd_cell->mfd_data removal and thus keep the
sub drivers MFD agnostic. This is mostly needed for non MFD aware
sub drivers.

Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 0638d56f 17-Feb-2011 Andres Salomon <dilinger@queued.net>

mfd: mfd_cell is now implicitly available to twl4030 drivers

The cell's platform_data is now accessed with a helper function;
change clients to use that, and remove the now-unused data_size.

Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# dcdeda4a 14-Dec-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix 24bit support

twl4030 series of codecs supports S32_LE with msbits=24.
Replace the S24_LE with S32_LE format, and add constraint
for 24msbit in case of 32 S32_LE format.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 505fb824 21-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

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>


# 5b3b0fa8 19-Nov-2010 Axel Lin <axel.lin@gmail.com>

ASoC: Move kfree(twl4030) to twl4030_soc_remove()

As we allocate memory for twl4030 in twl4030_codec_probe(),
twl4030_codec_remove() is a better place to free the memory.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# ce6120cc 05-Nov-2010 Liam Girdwood <lrg@slimlogic.co.uk>

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>


# 7e6120c5 25-Oct-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Use usleep_range when appropriate

Change the busy loop delays with usleep_range or msleep calls.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# c6d5cca0 14-Sep-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Remove needless codec->bias_level assignment to SND_SOC_BIAS_OFF

This assignment is done by the snd_soc_register_codec so there is no need
to redo it in probe function of a codec driver.

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>


# 5dcba5d6 12-Aug-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: multi-component: TWL4030: Restore registers on removal

Add back the register restore call, when the codec driver is
removed.
This does not affect normal operation, but it is usefull when
debugging audio through the twl4030 class codecs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# f0fba2ad 17-Mar-2010 Liam Girdwood <lrg@slimlogic.co.uk>

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>


# bda7d2a8 02-Aug-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Capture route runtime DAPM ordering fix

Fix the ordering problem in DAPM domain, when the user
changes between digital and analog sources during active
capture (or loopback) scenario.
Before this patch, when the user changed from analog source
to digital there were a short time, when the codec enabled
analog mic bias (2.2 volts) instead of the correct digital
mic bias (1.8 volts) to the digital microphones.
This behaviour caused by the former implementation of
selecting the correct type of bias. This was done at the
POST_REG event of the DAPM_MUX_E("TXx Capture Route")
widget.
By moving the bias type selection as DAPM_SUPPLY and
connecting it to the corresponding digimic widget the
problematic situation can be avoided.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# b93cc9f1 26-Jul-2010 Peter Ujfalusi <peter.ujfalusi@Nokia.com>

ASoC: TWL4030: Capture route DAPM event fix

There is no need to handle POST_PMU, POST_PMD event with
the Capture Route widget.
It is enough to handle POST_REG event, since that will come
when the user changes the routing, and we will switch the needed
bits in the registers.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 01ea6ba2 20-Jul-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add configurable delay after digimic enable

When digital microphones are connected to twl, delay is
needed after enabling the digimic interface of the codec.
Add new parameter for the setup data, which can be used
to pass the apropriate delay in ms after the digimic
interface has been enabled.

Without certain delay (in certain HW configuration) the
beggining of the recorded sample contains a glitch, which
is generated by the digital microphones.

Delaying the micbias1, 2 (which is the bias for the digimic0
or 1) does not help, since the glitch is coming after
switching the digimic interface.

Reversing the micbias and digimic enable order does not
work either (in that case the wait need to be added after
the micbias enabled).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 27eeb1fe 12-Jul-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAC power optimization

Restructure the DAPM connections in order to enable
only the needed DAC (out of four in twl4030 series).
I need to keep the 'AIF Enable' supply connected to
the L2/R2 digital path, since the digital loopback
needs AIF and APLL running.
If no valid route available, than none of the DAC will
be powered, but the AIF and APLL is going to be enabled.
Furthermore, if only one audio path have valid route,
than only the corresponding DAC will be powered.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsomicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 8b0d3153 12-Jul-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix for digital loopback gain range

When the gain is configured using dB value it was
not possible to use -24dB since the loopback got
muted instead of -24dB.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsomicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# a3a29b55 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add functionalty to reset the registers

Machine driver can instruct the codec driver to reset the
chip registers to their default values at probe time.

If machine driver does not provide setup data, then the
registers are going to be reseted to their defaults, to
be safe.

If the developer on the platform confirms that the register
reset is not needed, than it can be skipped, saving ~20ms
time in probe.

As safety measure do the register reset at remove time also.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 2046f175 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Use BIAS_OFF instead of BIAS_STANDBY, when not in use

Restructure the codec power code in order to be able to hit
off when the codec is not in use.

Since the audio registers are accessible while the codec is powered
down, there is no need for additional safety mechanism.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 3c36cc68 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Correct the ARXR2_APGA_CTL chip default

It seams at least on twl5031 that the ARXR2_APGA_CTL register
does not have the same default value as it is written in
the TRM.
Since the codec part of the PM chip has not been actually
changed according to TI, assuming, that all version has
the same problem, so writing there the TRM value.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 9fdcc0f7 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Helper to check chip default registers

Since the twl4030 codec driver supports different version
of the PM chip, a helper function can come handy, which
can check the driver's default versus the chip values.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# ee4ccac7 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Optimize the power up sequence

Since the reg cache now contains the chip default values
for all registers (REG_OPTION is reset to it's default
within this patch), there is no longer need to rewrite
_all_ registers.
Initialize only few selected registers.

According to the latest information, the offset cancellation
need to be done only once, when the codec is powered on, so
there is no need for the power up wrapper.

Move all chip initialization code under chip_init, and do
it when the codec is initialized.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 979bb1f4 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Make offset cancellation path configurable

Add means for machine drivers to select the path for offset
cancellation.
Reset the reg cache value to the chip reset value at the
same time.

Machine drivers can specify which path need to be used for
offset cancellation via the twl4030_setup.offset_cncl_path.
For paths use the defines from
include/linux/mfd/twl4030-codec.h:
TWL4030_OFFSET_CNCL_SEL_*

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# cbd2db12 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Remove wrapper for power down

There is no need for the power down wrapper.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 33f92ed4 26-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Revisit codec defaults

Reset most of the codec registers to their chip reset
value.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 36aeff61 12-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add control for digimic Left Right swap

The codec has support for swapping the left and right
channels in the digimic interface.
New kcontrol to handle this bit.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 29e189c2 07-May-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove unneeded suspend bias managment from CODEC drivers

The core will ensure that the device is in either STANDBY or OFF bias
before suspending, restoring the bias in the driver is unneeded. Some
drivers doing slightly more roundabout things have been left alone
for now.

Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1b7c9afb 29-Apr-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Remove OUTL/R outputs

OUTL/R are leftovers from the original driver, and they
are no longer needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 7b4c734e 29-Apr-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: AIF/APLL fix in DAPM domain

This patch orders the APLL and AIF power sequence in
case of HiFi (audio in TWL4030 terms) playback/capture.

We also need to make sure that the AIF is running during
playback/capture, when there is no valid DAPM route
available. For this purpose I introduce these virtual
widgets:
/* To have complete playback route all the time */
DAPM_OUTPUT("Virtual HiFi OUT") /* Will keep AIF/APLL enabled */

/* To have complete capture route all the time */
DAPM_INPUT("Virtual HiFi IN") /* Will keep AIF/APLL enabled */

/* To have complete playback route for the voice module */
DAPM_OUTPUT("Virtual Voice OUT") /* Will keep APLL enabled */

The DAPM_SUPPLY widgets for APLL and AIF are placed in a way,
that during any audio activity the needed configuration of AIF
and APLL will be enabled (playback, capture, analog loopback,
digital loopback, and voice activity).

The apll reference counting code has been lifted,
and modified from Liam Girdwood's earlier patch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# d4a8ca24 20-Apr-2010 Takashi Iwai <tiwai@suse.de>

ASoC: missing conversions to snd_soc_codec_*_drvdata()

Conversions to snd_soc_codec_{get|set}_drvdata() were missing in some files
in the previous commit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b2c812e2 14-Apr-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

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>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

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>


# c96907f2 22-Mar-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: PM fix for output amplifiers

Gain controls on outputs affect the power consumption
when the gain is set to non 0 value.

Outputs with amps have one register to configure the
routing and the gain:
PREDL_CTL (0x25):
bit 0: Voice enable
bit 1: Audio L1 enable
bit 2: Audio L2 enable
bit 3: Audio R2 enable
bit 4-5: Gain (0x0 - power down, 0x1 - 6dB, 0x2 - 0dB, 0x3 - -6dB)

bit 0 - 3: is handled in DAPM domain (DAPM_MIXER)
bit 4 - 5: has simple volume control

If there is no audio activity (BIAS_STANDBY), and
user changes the volume, than the output amplifier will
be enabled.
If the user changes the routing (but the codec remains in
BIAS_STANDBY), than the cached gain value also be written
to the register, which enables the amplifier.

The existing workaround for this is to have virtual
PGAs associated with the outputs, and whit DAPM PMD
the gain on the output will be forced to 0 (off) by
bypassing the regcache.
This failed to disable the amplifiers in several
scenario (as mentioned above).

Also if the codec is in BIAS_ON state, and user modifies
a volume control, which path is actually not enabled, than
that amplifier will be enabled as well, but it will
be not turned off, since there is no DAPM path, which
would make mute it.

To prevent amps being enabled, when they are not
needed, introduce the following workaround:
Track the state of each of this type of output.
In twl4030_write only allow actual write, when the
given output is enabled, otherwise only update
the reg_cache.
The PGA event handlers on power up will write the cached
value to the chip (restoring gain, routing selection).
On power down 0 is written to the register (disabling
the amp, and also just in case clearing the routing).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e47c796d 17-Feb-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Use codec defaults for Headset initial configuration

Disable the amplifiers for the headset outputs, and do not select
routings by default to the headset outputs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c42a59ea 09-Feb-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add supply for audio serial interface control

The serial interface (TDM/I2S) for the audio block have been
constantly enabled.
Introduce a new DAPM_SUPPLY for handling the AIF_EN bit, so
the interface is only enabled, when there is a need for it.
For example when only the analog loopback is enabled, there
is no need to keep the serial interface active.

I have added the persons who contributed to the Voice path
of twl4030 codec driver, so they might have the ability
to test this patch, and send an update for the Voice path,
if it is necessary

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cb67286d 04-Feb-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Module unloading fix

The module unloading path had several problems:
- it freed up the private structure twice
- it freed up the codec structure, which was allocated as part
of the private structure
- it did not freed up the reg_cache
- it did not unregistered the dais and the codec

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c8124593 28-Jan-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Modify codec default settings

Change the legacy default register configuration, which left some
internal components on.
Now we have either DAPM, or other ways to control these bits,
so there is no need to enable them by default.

The affected parts:
Disable ADCL and ADCR
Disable ARXL2 and ARXR2 analog PGA (playback)
Disable APLL by default

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# fd63df22 12-Jan-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Replace comma with semicolon in probe function

The codec structure initialization statements should be
separated by semicolons.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# fc7b92fc 13-Dec-2009 Balaji T K <balajitk@ti.com>

mfd: Rename all twl4030_i2c*

This patch renames function names like twl4030_i2c_write_u8,
twl4030_i2c_read_u8 to twl_i2c_write_u8, twl_i2c_read_u8
and also common variable in twl-core.c

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# b07682b6 13-Dec-2009 Santosh Shilimkar <santosh.shilimkar@ti.com>

mfd: Rename twl4030* driver files to enable re-use

The upcoming TWL6030 is companion chip for OMAP4 like the current TWL4030
for OMAP3. The common modules like RTC, Regulator creates opportunity
to re-use the most of the code from twl4030.

This patch renames few common drivers twl4030* files to twl* to enable
the code re-use.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 0a3f5e35 12-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove redundant snd_soc_dapm_new_widgets() calls

The DAPM widgets are now insntantiated by the core when creating the card
so there is no need for the individual CODEC drivers to do so.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 68d01955 04-Nov-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Do not modify the APLL_CTL register

APLL_CTL register is configured by the twl4030-codec MFD
driver.
Remove code, which makes changes in the APLL_CTL register,
and replace those with checks against the configured
audio_mclk configuration done in the MFD driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# fe3e78e0 03-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Factor out snd_soc_init_card()

snd_soc_init_card() is always called as the last part of the CODEC probe
function so we can factor it out into the core card setup rather than
have each CODEC replicate the code to do the initialiastation. This will
be required to support multiple CODECs per card.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b3f5a272 02-Nov-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Make sure, that the codec is powered on startup

Set the codec->bias_level to SND_SOC_BIAS_OFF before changing
the initial bias level to STANDBY.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1c3d2002 29-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add APLL supply for the capture path

Capture path also need the APLL enabled, adding DAPM_SUPPLY
for the Virtual ADCs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7729cf74 29-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change APLL powering sequence

It seams that certain part of the twl4030 codec needs the APLL
enabled before they are enabled.
Paths which has any digital processing needs need the APLL
enabled before they can function.
For example the vibra output will have some random data after
it is enabled and before the APLL also enabled.

If only analog components are in use (analog bypass), than it
seams, that the APLL does not need to be enabled. This lowers
the power consumption with around ~0.005A.

Adding DAPM_SUPPLY to the Digital playback route and also
to the capture route to enable and disable the APLL.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 86139a13 29-Oct-2009 Jari Vanhala <ext-jari.vanhala@nokia.com>

ASoC: TWL4030: Vibra motor stop fix when it is driven with audio

This patch fixes vibrator playing incoherently, when driven
with audio. There is something wrong in switch 3 at
H-bridge and VIBRA_SET still affects PWM generator.
Slowest value fixes things.

Signed-off-by: Jari Vanhala <ext-jari.vanhala@nokia.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2845fa13 28-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change codec_muted to apll_enabled

codec_muted is missleading, change it to apll_enabled,
which is what it is doing: enabing and disabling the APLL.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 78e08e2f 28-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Remove bypass tracking

Since ASoC core now handling the codec bias differently
there is no need to do the tracking of bypass switch states
anymore.

Handling of the common bit for analog loopbacks is done with
DAPM_SUPPLY for the bypass paths.

Now this bit is only enabled when there is a complete analog
bypass path, compared to the previous implementation, when the
global switch was enabled if there were any of the analog
bypass switch was on (regardless if there were complete path or
not)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7a1fecf5 22-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Driver registration via twl4030_codec MFD

Change the way how the twl4030 soc codec driver is
loaded/probed.
Use the device probing via tlw4030_codec MFD device.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d8707cec 19-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk

Do not rewrite the whole register, but only update the needed
bits in set_dai_sysclk functions.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 9028935d 13-Aug-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix for capture mixer strings

Change the strings related to capture in order to be
interpreted correctly by alsamixer and possible other
UI based mixer applications.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 9008adf9 13-Aug-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Introduce PGAs for outputs

Dynamically control and control only the needed output amplifier
muting/un-muting.

The original code was muting and un-muting the following output
amplifiers: Earpiece PreDrivL/R, CarkitL/R at the same time
regardless which pin is actually in use at the given moment.

Move these as separate PGA so only the needed amplifier will be touched.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 68140443 03-Jul-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Add tristate callbacks for HiFi and Voice

Add "set_tristate" callbacks for HiFi and Voice DAIs.
Machine drivers can enable and disable tristate for each
DAI with "snd_soc_dai_set_tristate" function.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4e49ffd1 01-Jul-2009 Candelaria Villareal, Jorge <x0107209@ti.com>

ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect

According to TRM, an external FET controlled by a 1.8V output signal
can be used to reduce the pop-noise heard when the audio amplifier is
switched on. It is suggested that GPIO6 of TWL4030 be used, but any
other gpio can be used instead. This is indicated in machine driver
with the following twl4030_setup_data members:

-hs_extmute. Set to 1 if board has support for EXTMUTE.

-set_hs_extmute. Set to a callback funcion to control an external gpio
line. Set to NULL if MUTE[GPIO6] pin is used.

Codec driver takes care of enabling and disabling this output during
the headset pop attenuation sequence.

Also add a delay to let VMID settle in ramp up sequence.

Signed-off-by: Jorge Eduardo Candelaria <x0107209@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e3c7dbb0 24-Jun-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: Remove word "Switch" from Handsfree switch name

SoC dapm adds the suffix "Switch" to SND_SOC_DAPM_SWITCH controls,
removing word "Switch" from HandsfreeL/HandsfreeR widget name
for avoiding to duplicate it.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 30808ca7 22-Jun-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Correct bypass event for voice sidetone

Event for voice sidetone was being interpreted as an
analog HiFi bypass event because VSTPGA register offset
is less than ARXR2_APGA_CTL offset. Reordering the
register checks allows to handle voice digital bypass
event properly.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 328d0a13 22-Jun-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Add AVADC Clock Priority

AVDAC clk priority allows to determine the path ADC must
be connected when the codec is in option2 and both HiFi
and Voice paths are enabled.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c264301c 19-Jun-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Fix voice interface clock masters

Voice interface of twl4030 codec supports: CBM_CFM and
CBS_CFS. It doesn't support CBS_CFM.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-By: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 423c238d 20-Jun-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Staticise put_twl4030_opmode_enum_double()

It's an operation for a control and doesn't need to be exported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b53109db 20-Jun-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Fix shadowed variables in twl4030

No need to define second copies of mode and format, they're declared
with exactly the same type at the head of the function and there's no
conflict in their use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d08664fd 04-Jun-2009 Takashi Iwai <tiwai@suse.de>

ASoC: Fix build error in twl4030.c

Fix the (likely cut-n-paste) error by commit
16a30fbb0d3aa4ee829a2dd3d0e314e2b5ae96a9, which causes the error below:
sound/soc/codecs/twl4030.c: In function 'twl4030_read_reg_cache':
sound/soc/codecs/twl4030.c:152: error: 'cache' undeclared (first use in this function)

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eaf1ac8b 01-Jun-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Check the interface format for 4 channel mode

In addition to the operating mode check, also check the
codec's interface format in case of four channel mode.
If the codec is not in TDM (DSP_A) mode, return with error.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 16a30fbb 29-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Use reg_cache in twl4030_init_chip

Use the codec->reg_cache instead of the array directly
in twl4030_init_chip for setting the default values.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0f89bdca 25-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: HandsfreeL/R mute DAPM switch

Add DAPM switch for HeadsetL/R mute. Since all bits are are needed
for the HFL/R pop removal to work the switch is using the SW_SHADOW
no HW register for the HandsfreeL/R mute.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f3b5d300 25-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add shadow register

Shadow, non HW register for dealing with the HandsfreeL/R
muting.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5a2e9a48 25-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Handsfree pop removal redesign

Move the HandsfreeL/R (IHFL/R) pop removal code from the DAPM_MUX_E
to a more appropriate DAPM_PGA_E widget.
Also fix the power-up sequence to match with the TRM.
The power-down sequence is not described in the TRM, so do it
in a way, which seams like the correct sequence.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b4852b79 22-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Differentiate the playback streams

Give unique stream names for the two playback streams so
DAPM can figure out which codec_dai is in use.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 9da28c7b 22-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add support for platform dependent configuration

twl4030_setup_data structure can be passed from platform drivers to
the codec via the snd_soc_device->codec_data pointer.

Currently the setup data has support for the Headset pop-removal
related configuration, which differs from board to board.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6943c92e 18-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Move the Headset pop-attenuation code to PGA event

This patch adds SND_SOC_DAPM_PGA_E to the headset path, which handles
the headset ramp up and down sequences needed for the pop noise
removal.

With this patch the order of the internal components in the twl4030
codec is turned on and off in a correct order.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Tested-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
Tested-by: Misael Lopez Cruz <x0052729@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4005d39a 18-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change DAPM routings and controls for DACs and PGAs

Restructuring the twl4030 codec's DAPM routing to be able to handle the power
sequences correctly.

The twl4030 codec internal implementation have this order:
DAC -> Analog PGA -> Mixer/Mux

While the ASoC framework expects the following order:
DAC -> Mixer -> Analog PGA

This patch moves the Analog PGA handling from SND_SOC_DAPM_PGA to _MIXER and
adds two levels of mixer to handle the digital and analog loopback
functionality.

Now the analog loopback does not powers on any of the DACs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Tested-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
Tested-by: Misael Lopez Cruz <x0052729@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b74bd40f 18-May-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Add control for selecting codec operation mode

Add a control for selecting the codec operation mode. TWL4030 codec
has two modes:
- Option 1. Audio only (4 audio DACs)
- Option 2. Voice/Audio (2 audio DACs and voice ADC/DAC)

Control is restricted when a stream is ongoing, since codec's
operation mode cannot be changed on-the-fly.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujflausi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 181da78c 19-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix Analog capture path for AUXR

AUXR is selected by bit 2 and not by bit 1 in the ANAMICR register.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b7a755a8 17-May-2009 Misael Lopez Cruz <x0052729@ti.com>

ASoC: TWL4030: Enable/disable voice digital filters

Enable TWL4030 VTXL/VTXR and VRX digital filters for uplink
and downlink paths, respectively.

This patch also corrects voice 8/16kHz mode selection bit
(SEL_16K) of CODEC_MODE register.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 97b8096d 11-May-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: TWL4030: change DAPM for analog microphone selection

The inputs of the twl4030 codec can be mixed, so we will use the mixer
DAPM for the analog microphone registers(0x05, 0x06), but if we enable
more than one input at the same time, the input impedance of the input
amplifier will be reduced.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c198d811 07-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix typo in twl4030_codec_mute function

Copy-paste error: TWL4030_PRECKL_GAIN >> TWL4030_PRECKR_GAIN
It has not caused problems, since
TWL4030_PRECKL_GAIN == TWL4030_PRECKR_GAIN == 0x30

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 376f7839 04-May-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add VIBRA output

This patch adds support for the VIBRA output on TWL4030 codec.
The VIBRA output can be driven with audio data or with
local vibrator driver.
Add the needed DAPM elements and routes for the VIBRA output and
controls for the VIBRA driver configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ee8f6894 30-Apr-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Add voice digital loopback: sidetone

This patch add voice digital loopback (sidetone) to the twl4030
driver. It mixes voice uplink attenuated (by sidetone gain) with
voice downlink when the codec is working in option2 (voice/audio
mode).

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# fcd274a3 30-Apr-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: TWL4030: Add VDL analog bypass

This patch adds voice downlink analog bypass switch. It follows
the same approach as in other analog bypass switches.
DAC switch is moved from 'DAC Voice' to 'Analog Voice Playback Mixer',
that will also allow voice DAC to be powered in digital voice
loopback (sidetone).

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 18cc8d8d 28-Apr-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: TWL4030: Fix gain control for earpiece amplifier

The gain control for earpiece amplifier uses 0dB ~ 12dB according to the
TRM, but the present code is implemented to -6dB ~ 6dB.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8a1f936a 23-Apr-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add 4 channel TDM support

Support for 4 channel TDM (SND_SOC_DAIFMT_DSP_A) for twl4030
codec.
The channel allocations are:
Playback:
TDM i2s TWL RX
Channel 1 Left SDRL2
Channel 3 Right SDRR2
Channel 2 -- SDRL1
Channel 4 -- SDRR1

Capture:
TDM i2s TWL TX
Channel 1 Left TXL1
Channel 3 Right TXR1
Channel 2 -- TXL2
Channel 4 -- TXR2

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1a787e7a 21-Apr-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: TWL4030: Add VDL path support

Add DAPMs for VDL(Voice Down Link) path. To support VDL path, we have
to change DAPMs of outputs(Earpiece, PreDrive Left/Right, Headset
Left/Right, Carkit Left/Right) from mux to mixer.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7154b3e8 20-Apr-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: TWL4030: Add support Voice DAI

Add Voice DAI to support the PCM voice interface of the twl4030 codec.

The PCM voice interface can be used with 8-kHz(voice narrowband) or
16-kHz(voice wideband) sampling rates, and 16bits, and mono RX and mono
TX or stereo TX.

The PCM voice interface has two modes
- PCM mode1 : This uses the normal FS polarity and the rising edge of
the clock signal.
- PCM mode2 : This uses the FS polarity inverted and the falling edge
of the clock signal.

If the system master clock is not 26MHz or the twl4030 codec mode is not
option2, the voice PCM interface is not available.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6b87a91f 17-Apr-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Fix for the constraint handling

The original implementation of the constraints were good against sane
applications.
If the opening sequence is:
stream1_open, stream1_hw_params, stream2_open, stream2_hw_params -> the
constraints are set correctly for stream2.

But if the sequence is:
stream1_open, stream2_open, stream2_hw_params, stream1_hw_params -> than stream2
would receive constraint rate = 0, sample_bits = 0, since the stream1 has not
yet called hw_params...

The command to trigger this event:
gst-launch-0.10 alsasrc device=hw:0 ! alsasink device=hw:0 sync=false

This patch does some 'black magic' in order to always set the correct
constraints and sets it only when it is needed for the other stream.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d6648da1 07-Apr-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Compillation error fix

Fix for compillation error introduced by the constrain patch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 103f211d 03-Apr-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add actual support for 96KHz playback support

Adds the needed code to be able to use 96KHz playback.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7220b9f4 27-Mar-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add constrains for second stream

In case of duplex mode (capture and playback at the same time), the second
stream has to have the same parameters (rate, sample size) as the already
running stream.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 31ad0f31 27-Mar-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: 96KHz playback support

TWL4030 supports 96KHz sample playback, but only playback.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 10d9e3d9 16-Mar-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: twl4030 - Fix build error

CC sound/soc/codecs/twl4030.o
sound/soc/codecs/twl4030.c:1400: warning: braces around scalar initializer
sound/soc/codecs/twl4030.c:1400: warning: (near initialization for 'twl4030_dai.ops')
sound/soc/codecs/twl4030.c:1401: error: field name not in record or union initializer
sound/soc/codecs/twl4030.c:1401: error: (near initialization for 'twl4030_dai.ops')
sound/soc/codecs/twl4030.c:1401: warning: initialization from incompatible pointer type
sound/soc/codecs/twl4030.c:1402: error: field name not in record or union initializer
sound/soc/codecs/twl4030.c:1402: error: (near initialization for 'twl4030_dai.ops')
sound/soc/codecs/twl4030.c:1402: warning: excess elements in scalar initializer
sound/soc/codecs/twl4030.c:1402: warning: (near initialization for 'twl4030_dai.ops')
sound/soc/codecs/twl4030.c:1403: error: field name not in record or union initializer
sound/soc/codecs/twl4030.c:1403: error: (near initialization for 'twl4030_dai.ops')
sound/soc/codecs/twl4030.c:1403: warning: excess elements in scalar initializer
sound/soc/codecs/twl4030.c:1403: warning: (near initialization for 'twl4030_dai.ops')

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 89492be8 04-Mar-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Make the HS ramp delay configurable

Enum type for selecting the desired ramp delay for the headset output.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6bab83fd 18-Feb-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add digital loopback support

This patch adds the digital loopback/bypass support for twl4030 codec.

The digital loopback will let the digimic0 (routed in the TX1 capture path
inside of TWL4030) data to be routed back to the RX2 playback path
(I2S stereo). It can also route the analog capture date routed through the
TX1 back to RX2.

Effectively the digital loopback is routing the audio from the TX1 capture path
to the RX2 playback path.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7393958f 29-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add analog loopback support

This patch adds the analog loopback/bypass support for twl4030 codec.

Details for the implementation:
It seams that the analog loopback needs the DAC powered on on the channel,
where the loopback is selected. The switch for the DACs has been moved from
the DAPM_DAC to the "Analog XX Playback Mixer". In this way the DAC will be
powered while the audio playback is used or/and the loopback is enabled for
the channel.

The twl4030 codec powering has been reworked. Now the codec will be powered as
long as it does not receives the SND_SOC_BIAS_OFF event. The exceptions are
when the given change in the registers needs the codec power down/up cycle in
order to take effect. Otherwise the codec is on.

When the codec enters to STANDBY state and none of the loopback paths are
enabled, than the amplifiers, which are no in the DAPM path are forced to turn
off and the PLL is disabled. When playback/capture starts the disabled gains
are restored and the PLL is enabled.

When one of the loopback enabled in STANDBY mode, the disabled gains are
restored and the PLL is enabled also.

In short: the codec always goes to the lowest power state based on the
bias_level and the bypass_state.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 006f367e 27-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Move the twl4030_power_up and _power_down function

Move the twl4030_power_up and twl4030_power_down function
earlier to facilitate the analog bypass implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# fb2a2f84 27-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Physical ADC and amplifier power switch change

Change the power switches for the physical ADC and for the
amplifiers for the analog capture path to map more closely
the actual path inside of the codec.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# aad749e5 27-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Enable Headset Left anti-pop/bias ramp only if the Headset Left is in use

The Headset Left anti-pop and bias ramp does not need to be
enabled, if the headset is not in use.
Move the code to DAPM event handler for HeadsetL.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# db04e2c5 27-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Code clean up for codec power up and down

Merge the codec up and down functions to a simple one.
Codec is powered down by default (reg_cache change).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3fc93030 27-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Syncronize the reg_cache for ANAMICL after the offset cancelation

The offset cancelation bit in ANAMICL register is self cleanig.
Make sure that the reg_cache holds the same value as the HW
register.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6627a653 23-Jan-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push the codec runtime storage into the card structure

This is a further stage on the road to refactoring away the ASoC
platform device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 91432e97 17-Jan-2009 Ian Molton <ian@mnementh.co.uk>

ASoC: fixes to caching implementations

This patch takes fixes a number of bugs in the caching code used by
several ASoC codec drivers. Mostly off-by-one fixes.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c6d1662b 08-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Module unloading fix

Call the snd_soc_free_pcm and snd_soc_dapm_free when the
codec driver is unloaded.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3e8e1952 08-Jan-2009 Ian Molton <ian@mnementh.co.uk>

ASoC: cleanup duplicated code.

Many codec drivers were implementing cookie-cutter copies of the function
that adds kcontrols to the codec.

This patch moves this code to a common function snd_soc_add_controls() in
soc-core.c and updates all drivers using copies of this function to use the
new common version.

[Edited to raise priority of error log message and document parameters.
-- broonie]

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cb1ace04 08-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change the soc_value_enum back to soc_enum

The soc_value_enum has been merged to soc_enum.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2f423577 05-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Convert the bitfield enums to VALUE_ENUM type

Convert the bitfield coded enums to the new VALUE_ENUM type.
Remove the enum check, since the VALUE_ENUM type can handle
the bitfield coding and also handles the 'holes' in the bitfield.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 276c6222 31-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM based capture implementation

This patch adds DAPM implementaion for the capture path
on twlx030.

TWL has two physical ADC and two digital microphone (stereo) connections.
The CPU interface has four microphone channels.
For simplicity the microphone channel paths are named as:
TX1 (Left/Right) - when using i2s mode, only the TX1 data is valid
TX2 (Left/Right)

Input routing (simplified version):
There is two levels of mux settings for TWL in input path:
Analog input mux:
ADCL <- {Off, Main mic, Headset mic, AUXL, Carkit mic}
ADCR <- {Off, Sub mic, AUXR}

Analog/Digital mux:
TX1 Analog mode:
TX1L <- ADCL
TX1R <- ADCR
TX1 Digital mode:
TX1L <- Digimic0 (Left)
TX1R <- Digimic0 (Right)

TX2 Analog mode:
TX2L <- ADCL
TX2R <- ADCR
TX2 Digital mode:
TX2L <- Digimic1 (Left)
TX2R <- Digimic1 (Right)

The patch provides the following user controls for the capture path:
Mux settings:
"TX1 Capture Route": {Analog, Digimic0}
"TX2 Capture Route": {Analog, Digimic1}
"Analog Left Capture Route": {Off, Main Mic, Headset Mic, AUXL, Carkit Mic}
"Analog Right Capture Route": {Off, Sub Mic, AUXR}

Volume/Gain controls:
"TX1 Digital Capture Volume": Stereo gain control for TX1 path
"TX2 Digital Capture Volume": Stereo gain control for TX2 path
"Analog Capture Volume": Stereo gain control for the analog path only

Important things for the board files:
Microphone bias:
"Mic Bias 1": Bias for Main mic or for digimic0 (analog or digital path)
"Mic Bias 2": Bias for Sub mic or for digimic1 (analog or digital path)
"Headset Mic Bias": Bias for Headset mic

When the routing configured correctly only the needed components will be
powered/enabled.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f9a3fba2 31-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Make the enum filter generic for twl4030

Modify the enum filter to more generic that it will filter
out the enums with text "Invalid".
The enum filter also required for the capture path.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 49d92c7d 11-Dec-2008 Stanley.Miao <stanley.miao@windriver.com>

ASoC: TWL4030: hands-free start-up sequence.

A special start-up sequence is required to reduce the pop-noise of Class D
amplifier when enable hands-free on TWL4030.

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1e5fa31f 09-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change the name for the DACs

To avoid confusion the names for the DACs changed:
DACL1 -> DAC Left1
...

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d4a73131 09-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Small cleanup

The mux switch related texts fits to on line, no need to wrap
them.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6a1bee4a 09-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add missing Carkit output

SND_SOC_DAPM_OUTPUT definition for carkitL/R was missing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 24e07db8 09-Dec-2008 Takashi Iwai <tiwai@suse.de>

ALSA: ASoC - Fix module init entry for twl4030.c

Fixed the function name of module init entry for twl4030.c, which
conflicted with the existing hardware init function:
sound/soc/codecs/twl4030.c:1278: error: conflicting types for 'twl4030_init'
sound/soc/codecs/twl4030.c:1187: error: previous definition of 'twl4030_init' was here

Also fixed the section type of init function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 64089b84 08-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Register non-AC97 codec DAIs

Currently this is done at module probe time since ASoC ties in codec
device probe to the instantiation of the entire ASoC device. Subsequent
patches will refactor the codec drivers to handle probing separately.
Note that the core does not yet use this information.

AC97 is special since the codec is controlled over the AC97 link but
we want to give the machine driver a chance to set up the system before
trying to instantiate since it may need to do configuration before the
AC97 link will operate

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ca4513fe 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Do not alter the Headset output volume on power-up/down

There is a separate gain control for the Headset output already.
Do not reset the gain to 0 dB at power up.
In power-down, there is no need to set the Headset output gain
to power-down mode, since if the CODECPDZ is in powered off this
setting has no effect.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# df339804 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM mapping of the Handsfree outputs

Adds DAPM muxing, routing for the Handsfree outputs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5152d8c2 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM mapping of the Carkit outputs

Adds DAPM muxing, routing for the Carkit outputs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# dfad21a2 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM mapping of the Headset outputs

Adds DAPM muxing, routing for the Headset outputs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2a6f5c58 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM mapping of the PreDriv outputs

Adds DAPM muxing, routing for the PreDrive outputs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5e98a464 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: DAPM mapping of the Earpiece output

Adds DAPM muxing, routing for the Earpiece output.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e8ff9c41 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add DAPM event handler for output MUX selection

DAPM event handler is set to filter out invalid MUX settings
for certain outputs.
Earpiece:
- 0 = Off
- 1 = DACL1
- 2 = DACL2
- 3 = *** Invalid ***
- 4 = DACR1

PreDriveL/R:
- 0 = Off/Off
- 1 = DACL1/DACR1
- 2 = DACL2/DACR2
- 3 = *** Invalid/Invalid ***
- 4 = DACR2/DACL2

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 44c55870 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add Analog PGA control switch to DAPM

Add all four APGA switch to DAPM routing and widgets.
Add user control for DA enable for all APGA as normal
control.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 53b5047d 08-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Correct DAPM_DAC with power control

Add all four DACs to dapm_widgets with power switch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5920b453 02-Dec-2008 Grazvydas Ignotas <notasas@gmail.com>

ASoC: TWL4030: Add input selection and gain controls

The TWL4030 codec device has two ADCs. Both of them can have
several inputs routed to them, but TRM says that only one source
can be selected for every ADC, even though every source has a
dedicated bit in the registers.

This patch adds input source controls. It modifies default register
values to have no inputs selected and ADCs disabled. When some
input is selected, control handlers enable apropriate input
amplifier and ADC. If a microphone is selected, bias power is
automatically enabled. When some input is deselected, unused
chip parts are disabled.

Microphone and line input recording tested on OMAP3 pandora board.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4290239c 01-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add volume controls for outputs

All outputs have dedicated gain controls except the
HandsFree output.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d889a72c 01-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change the common playback volume controls

Add Playback volume controls for all four DACs.
All four paths has three levels of volume controls:
Digital Fine gain, Digital Coarse gain, Analog gain.

The controls are named to reflect their connection to the DACs.
Per DAC volume can be performed, if needed:
amixer sset 'DAC1 Analog' 5,10
DACL1 analog gain to 5
DACR1 analog gain to 10

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 381a22b5 01-Dec-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change the capture volume control to TLV

The digital Capture gain control has a range:
0 to 31 dB in 1 dB steps.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 968a6025 28-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Rename snd_soc_register_card() to snd_soc_init_card()

Currently ASoC card initialisation is completed by a function called
snd_soc_register_card(). As part of the work to allow independant
registration of cards, codecs and machines in ASoC v2 a new function of
the same name has been added so rename the existing function to
facilitate the merge of v2.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b0bd53a7 24-Nov-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add helper function for output gain controls

Some of the gain controls in TWL (mostly those which are associated with
the outputs) are implemented in an interesting way:
0x0 : Power down (mute)
0x1 : 6dB
0x2 : 0 dB
0x3 : -6 dB
Inverting not going to help with these.
Custom volsw and volsw_2r get/put functions to handle these gains.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0d33ea0b 24-Nov-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Add CGAIN volume control

Add CGAIN (Coarse gain control) to TWL4030 codec.
The range of the CGAIN is:
0 dB to 12 dB in 6 dB steps.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c10b82cf 24-Nov-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Change the Master volume control to TLV

TWL4030 FGAIN volume control has a range:
-62 to 0 dB in 1 dB steps, 0 in the FGAIN means mute.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f8d05bdb 23-Nov-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: TWL4030: Disable soft-volume

Keep Soft-volume disabled for now, since if it is enabled
the FGAIN volume controls are not working in the current
configuration:
CODEC_MODE:OPT_MODE = 1
OPTION:ARXR2_EN = 1
OPTION:ARXL2_EN = 1
OPTION:ARXR1_EN = 0
OPTION:ARXL1_VRX_EN = 0
RX_PATH_SEL:RXL1_SEL = 0x0 (or 0x1)
RX_PATH_SEL:RXR1_SEL = 0x0 (or 0x1)

After the patch, FGAIN volume control works.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# dee89c4d 18-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Merge snd_soc_ops into snd_soc_dai_ops

Liam Girdwood's ASoC v2 work avoids having two different ops structures
for DAIs by merging the members of struct snd_soc_ops into struct
snd_soc_dai_ops, allowing per DAI configuration for everything.
Backport this change.

This paves the way for future work allowing any combination of DAIs to
be connected rather than having fixed purpose CODEC and CPU DAIs and
only allowing CODEC<->CPU interconnections.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6e5d9db2 13-Nov-2008 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: Fix for master playback/capture volume range for TWL4030 codec

FGAIN for playback is in range of 0-0x3f, while for capture GAIN it
is in the range of 0-0x1f.
The original value of 128 (0x7f) would modify the CGAIN also for
playback.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# bbba9444 12-Nov-2008 Jarkko Nikula <jarkko.nikula@nokia.com>

ASoC: Fix supported sample rates of TWL4030 audio codec

TWL4030 currently supports rates between 8 kHz and 48 kHz and sets the codec
mode register accordingly in twl4030_hw_params. Expose this info so that
ASoC can match other rates than 44.1 kHz or 48 kHz as well.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Acked-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e18c94d2 05-Nov-2008 Grazvydas Ignotas <notasas@gmail.com>

ALSA: ASoC: TWL4030 codec - fix 256*Fs clock

According to TRM, 256*Fs clock output should be enabled
when TWL4030 is in slave mode, not master.
This allows sound to work on OMAP3 Pandora, which uses
256*Fs clock.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cc17557e 30-Oct-2008 Steve Sakoman <steve@sakoman.com>

ASoC: Add support for TWL4030 audio codec

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>