usb: musb: Add a BUG_ON if trying to suspend musb in B_IDLE state

Musb sometimes failes to be suspended because it is active and in the
B_IDLE state. When this happens, USBPHY is left on and we don't hit OFF
mode. Add a BUG_ON to reboot in that case as it is better than emptying
the battery and so that we can see how often this happens.

Change-Id: Ic8d8c6918f3b9a8f0671f484d5d72fae63d7a61d
Signed-off-by: Benoit Goby <benoit@android.com>
(cherry picked from commit 8ebb62bd38adcbef29a457a064f61c1d9bb5526c)
usb: musb: Change BUG_ON to BUG to catch the issue as soon as it happens

Bug: 5696789

Change-Id: I660025d8632076cc6bf81cc7026677e7c1bca6d3
Signed-off-by: Benoit Goby <benoit@android.com>
(cherry picked from commit fc3549ec89476922cc60ef15e5024bc46196a036)
misc: modem_if: link_mipi: Reset mipi phy when receive wrong packet

1. use mipi sw reset after get wrong packet for recovery.

Bug: 5852314
Change-Id: I8cd0ba82d913777d82a59284a657b42e318635ae
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
(cherry picked from commit 60f7431da02f7e01cb1a0947142dc82989188671)
ASoC: dsp - BE disconnection after pending flag is clear

Currently we can disconnect a BE and have its update flag incorrectly
set after reparenting. Fix this so we always clear the update flag
before any disconnections and reparenting.

dsp_run_update_startup() also called disconnect but this was always
called anyway by its caller soc_dsp_runtime_update() before the update
flag was cleared.

Change-Id: If0cde4c9df845a7189188bb49e6fb4fd496a925d
Signed-off-by: Liam Girdwood <lrg@ti.com>
(cherry picked from commit a567f64d8c023eabe0f3e86217f74eb96da51f8f)
ASoC: DSP: Split runtime startup/shutdown updates

A FE->BE-1 link can transition to FE->BE-2 in a single widget/kcontrol
change (e.g. Muxes). Currently, DSP framework searches for new and old
paths of the FE, and then perform the startup/shutdown runtime updates.
The single-step FE->BE-1 to FE->BE-2 transition has both: new and old
paths to be updated, hence BE-1 and BE-2 will be marked for runtime
update. However, startup and shutdown updates will both be performed
on BE-1 and BE-2, which is incorect as it would be expected to run
startup update on BE-2 and shutdown update on BE-1.

In order to handle these scenarios, the path search (new and old) is
performed along with its runtime update (startup and shutdown).

Change-Id: I5a687d6fcc51a968d9b0ae52d749935a92f00ef7
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>
(cherry picked from commit ce033dd23e15ce0b3f9b532230dbb53569b45687)
misc: fsa9480: don't enable FSA IRQ when VBUS IRQ is enabled

We should never enable two detection IRQs inside the FSA9480
driver, otherwise we can get into a situation where we enable
the FSA IRQ multiple times. One way this can happen is if the
FSA IRQ fires when the VBUS IRQ is enabled and we end up
redetecting the same state (i.e. AV_365K_CHARGER).

Change-Id: Iefcf71c88451056b2be318284b0eadc16997e6d9
Signed-off-by: Simon Wilson <simonwilson@google.com>
(cherry picked from commit fdb758850fdbe03199cf75dfb1b622ebba789a8b)
OMAP4: HWMOD: UART1: disable smart-idle.

UART module gets stuck in transition when smart-idle enabled.
By enabling HWMOD_SWSUP_SIDLE flag in UART1 HWMOD, ensures that
module's smart-idle feature is disabled and it is put to
forced-idle and no-idle during pm-runtime.

Seen similar issue with UART3 and was fixed by enabling
HWMOD_SWSUP_SIDLE flag in uart3 HWMOD.

Change-Id: Id1d97a498a5ffd7323be15be0ba8d0fc02e6df85
Signed-off-by: Ambresh K <ambresh@ti.com>
(cherry picked from commit 7180250e44e1ac6c0de4eab45f8968a3381b96a5)
OMAP4: TWL: ensure PREQ1 results in all active VCOREs to be down

Map VCORE1,2,3 appropriately to PREQ1 APP processor group so that
only APP processor can control it's power down status when OFF
mode is hit. Normally, OMAP sends a OFF voltage command to setup PMIC,
However, it is equally important to ensure that TWL will switch
off the relevant rail when the OFF voltage != 0.

Change-Id: Id623ecdd26bee0504058132835e0112bac1a630e
Signed-off-by: Nishanth Menon <nm@ti.com>
(cherry picked from commit 0108824b506b2aa6029e06a392c66531c51fc2eb)
OMAP4460: TWL6030: Setup VDD_core OFF voltage to retention voltage

VDD_CORE must not be turned off before VDD_MPU due to OMAP4460
shifter/isolation implementation between MPU_VD and CORE_VD.

Since PWR_REQ is being used for voltage control, this situation
can be handled by using off voltage as retention voltage. This
contributes to the dummy I2C_SR command to setup the voltage
prior to the voltage going down to 0V for VDD_CORE along with
PWR_REQ going low when device OFF mode is achieved. When
device OFF mode is not achieved on an attempted OFF mode,
this has no impact.

Change-Id: Iceb41fbf6b361887c45eeba528ed7f836cff6482
Signed-off-by: Nishanth Menon <nm@ti.com>
(cherry picked from commit 058ca02094f8a9bd27b084f414c093fb4df31448)
OMAP4: PM: TPS6236x: ensure rampdown occurs fast on shutdown

Enable the discharge capacitor to ensure ramp down occurs fast.

Change-Id: I625b75e87e3a22239c14a3d22a3f7752999c05f1
Reported-by: Baek.Kyung-Han <wildtaz.baek@samsung.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
(cherry picked from commit 37d2aca3e8c07162f5152c1865d2a6fe9f57b1af)
omap4: tuna: Drop soft lockup detector timeout to 10 secs

To trigger prior to watchdog timer.

Change-Id: Ia9197b57ef0a288b554f2879f180d71334c65565
Signed-off-by: Todd Poynor <toddpoynor@google.com>
(cherry picked from commit 8716f561020d49442f7b7e3d801abeba62da9d72)
ARM: omap: sched_clock: Don't let sched_clock tick during suspend

The register used by sched_clock continues to count while in suspend.
The timer that is used to prevent wraps, which normally fires after
90% of the register wrap time, does not count in suspend.  This
causes the timer to fire after the register has wrapped, which can
cause sched_clock to wrap.

Track an offset value that is updated in suspend and resume to cause
the register read by sched_clock to appear not to count in suspend.
This will cause the sched_clock time before and after suspend to
be the same, but will prevent sched_clock wraps after 131072 seconds
(36.4 hours).

Change-Id: I37054a13232c3a4320a5a49fd99e8ab0c2d1c4fb
Signed-off-by: Colin Cross <ccross@android.com>
(cherry picked from commit 3e367ee08938d2711ca4db0a40999684329ba628)
usb: musb: Disable SESSREQ and VBUSERROR interrupts

Disable the SESSREQ and VBUSERROR interrupts since we don't use them.
if we receive them, the otg state machine will enter a state where it
prevents suspend.

Bug: 5696789
Change-Id: I8cb4824056230c33fee9e810c19f5557fa2840c9
Signed-off-by: Benoit Goby <benoit@android.com>
(cherry picked from commit 34b0c024fa3648df0136f8b28a2a6db8c412cab3)
Revert "usb: musb: Add a BUG_ON if trying to suspend musb in B_IDLE state"

This reverts commit 8ebb62bd38adcbef29a457a064f61c1d9bb5526c.
(cherry picked from commit 159f916e819405fa2399a73763e3dbc117cf1a11)
TWL6030: Add extra debugging around rtc and waking

This adds during:
 - setting/reading the RTC Alarm (once or twice a minute)
 - wake IRQ checking during suspend (each time the device suspends).

Even in case of an RTC alarm failure it will not spam the logs.

Change-Id: Ic3a19f6828777edbc3cd330fc8e874fe95c4e7d5
Signed-off-by: JP Abgrall <jpa@google.com>
(cherry picked from commit b2e44efa8493d677f5b7b83d191ca741f6767c2e)
ASoC: Tuna: Reduce S/PDIF power down time

Reduce S/PDIF pmdown_time in order to prevent S/PDIF's power-down
to affect audio paths that ignore suspend during voice call.

Change-Id: I5fe32ed315e3bdbffb995a400646871fb4bcdf1c
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
(cherry picked from commit e99370ddddb2131356a585e46a41d92139d80419)
Revert "Revert "mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used""

This reverts commit 3ace7831ab80ee38d3d387337ed4e20f98cd53a0.

Change-Id: I1afd0e0c09812619b2f4e1c472ccc65c58e712e3
Signed-off-by: Todd Poynor <toddpoynor@google.com>
(cherry picked from commit f2a12a5b44aefc35698930ffde0edd2c8250fff6)
mmc: omap_hsmmc: Prevent calling mmc_host_lazy_disable() on suspend path

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
(cherry picked from commit ec29a3452941d7410e024671399798ea442d8a05)
ARM: omap4: tuna: Add panel configration for SM2A2 Line support.

change list.
 -. SM2A2 Panel Id value is '0xA2'.
 -. Add factory info for SM2A2 line panel.
 -. Add panel data for SM2A2.

Change-Id: I82addbf29bab4533845caf632676592d11d9950d
Signed-off-by: swin.kim <swin.kim@samsung.com>
(cherry picked from commit 21f62a01a5c189690e7b7b6ea84e853dd41462bb)
DEBUG: rtc: twl: add register dump if RTC did not fire on time

If on waking up from suspend, we can expect an ALARM event. However,
in such a scenario, if RTC current time is greater than alarm time +
60 seconds, it could indicate an missed event notification to
users of twl rtc, so dump registers to provide better debug
information.

Change-Id: If89a92b147857ef23726d1eabfe36939e8371779
Signed-off-by: Nishanth Menon <nm@ti.com>
(cherry picked from commit d1bf98d20887e1a2a7cd8575605b67be7d8fe765)