Revert "drm: Replace crtc fb with primary plane fb (v3)"

This reverts commit dfb048da1b46c7169d8c3b3360b2f2ba1e71b5b4.

This was ported from 3.15 into the original ti-linux-3.14 tree, but
unfortuntately it breaks the build of omapdrm (which is not enabled in the
default omap2plus_defconfig).  Pulling in all the dependent commits to make
this not break the build looks like a bunch of work, it could be done later if
deemed necessary.  For now lets revert it, and try and put omapdrm back into a
sane state.

Conflicts:
	drivers/gpu/drm/omapdrm/omap_crtc.c
ASoC: davinci-pcm: Add empty functions for !CONFIG_SND_DAVINCI_SOC builds

[ Upstream commit 1a95d8d09ef7e40563afd587cce52868e3d076a0 ]

To save drivers using davinci-pcm and edma-pcm the need to fiddle with
!CONFIG_SND_DAVINCI_SOC in their code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Assign the dma_data earlier in dai_probe callback

[ Upstream commit d5902f693698076e5bda44cbfa999e9c02bb83ab ]

Set up the playback_dma_data/capture_dma_data for the dai at probe
time since the generic dmaengine PCM stack needs to have access to
this information early.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Fix debug typo in davinci_mcasp_hw_params()

[ Upstream commit f5b02b4a2cb7eaa223ddaba8e4338b31bcdaf369 ]

requred -> required

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Simplify and clean up the AFIFO configuration code

[ Upstream commit 0bf0e8aeceaf4b12524559fce9c6b91a90b63381 ]

We can have more linear code flow by using variables in
mcasp_common_hw_param() related to the AFIFO configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Configure the AFIFO and DMA burst size at the same place

[ Upstream commit 5f04c603a52d4951e6f6b2f059049e7c5ee93db7 ]

Move the dma_params->fifo_level and dma_data->maxburst configuration to the
mcasp_common_hw_param() function where we configure the AFIFO registers.
It makes the code regarding to AFIFO and DMA configuration more easy to
follow since it is now clear how the AFIFO and how the DMA is going to be
configured.
Previously this has been done in two functions using a bit different
calculation form - which ended up with the same result in both case at the
end, but it was confusing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinic-mcasp: Adopt the AFIFO/DMA configuration to the stream (dynamic depth)

[ Upstream commit dd093a0f1962fb71e8852411f03fec7290027a90 ]

Configure the AFIFO numevt parameter based on the requested tx/rx_numevt,
active serializers and period size in words.
In this way McASP can adopt it's (and the DMA) configuration runtime and
can pick the most optimal setup which satisfy the parameters.
This way we do not need to place any constraint on the stream itself,
allowing application greater freedom on how they want to set up ALSA.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Fine tune and correct the DMA burst configuration

[ Upstream commit 33445643c3146fa43af3e9aa1cce08da9fe03157 ]

When the AFIFO is not enabled but more than one serializers are used the DMA
need to transfer number of words equal to active serializers when a DMA
request is generated.
When configuring the burst for the DMA avoid using value '1' for the burst
since it is going to enable additional logic in the DMA drivers. Burst '1'
means that the DMA should send/receive one word per DMA requests.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Format data delay configuration enhancement

[ Upstream commit 6dfa9a4e6aacba70bff24c47871ac9aba3e76020 ]

Use intermediate variable for the data delay needed for the specific format
and write the register after the format configuration at once.
This will help to control the number of lines as support for more formats
going to be added.
Also fixes a case when we switch between two formats with different delay
requirements.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Support for DSP_A format

[ Upstream commit 188edc59c297fcd971d6a4ae5f5f5dacff7b315b ]

DSP_A is like DSP_B mode but with one bit delay after the FS.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Move the FS polarity change out from the switch case

[ Upstream commit 83f12503bd1fb18d3fd460871660b34faf671918 ]

FS polarity can be either rising or falling edge in McASP. Instead of
accessing the registers in every switch/case set a flag and write the
registers after the switch for the invert configuration.
This change will help when adding support for more formats also.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Add support for I2S format

[ Upstream commit ffd950f75dd71f13194b5d5c8ec67926a1996102 ]

The FS needs to be inverted in McASP compared to other supported formats.
Use a flag to indicate if the FS needs to be inverted.
At the same time fail when non supported format is asked since the default
case was anyways configuring McASP to a not valid format.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Support for LEFT_J format

[ Upstream commit 423761e0cab39c98f0fd9387ea44b98c2a4ca6fa ]

Configuration for LEFT_J format.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Remove excess empty lines from davinci_mcasp_set_dai_fmt()

[ Upstream commit 3c25f916d378da6f06874abfc5c18e5a40e2d8c0 ]

To make the code look uniform.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: davinci-mcasp: Do not touch 0x04 register above McASP_VERSION_2

[ Upstream commit 40448e5e977b59a4753fce3619f537b63fcedc02 ]

This register is not defined in TI81xx and on AM335x/AM437x it is the
SYSCONFIG register which should not be touched by drivers since it is
related to PM and handled by the generic PM code.
This register write was there since the first time the davinci-mcasp driver
was appeared in the kernel.
The reason why it did not caused any issues on AM335x/AM437x is that it sets
bit 1 in SYSCONFIG register which in turn will enable the smart-idle mode.
This is the default mode and this is the mode McASP should be in also when
in use.
On TI81xx the register is not defined.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: Add resource managed snd_soc_register_platform()

[ Upstream commit 8931bf6208776292b1b888dd8534229f63e2eaa2 ]

Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register_platform()
platform.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: omap-mcpdm: Assign the dai DMA data at earlier time

[ Upstream commit f6563b31fb4878fddc846d2012bcee9c5f260d11 ]

Assign the dai dma data at dai driver probe time, not in startup.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: Export devm_snd_soc_register_platform()

[ Upstream commit 1f23380b803a670a9eb53f63fd0c662d20ab1b66 ]

devm_snd_soc_register_platform() is used in drivers which can be build as
modules, so it needs to be exported to avoid linkers errors like:

	ERROR: "devm_snd_soc_register_platform" [sound/soc/omap/snd-soc-omap.ko] undefined!
	ERROR: "devm_snd_soc_register_platform" [sound/soc/davinci/snd-soc-davinci.ko] undefined!

Fixes: 8931bf620 ("ASoC: Add resource managed snd_soc_register_platform()")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: omap-pcm: Support for binding the platform driver to dai devices

[ Upstream commit fe7b5868809a89a7316eef064f0bb7796aa8c225 ]

With the new calls it is going to be possible to bind the platform driver
to a dai device which makes it easier for us in a long run to handle DT
boots, and opens the possibility to move machine driver to generic simple
card.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
ASoC: omap-mcpdm: Bind the platform driver to the dai driver when loading

[ Upstream commit 335b06515eda252b36aa9063596f740a903c1e35 ]

Use the same device for the platform driver when registering as the dai
driver. This will enable us to clean up some DT booted cases.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Darren Etheridge <detheridge@ti.com>