CHERRY-PICK: Revert "CHROMIUM: ALSA: ASoC: max98090: Shutdown codec when changing to/from dmic."

This reverts commit 778a8a21dd674e597723d0c76d42598477f9f3da.

The next patch will add event callback to DMICL_ENA and DMIR_ENA such
that turn on/off of DMIC of these two cases can be unified.
1. Switch recording to/from dmic while capturing.
2. Start/stop capturing using dmic.

BUG=chromium:415156
TEST=with patch series, check dmic works fine.
TEST=with patch series, switch to/from dmic and check captured result
is fine.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>

Conflicts:
	sound/soc/codecs/max98090.c

Original Change-Id: I67c0c789bbd0f153ed1a0e315a7ccb7d634e3919
Original Reviewed-on: https://chromium-review.googlesource.com/235620
Original Reviewed-by: Dylan Reid <dgreid@chromium.org>
Original Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Original Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Original Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>

Change-Id: Id99f2508738edbb9bf74d60037e8593b2a5b96c5
Reviewed-on: https://chromium-review.googlesource.com/236856
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
CHERRY-PICK: max98090: Shutdown codec before updating some registers

According to user manual, there are some registers whose change requires
shutdown bit = 0. This patch adds shutdown call before updating those
registers. The codec state will be restored after the update.

In max98090_dai_hw_params, codec might get new lrclk and pcm format.
If pcm format is changed, or needs to be set for the first time,
it needs a shutdown.
If lrclk is changed, or needs to be set for the first time, it needs a
shutdown.
If sysclk is changed, it needs a shutdown.

Apart from the registers listed on user manual, DMIC should be toggled
when codec is off. However, in reality, it is fine to enable DMIC when
codec is on, as long as there is an extra shutdown/restore after DMIC is
enabled.
This patch adds an event callback to DAPM supply widget DMICL_ENA and
DMICR_ENA so DAPM will shutdown codec before DMIC is enabled.
After DMIC is enabled, it does another shutdown/restore since shutdown
register is not protected in the time frame between PRE_PMU and POST_PMU
events.
Note that this is only required for max98090, not max98091.

In methods other than dmic_event, the code to shutdown codec, update
registers, and turn on codec are protected by a mutex in private data to
make sure codec is in shutdown state when register is being updated.

With this patch, there will be no audio drop in playback stream when
capture stream starts to use external mic. There will be audio drop in
playback stream when capture stream starts to use digital mic.

To avoid the playback stream audio drop, dmic can be enabled in all
playback cases, which will be handled in machine driver by adding DAPM
routes.

BUG=chromium:415156
TEST=On swanky (using max98090), record using external mic while
playing audio. There will be NO audio drop. Check recorded audio is
fine.
TEST=On swanky (using max98090), record using internal mic while
playing audio. There will be audio drop. Check recorded audio is fine.

Original Change-Id: I12b4792d70de5c9827c970fdbc0dd205084b3362
Original Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Original Reviewed-on: https://chromium-review.googlesource.com/233863

Change-Id: I91f8b46f2b66bf40ca2459a1812906d8d17840c8
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236857
CHERRY-PICK: byt-max98090: Enable DMIC in all playback cases

DMIC enable register can not be safely toggled when shutdown bit is 1.
This causes a short audio drop in playback whenever a capture stream
starts. To overcome this problem, turn on DMIC enable bits during all
audio playback cases.
Captured audio is not sent outside of codec because SDOEN is not enabled.

BUG=chromium:415156
TEST=On swanky, play youtube in the background. Check there is no audio
drop when capture stream starts.

Original Change-Id: I9b17eacb071a6ee950b995761ad0091e46c917d3
Original Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Original Reviewed-on: https://chromium-review.googlesource.com/233864

Change-Id: Ie6a26d0a6a890f99b2db890758256834f4ae6226
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236858
CHERRY-PICK: CHROMIUM: ARM: dts: nyan: Enable DMIC in all playback cases

DMIC enable register can not be safely toggled when shutdown bit is 1.
This causes a short audio drop in playback whenever a capture stream
starts. To overcome this problem, turn on DMIC enable bits during all
audio playback cases.
Captured audio is not sent outside of codec because SDOEN is not enabled.

BUG=chromium:415156
TEST=On nyan_big, play youtube in the background. Check there is no
audio drop when capture stream starts.

Original Change-Id: Id44ca93e090081eb6846a842f69e1b4db9927d91
Original Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Original Reviewed-on: https://chromium-review.googlesource.com/233865
Original Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>

Change-Id: I8c02a922169051f01b0e0737f9964bb638133271
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236859