ASoC: Remove unused "control_data" field of struct max98088_priv

The control_data field is used to initialize the codec's control_data field,
but since this is also done by the snd-soc-cache core, the redundant
assignment can be removed and the field can be dropped.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: max98088 codec: Catch driver bugs for eq channel name

Move the EQ channel names to a separate array and iterate over it in
max98088_get_channel rather than duplicating the hardcoded channel
names. Add an error message if an invalid channel is passed and check
the error in the callers.

Also added a BUILD_BUG_ON to ensure that the eq_mode_name and controls
arrays are the same size.

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
 ASoC: Constify snd_soc_dai_ops structs

Commit 1ee46eb("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.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Change-Id: I75e44c270114c7c36b494d31c21e0cc1b3a72b74
ASoC: Remove unneeded platform_device.h inclusions from max98088 CODEC
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.

Change-Id: I13e521f8b293433bcc32205e251cc2a3af2a54ee
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>
 ASoC: Convert max98088 to devm_kzalloc()

Change-Id: Ibf332c40581d01390e5d904dbc95e77cc0514063
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: core: Add support for DAI and machine kcontrols.

Currently ASoC can only add kcontrols using codec and platform component device
handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for
SoC card machine drivers too. This allows the kcontrol to have a direct handle to
the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily
get it's private data.

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

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

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

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

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

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

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

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Conflicts:
	sound/soc/codecs/adau1373.c
	sound/soc/codecs/alc5623.c
	sound/soc/codecs/alc5632.c
	sound/soc/codecs/wm8994.c

Change-Id: I45778c998fb637de717bbbd8e892e6fe18911d07
ASoC: max98088: Use module_i2c_driver

module_i2c_driver makes the code simpler by eliminating module_init
and module_exit calls.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
 ASoC: max98088: Add TLV data for volume controls.

Specify volumes as defined in the MAX98088/9 data sheet.  Allows ALSA
lib snd_mixer_selem_get_playback_dB_range and related functions to
work.

Change-Id: Ic39905312ec1736a19bdfea5c857bcf460ab0e5d
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Sound/soc/tegra/tegra_max98088:
replace snd_soc_add_controls() with snd_soc_add_codec_controls().

Change-Id: Ia1caf3a695e5af219bc9dc204fba21e99a132a68
ASoC: max98088: Fix logging of hardware revision.

The hardware revision of the codec is based at 0x40.  Subtract that
before convering to ASCII.  The same as it is done for 98095.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
ASoC: max98088: Fix indentation

Change-Id: I2b135f06a96d48ef2bc5d7ea207a24781036fd2d
Signed-off-by: demetris <ierokipides.dem@gmail.com>
ASoC: max98088: Use table based control init

Tested-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
ASoC: max98088: Use WARN_ON() instead of BUG_ON()

Use WARN_ON() and handle the error cases accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
max98088 codec clean from gcc warnings

Change-Id: Ib58337f0be0d4e868d5a472c28e2ca34f809197d