CHROMIUM: ASoC: samsung dma - Don't set params on error.

If there is an error configuring DMA, clear the params member of the
runtime data.  This member being non-NULL signals that the dma should
be flushed and released.  If the setup fails, this will oops on a null
dereference.

BUG=chromium:244525
TEST=manual, play and record audio on daisy/spring.

Change-Id: Ic571c130b87df7971b86b15e0c905413cbe1c2ad
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60720
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174264
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>

Conflicts:
	sound/soc/samsung/dma.c
CHROMIUM: dma: pl330: add getposition() API

This patch adds a getposition() API to provide the
current DMA buffer position.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop

Change-Id: I00facc6894b810723503ef0ae41abea67712aacf
Signed-off-by: Soohyun Kim <soohyuni.kim@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181352
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

Conflicts:
	drivers/dma/pl330.c
CHROMIUM: DMA: PL330: Fix calculating burst_size

The burst size of PL330 should be aligned with source address, destination
address and size. If not, PL330 HW generates transmit or data missmatch error.
This patch adds the condition that checks the align of source and destination
address for burst size.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop

Change-Id: Id83e3ab81aa03532986b222d2d6315c212b3dbdd
Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181357
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: DMA: PL330: Change the cookie complete operation for cyclic mode

It doesn't set cookies to zero because cookies is reused
in case of cyclic mode.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop

Change-Id: I3b569a14c9e42fd79c5e608f272cb31de25e9d6e
Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181358
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: DMA: PL330: Avoid returning 0 from dma_getposition()

Executing the "DMAGO" instruction temporarily sets the source address
(and probably the destination address) to 0.  Avoid this glitch in
dma_getposition() by adding a lock and a small loop.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop; zero warnings in logs

Change-Id: I0acba4c6bea2490f3e407f8f76124dbec0a7ab34
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182924
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ARM: SAMSUNG: Add getpostion() operation

This patch adds new getpostion() operation into s3c-dma-ops and dma-ops.
DMA clients use it through .getpostion() function pointer.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop

Change-Id: I45bcc83536b6821eeae272a9a22650ee21f4864c
Signed-off-by: Soohyun Kim <soohyuni.kim@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181353
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: SAMSUNG: Support dma_pointer using getposition() API

This patch provides more accurate DMA buffer position using
getposition() API in dma_pointer function.

BUG=chrome-os-partner:24263
TEST=Play Mv.html and check for zero frame drop

Change-Id: Iabff48d75881d31579918c5f8c015680fe73e525
Signed-off-by: Soohyun Kim <soohyuni.kim@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181354
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: daisy_max98095: Register HP jack debounce time.

The headset chip runs a detection sequence when a jack is plugged.
Checking for a microphone can take 500ms in the worse case.  Enabling
audio output during that sequence can cause loud pops.  Set the
debounce time longer than the detection sequence to avoid that.

This comes from https://chromium-review.googlesource.com/#/c/198690/

BUG=chrome-os-partner:26094
TEST=play silence, plug/unplug headphones, listen for loud pop.

Change-Id: I8f013b5fd1024e42220831bcbfff7fdfef0f82e9
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/203582
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
CHROMIUM: ASoC: max98090 - Expose HP out enable.

Expose the headphone output enables to user space.  This will allow
userspace to ensure that there is stable output before the headphones
are turned on, avoiding a pop on insertion.

BUG=chrome-os-partner:26094
TEST=plug/unplug headphones while playing silence.

Change-Id: Idfb03f54fdc90b971494d9f7418d0a8a555ef40f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191003
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/203581
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
ASoC: max98090: Claim max98091 support

The max98091 is the same as the 98090 but with an extra microphone.
The max98090 driver already has support for the max98091.  This just
allows us to use the proper compatible string in the device tree.

BUG=chrome-os-partner:24838
TEST=With all changes pit and pi work for:
- youtube (speakers and headphones)
- aplay (speakers and headphones)
- google voice search w/ builtin mic

Change-Id: I4da4b1eeaab4f5dfc588aa41b36123fc9d2f7819
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/184091
Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>