ASoC: core: Add SND_SOC_BYTES control for coefficient blocks

Allow devices to export blocks of registers to the application layer,
intended for use for reading and writing coefficient data which can't
usefully be worked with by the kernel at runtime (for example, due to
requiring complex and expensive calculations or being the results of
callibration procedures). Currently drivers are using platform data to
provide configurations for coefficient blocks which isn't at all
convenient for runtime management or configuration development.

Currently only devices using regmap are supported, an error will be
generated for any attempt to work with a byte control on a non-regmap
device. There's no fundamental block to other devices so support could
be added if required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
ASoC: core: Add support for masking out parts of coefficient blocks

Chip designers frequently include things like the enable and disable
controls for algorithms in the register blocks which also hold the
coefficients. Since it's desirable to split out the enable/disable
control from userspace the plain SND_SOC_BYTES() isn't optimal for
these devices.

Add a SND_SOC_BYTES_MASK() which allows a bitmask from the first word
of the block to be excluded from the control. This supports the needs
of devices I've looked at and lets us have a reasonably simple API.
Further controls can be added in future if that's needed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
ASoC: core: Don't overwrite .poweroff in snd_soc_pm_ops

SET_SYSTEM_SLEEP_PM_OPS writes .poweroff = *_resume once. Then we overwrite it
again explicitly as .poweroff = snd_soc_poweroff. Even though it works, as the
second one overwrites the first one, this is not the correct way. Fix this by
expanding SET_SYSTEM_SLEEP_PM_OPS in our structure.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Conflicts:
	sound/soc/soc-core.c
ASoC: core: cleanup platform debugfs on probe failure.

Make sure we cleanup the platform debugfs when probe fails.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: core: Log a warning when machines use soc-audio

snd_soc_register_card() has been available and strongly preferred since
2.6.38 but we're still seeing new drivers using it and the conversion rate
for older machines has been low. Help address both issues by logging a
warning when the soc-audio device probes.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
ASoC: core: Add platform component mutex

Add mutex support for platform IO operations. e.g. can be used
for platform DAPM widget IO ops.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: core: missing set_fmt should not be complaint

Not having a DAI link set_fmt operation is perfectly normal and
should not be complaint.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: core: Fix obscure leak of runtime array

We're currently not freeing card->rtd in cases where the card is
unregistered before being instantiated - convert it to devm_kzalloc() to
make sure that happens.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
ASoC: set idle_bias_off=1 for all platform DAPM contexts

The ASoC core currently defaults to using STANDBY rather than OFF for
idle ASoC platform devices, which causes a permanent pm_runtime_get() on
them. This keeps the device active unnecessarily. This can be especially
problematic when the ASoC platform device and DAI device are the same
device.

The distinction between OFF and STANDBY is likely not relevant for ASoC
platform drivers, since they aren't analog devices. So, solve this issue
by hard-coding idle_bias_off = 1 for all ASoC platform devices. If this
turns out to be a problem, this value could be sourced from the
snd_soc_platform_driver, similarly to soc_probe_codec().

Note: Prior to this change, this caused a large (10) runtime_active count
for the Tegra I2S controller even when not in use, and a leak in that
value as streams were started and stopped. This change probably hides a
bug.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
simple_open: automatically convert to simple_open()

Many users of debugfs copy the implementation of default_open() when
they want to support a custom read/write function op.  This leads to a
proliferation of the default_open() implementation across the entire
tree.

Now that the common implementation has been consolidated into libfs we
can replace all the users of this function with simple_open().

This replacement was done with the following semantic patch:

<smpl>
@ open @
identifier open_f != simple_open;
identifier i, f;
@@
-int open_f(struct inode *i, struct file *f)
-{
(
-if (i->i_private)
-f->private_data = i->i_private;
|
-f->private_data = i->i_private;
)
-return 0;
-}

@ has_open depends on open @
identifier fops;
identifier open.open_f;
@@
struct file_operations fops = {
...
-.open = open_f,
+.open = simple_open,
...
};
</smpl>

[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	arch/arm/mach-msm/smd_debug.c
Revert "ASoC: core: Fix obscure leak of runtime array"
*cause stuck of boot, i haven't debugged

This reverts commit 5fc267ec86a36a8164a6c96dff71f0aff92f1cb5.
Squashed update of kernel from 3.4.104 to 3.4.105
ks01lte: cypress-touchkey: fixed gpio ensure requested warnings
when it is initialized the gpio request is interrupted by the return even when gpio is busy, remove all the returns to allow to try to request them all

log error:
<3>[    0.933943] cypress_touchkey_init: init
<7>[    0.934050] gpio_request: gpio-96 (touchkey_scl) status -16
<3>[    0.934077] cypress_request_gpio: unable to request touchkey_scl [96]
<6>[    0.934194] input: sec_touchkey as /devices/i2c.91/i2c-22/22-0020/input/input2
<5>[    0.934247] cypress_touchkey 22-0020: cypress_touchkey_con_hw : called with flag 1.
<6>[    0.934254] cypress_touchkey 22-0020: cypress_power_onoff: power on
<4>[    0.934509] ------------[ cut here ]------------
<4>[    0.934519] WARNING: at drivers/gpio/gpiolib.c:103 gpio_ensure_requested+0x44/0xa4()
<4>[    0.934524] autorequest GPIO-433
<4>[    0.934528] Modules linked in:
<4>[    0.934546] [<c010c3c0>] (unwind_backtrace+0x0/0x11c) from [<c0195a7c>] (warn_slowpath_common+0x4c/0x64)
<4>[    0.934557] [<c0195a7c>] (warn_slowpath_common+0x4c/0x64) from [<c0195b14>] (warn_slowpath_fmt+0x2c/0x3c)
<4>[    0.934567] [<c0195b14>] (warn_slowpath_fmt+0x2c/0x3c) from [<c03cc650>] (gpio_ensure_requested+0x44/0xa4)
<4>[    0.934578] [<c03cc650>] (gpio_ensure_requested+0x44/0xa4) from [<c03cca28>] (gpio_direction_output+0x98/0x2b0)
<4>[    0.934591] [<c03cca28>] (gpio_direction_output+0x98/0x2b0) from [<c05a10e4>] (cypress_power_onoff+0x200/0x2bc)
<4>[    0.934604] [<c05a10e4>] (cypress_power_onoff+0x200/0x2bc) from [<c0926d50>] (cypress_touchkey_probe+0x3a4/0xa08)
<4>[    0.934619] [<c0926d50>] (cypress_touchkey_probe+0x3a4/0xa08) from [<c05c11d4>] (i2c_device_probe+0x98/0xc8)
<4>[    0.934634] [<c05c11d4>] (i2c_device_probe+0x98/0xc8) from [<c04a1a3c>] (driver_probe_device+0x138/0x340)
<4>[    0.934644] [<c04a1a3c>] (driver_probe_device+0x138/0x340) from [<c04a1cac>] (__driver_attach+0x68/0x8c)
<4>[    0.934655] [<c04a1cac>] (__driver_attach+0x68/0x8c) from [<c049ff84>] (bus_for_each_dev+0x50/0x88)
<4>[    0.934665] [<c049ff84>] (bus_for_each_dev+0x50/0x88) from [<c04a1018>] (bus_add_driver+0x100/0x26c)
<4>[    0.934674] [<c04a1018>] (bus_add_driver+0x100/0x26c) from [<c04a2184>] (driver_register+0x9c/0x120)
<4>[    0.934685] [<c04a2184>] (driver_register+0x9c/0x120) from [<c05c30a4>] (i2c_register_driver+0xb0/0xdc)
<4>[    0.934695] [<c05c30a4>] (i2c_register_driver+0xb0/0xdc) from [<c0f25e04>] (cypress_touchkey_init+0x1c/0x5c)
<4>[    0.934705] [<c0f25e04>] (cypress_touchkey_init+0x1c/0x5c) from [<c0100644>] (do_one_initcall+0x90/0x160)
<4>[    0.934717] [<c0100644>] (do_one_initcall+0x90/0x160) from [<c0f00d04>] (kernel_init+0xf4/0x1b8)
<4>[    0.934728] [<c0f00d04>] (kernel_init+0xf4/0x1b8) from [<c0106c8c>] (kernel_thread_exit+0x0/0x8)
<4>[    0.934744] ---[ end trace 2a56afe3672998d3 ]---