OMAP4+: HSI: Prevent HSI clock disable while ACWAKE is high

If HSI clocks are disabled while ACWAKE is high, it is possible that ACWAKE
goes low unexpectedly.
This is not seen on Link Layers which do not comply with MIPI, because in this
case ACWAKE and CAWAKE are high at the same time, so HSI clocks are not
disabled.
But for Link Layers which comply with MIPI, CAWAKE will go low independtly of
CAWAKE, and HSI driver might cut the clocks while ACWAKE is high, which causes
CAWAKE to have an unknwon value.

Bug: 6217861, 6207265
Change-Id: I3098619a645277af12eb0ba82ca0e1508bd3ce03
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
(cherry picked from commit 52c33735e828ee7fb6e8f0393a048876788209b2)
Revert "HACK: input: mms_ts: Log a touch event after driver enable."

This reverts commit 4ff08e36fda8c309c5ed320c7cd2546cb88f752c

Get rid of the debugging for the release.

Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: I4dd4cf62f2c574db80c70210771a9bed11dedcab
(cherry picked from commit 8dd07181236e73dc82ecd047e9bce970657ffd40)
OMAPDSS: DISPC: Fix rounding error in scaling decision

When checking if we are downscaling by more than a factor,
we were dividing the source dimensions instead of multiplying
back the target dimensions.  This allowed downscaling by
slightly more than the max supported downscaling, resulting
in out-of-range register settings and ultimately SYNC_LOST.

Change-Id: Ic039789c5011d64da870121eeb227a803af1fa83
Signed-off-by: Lajos Molnar <lajos@ti.com>
(cherry picked from commit 786e99b07638816489c24cd8ac482d15a22d3fb0)
video: fbmod: parse audio blocks from EDID

Change-Id: I996949a6ea52e8947579a1b63366c603b720063e
Signed-off-by: Simon Wilson <simonwilson@google.com>
(cherry picked from commit 2348a644ca79e974a89f1a249ca28e1f3db773b7)
ARM: omap: dmtimer: add omap_dm_timer_dump_regs function

Add the omap_dm_timer_dump_regs function. If CONFIG_OMAP_DM_TIMER_DEBUG is
set, then this function dumps the dm timer registers. Otherwise, turn into a
noop.

Change-Id: I132eec2b611620058242db661c2c546c690d952c
Signed-off-by: Rom Lemarchand <rlemarchand@sta.samsung.com>
(cherry picked from commit 29ff83f4faea4b084d61c9f30948fc643370191f)
ARM: omap4: tuna: Add DM debug messages to vibrator

Adding DM timer register dumps to the Tuna vibrator.

Change-Id: I0852d2154f5d5acdc0d76b391d1eea76225bcae5
Signed-off-by: Rom Lemarchand <rlemarchand@sta.samsung.com>
(cherry picked from commit 2e2e5dc168e3608f5afb506c6e244494912385a4)
usb: musb: Fix memory corruption

rx_count, the number of bytes in the rx fifo, may be larger than the
size of the transfer buffer. Make sure we don't overflow the transfer
buffer in that case.

Bug: 6497399
Change-Id: I5bcf6dd543f9da4ee22944aa6c41673f2cca4c1f
Signed-off-by: Benoit Goby <benoit@android.com>
(cherry picked from commit d834ff148c7663c9533fe8bd71ae792d06a702da)
misc: fsa9480: detect powered AV cables (non-365K)

Change-Id: I663ae65dee9cde634e100edf7f1f9b253b1c6c0f
Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 1536e74c5a7c9ec400e51e9eab7af8940cc1d9d8)
ARM: omap4: tuna: attach to USB when MHL negotiation fails

Some buggy MHL docks start the detection process, but do not respond to
devcap reads if HDMI is disconnected.  MHL detection may also be falsely
triggered by a glitchy connection.  In these cases, attach to USB so
charging can still happen.

Change-Id: Ia06dd088375fdcd6f598b6c94249a1e5814d7998
Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit aa78a4ebf68063108e150736de2ccad925a855a4)
HACK: OMAP4: HDMI: Swap left-right channels for I2S Channel 1

Swap LFE with FC channel in order to adapt the channel mapping
that is received in the HDMI Audio FIFO to the mapping defined
by CEA-861-D

Change-Id: I989fbd10c73547bb171b2b894e260e14f86a4576
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
Signed-off-by: Axel Castaneda Gonzalez <x0055901@ti.com>
(cherry picked from commit ab044b54371929576a57db27e8a20066801f1812)
ASoC: OMAP4: HDMI: add mixer control to get LPCM channels

Also fix a potential race condition where the state
could have changed during the sleep.

Change-Id: I189d0cd17ea56f5e0c2315061ab18acfcff2c91c
Signed-off-by: Simon Wilson <simonwilson@google.com>
(cherry picked from commit fa8795ab5da299d0f5f35add0774820cd1dcfff2)
ARM: OMAP4: tuna: vibrator: Re-init GPTIMER registers at each vibrate

Change-Id: I78a439e0b30f180f8fdcf02dcba1d2c15b6edc0d
Signed-off-by: Todd Poynor <toddpoynor@google.com>
(cherry picked from commit 3c854e40f81f76dce85aba3eb2903882fdf10cb9)
HACK: OMAP: dmtimer: Add dmtimer id and phys addr to dump

Change-Id: I9d669db4649a9494b70b1be848c43b2d3f2e2f17
Signed-off-by: Todd Poynor <toddpoynor@google.com>
(cherry picked from commit 67e50bc93c04b7f54797c898816bdc5c60f64d1c)
OMAP4: DSSCOMP: Check user passed arg in ioctl

Prevent stack overflow if user passes in a value
that's too large for num_ovl.

Change-Id: I86a232544f8acc6a08eca00dfdb71db41f355341
Signed-off-by: Mike J. Chen <mjchen@google.com>
(cherry picked from commit 7694dfb44c3b2175d423a21452c99b44df784cfa)
OMAP:DSSCOMP:Limit modedb_len in query ioctl

Add an argument sanity check/limit to prevent
heap corruption attacks.

Change-Id: Ib466af13dba8da6bd4d9b326cdc6b842c8f3caa7
Signed-off-by: Erik Gilling <konkers@android.com>
(cherry picked from commit 9ace2366de97000236f83c80c677decbfafc79e3)
video: omap4: dsscomp: fix warning DSSCIOC_QUERY_DISPLAY range checking

Change-Id: I3e45d0d27a31908dd2e3462bb823900af78d20e5
Signed-off-by: Erik Gilling <konkers@android.com>
(cherry picked from commit af2eb2780192ab4ca3b6bb6b7792b712e16529c5)
ARM: OMAP4: tuna: keep device out of suspend when MHL is actice

This works arounds a bug in the HDCP driver.

Change-Id: Idf95e7038b0c557c6d8ce230ed0ffb873cf5b7a9
Signed-off-by: Erik Gilling <konkers@android.com>
(cherry picked from commit fb1a6e209862e5ed7a1d6d9a65cc25a7884485cd)
misc: modem_if: link_mipi: use tx length for return before calling work queue

while running work queue or delayed work queue, skb->len might be removed.
so there could be a case that driver returns wrong return value to iodevice and rild.
it need to be saved before calling work queue to return proper value in send func.

bug: 6281406
Change-Id: If4106276720f9de70c1acc1b6fa834d02e025416
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
(cherry picked from commit a95919f1f0250bf43610965db13549229a8a975e)