CHROMIUM: ASoC: samsung: add daisy_max98095.c board

Add the ASoC board plumbing for max98095 on daisy/snow.

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
(cherry picked from commit 616cd75239ab06c2339e6b29e148f87a26632587)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: HP detect plumbing for snow

This adds HP detect through the external GPIO on Snow. I've hardcoded
the GPIO for now since we need to move the whole ASoC configuration to
device tree (a la tegra) and will move it to a proper gpio specifier
there when we do so.

BUG=none
TEST=start up, browse youtube, bring up an awesome music video, plug in
headphones, rock out.

Change-Id: I9b7d1452f43f68f1e17bc8868f1d9c56d09db87b
Signed-off-by: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27866
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
(cherry picked from commit a0c472ce090daa5fac85e40f0d524f1c187358c8)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: Route clocks to i2s.

Configure the clocks so that the i2s block is driven with a clock that
can be divided to the current audio frequency.  The rate of epll is
already being adjusted to match the frame rate, but epll was not being
configured to drive the audio clocks.  At init, set the clock muxes to
route epll through the muxes.  This fixes audio on Daisy playing back
too fast (6% fast for 44.1, almost 2x for 48k).

BUG=chrome-os-partner:11225
TEST=Play sine waves of various frequencies and check they are rendered
correctly with a spectrum analyzer.

Change-Id: I46c5f466088a825942931007b49fcde2e40e9fc6
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28453
Reviewed-by: Olof Johansson <olofj@chromium.org>
(cherry picked from commit 3a2dd4bea8954145ec470cfc3a29f0c96911122f)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: daisy_max98095 is a platform driver.

Convert daisy_max98095 to a platform driver that is compatible with
'google,daisy-audio-max98095'.  This brings it more in line with other
machine drivers from the soc tree and provides the ability to add GPIO
specifiers to device tree in subsequent commits.

BUG=chrome-os-partner;12112
TEST=aplay <wav file>, arecord, youtube audio works.

Change-Id: I5624686178d89afaef911c9a3eb067b7fb4902a0
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29625
Reviewed-by: Olof Johansson <olofj@chromium.org>
(cherry picked from commit 2ae375a4a7e063e149e05c54e71f9a953e6ba93f)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ALSA: ASoC: Get snow hp/mic detect GPIOs from device tree.

Get the GPIOs used for hp and mic detect from the device tree.  Getting
them from device tree allows for the pull up/pull down to be properly
configured (it is disabled) and for mic detect to be inverted.

BUG=chrome-os-partner:10849
TEST=aplay/arecord on snow work.  evtest shows events for hp and mic
detection.

Signed-off-by: Dylan Reid <dgreid@chromium.org>

Change-Id: I93d994a2ec5c22683c6eb5fd502f6a54c8e8d964
Reviewed-on: https://gerrit.chromium.org/gerrit/29626
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Ready: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit ce029e0e6e74ef2d663db05a483c1c6529d49dab)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASOC: Samsung: Change MAX98095 MCLK input clk

This patch configures the codec system clock with xclkout.
with out this patch there is a error while playing 8,22.05,
32KHz sampling rate files. The error was

max98095 7-0011: Invalid master clock frequency
[ 46.194905] asoc: machine hw_params failed: -22
Stream error -22

BUG=chrome-os-partner:12733
TEST=Tested with all supported sampling frequencys in cramfs.
All are playing fine except 8KHz and 32KHz are playing with
some error messages like below

[ 1262.417869] exynos5_epll_set_rate: Invalid Clock EPLL Frequency
[ 1262.417885] failed to clk_set_rate of fout_epll for audio

Change-Id: I5891ac9bbae1eeb6befb6992699e59e3e8977c24
Signed-off-by: R. Chandrasekar <rcsekar@samsung.com>
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/30538
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Ready: Doug Anderson <dianders@chromium.org>
(cherry picked from commit 3afa3f951e57b8be7105c409106e150ab9847100)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: Spring is using max98095 codec

Spring is also using the Maxim max98095 codec for audio.
Add it to the list of supported boards.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=chrome-os-partner:14490
TEST=on Spring, plug a headset, play a video on Youtube and hear the
sound.

Change-Id: If17a3ba240943412acf03b24058218c40781944f
Reviewed-on: https://gerrit.chromium.org/gerrit/38205
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit b0c1d84184bd951b09b9a083e6343c49f32e96cf)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: Samsung: change the clock instance name

clock instance name changed according to mainline code

Change-Id: Ic2486dc9055c8d7ec6e2d40697c432ab80756135
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: R. Chandrasekar <rcsekar@samsung.com>
(cherry picked from commit e25363dba136e5be0ecab61b027a38281455ee1a)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: Samsung: I2s Instance 0 Platform name changed

platform name changed to the name same as cpu dai for the I2S 0 instance.

Change-Id: I373d71d6c2df13d7c2f4ede2da6a746fe80b895b
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: R. Chandrasekar <rcsekar@samsung.com>
(cherry picked from commit 2f31a852f6306cf6359d6cab63d4e4f8f4bcdad2)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: Samsung: remove __devinit, __devexit annotations

The __devinit, __devexit annotations  are not supported on kernel v3.8.rc4
so remove them.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
(cherry picked from commit c85c9b8aee841dda0830553f7c55b201859fcd9f)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ALSA: ASoC: daisy - Poll gpio jacks after resume.

After resume, poll the gpio jacks in case they changed while sleeping.

BUG=chrome-os-partner:14417
TEST=Plug headphones, play audio, suspend, unplug, resume, check audio
comes from speakers.

Change-Id: I32f47b19516094fccb253e6ec5e482f6890cecb9
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34048
Reviewed-by: Olof Johansson <olofj@chromium.org>
(cherry picked from commit 75099bd8ce7d60bedb78f9905ce8e01adcfa896b)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: alsa/soc: adding support for hdmi audio to i2s card

This patch adds hdmi-audio plugin to i2s card. It also contains the changes
for DAPM changes and Error fixes from Sean and Vincent.

Change-Id: I25c7d9c23c91caccc6127301dc86be949fc92e63
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 3186766b6f08c031b486deaa900389de77b16d9a)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
sound: soc: exynos: Don't set jack_cb until jack is initialized

This patch defers setting the jack_cb function until the jack has been
initialized. This avoids a race where jack_report will try to lock the
jack's mutex before it has been initialized.

BUG=None
TEST=Boot snow with HDMI attached, no crashes

Change-Id: If47783c5809ac8a43d0fd952f1ffde1763aa4198
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57146
(cherry picked from commit 50611cd7689f53c967bec5575b1859a229236c77)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: remove unused platform device

The "daisy-pcm-audio" platform device isn't actually used for anything.
Remove it.

BUG=chrome-os-partner:19578
TEST=Build and boot on snow; audio still works once DT bindings and CCF
support for the daisy_max98095 driver are added.

Change-Id: Ie92b91be55db12f30095204399a666f447b28a1d
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
[abrestic: cleaned-up commit message; re-ordered in patch set]
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56188
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit bd9fcb0433f213ce31371894fc7be6d59a3f2583)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
ASoC: max98090: add DT binding document for MAX98090 CODEC

This binding mainly serves to document the list of input and output pins
that may be used in a sound card's audio routing table.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 308a0f3f24db5e5943ef0aad722e8b3d125dbddb)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
ASoC: hdmi-codec: Add devicetree binding with documentation

Signed-off-by: Jyri Sarha <jsarha@ti.com>
cc: bcousson@baylibre.com
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 0f7f3d1f17c2e4d73e449e6acb2007b13813c58e)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: exynos: dts: Start sound section for daisy/snow.

Daisy and Snow both use the MAX98095 audio codec.  Specify that here so
that the correct machine driver will be chosen.  Specify the GPIOs used
on snow to detect mic and headphone configure both as inputs and disable
internal pull up/down.

BUG=chrome-os-partner:12112
TEST=Still compiles, not used yet.

Signed-off-by: Dylan Reid <dgreid@chromium.org>

Change-Id: I645d5699428d6d5599bf7b80f4b9cec6c1518071
Reviewed-on: https://gerrit.chromium.org/gerrit/29624
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Ready: Dylan Reid <dgreid@chromium.org>

[HACK] Changed patch just to add the daisy-audio-max98095.txt file.
(cherry picked from commit 1622ddd072fb0158cd9a8ad5e4fb399bd3f7c9eb)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: Pass DAI link info from device tree

This patch adds the codec, cpu, and platform OF nodes to the DAI links
instead of relying on a name-based lookup of the DAI links.  This is
required because we don't have auxdata support which registered the i2s
interface as "samsung-i2s.0" instead of <ADDRESS>.i2s.  The i2s interface
and codec are now specified in the "i2s-controller" and "audio-codec"
device-tree properties.

BUG=chrome-os-partner:19578
TEST=Build and boot on snow

Change-Id: I2e5a1ef86a0b62648f268b2f24f7ab1f62c6527c
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
[abrestic: removed stream and DAI name from DT; added documentation]
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56187
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit de48f9f9624b5d71dbdb0b33edb86383e348dd8d)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: Change the audio clks according to CCF

This patch updates the daisy_max98095 machine driver to use the clocks
passed via the device-tree to setup the audio clock hierarchy and change
the EPLL rate.

BUG=chrome-os-partner:19578
TEST=Build and boot on snow

Change-Id: I5a8363f63454103db6b3dccc1d107b78a9042332
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
[abrestic: added documentation; re-worked so that all necessary audio clocks
 are specified via DT]
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56194
Reviewed-by: Doug Anderson <dianders@chromium.org>
(cherry picked from commit 6557a6b8d3bed55a6a22cf9e362bc9433add4620)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: samsung: add support for Pit with max98090

This adds support for Peach-Pit with the max98090 codec to the
daisy_max98095 machine driver.  The main difference is that
microphone bias is controlled by the pin "MICBIAS" on the max98090
vs. "MICBIAS2" on the max98095.

BUG=chrome-os-partner:18720
TEST=Audio still works on snow.  daisy_max98095 driver probes on
peach-pit once DT bindings are added.

Change-Id: I44e4fac0e523957b842e605e55d6c0234c8808d8
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57707
(cherry picked from commit 6d6ab35f43cb0717120b93d20483da662a1e3ce6)

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>