msm: cpufreq: Break out early if target frequency is the same as the current

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Implement new reset sequence to workaround PHY lockup issue

commit 8e6edcb (usb: ehci: Avoid phy lockup due to SOFs during port
reset) implements a workaround for PHY lockup issue during port reset.
The workaround relies on a hardware debug feature which allows driving
strobe and data lines to reset using ULPI interface.  This is not
working some times for unknown reason.

This patch implements a new reset sequence to workaround the PHY lockup
issue.  The controller drive reset signaling for ~50 msec when reset bit
is set in PORTSC register.  The controller automatically clears this bit
after finishing the reset signaling.  The software can also finish the
reset signaling any time by clearing the reset bit.

According to USB2 spec, Host controller should drive reset signaling for
50 msec for root hub ports.  But HSIC spec allows shorter reset signaling
time (20 msec).  Clear the reset bit in PORTSC register after 20 msec and
start controller immediately to send SOF.  Use controller internal timers
to achieve this.  If reset bit is not cleared in time, perform the sequence
in a loop with interrupts disabled.

CRs-Fixed: 445659
Change-Id: I884cfcd8a53b111bc9434e47ef483dde64fcc1ed
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
USB: ehci-msm-hsic: Make driver less verbose

Don't print messages while entering and exiting low power mode.
Use /sys/devices/.../power/runtime_status to query the state of
HSIC device.

CRs-Fixed: 455012
Change-Id: I4e8a56b67dfdb8f685373d2eabe1c9e3ef499eca
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Halt the controller while resetting the port

commit 9ecc39cd (EHCI: HSIC: Implement new reset sequence to workaround
PHY lockup issue) does not halt controller before proceeding to reset
sequence.  If the controller is not halted and SOFs are transmitted, PHY
may stuck during port reset.

CRs-Fixed: 459280
Change-Id: I213ca7d41420596b91eb9b5e6803d1e237167136
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ehci-msm-hsic: Add support for ASYNC IRQ to exit LPM

Some HSIC controllers have dedicated IRQ line for ASYNC interrupts
to notify any wakeup event during low power state. Add support for
the same.

CRs-Fixed: 452718
Change-Id: I63f7b21c8306e043128e3c4cae32732a3af60e67
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
USB: ehci-msm-hsic: Don't mark all IRQs as wakeup capable

Some HSIC core interrupts might not be capable of waking up system
from suspend (or XO shutdown) if they are not routed to MPM.
Marking such IRQs as wakeup capable may prevent system from entering
suspend.

Change-Id: Iace7214f7d847f2dc210a9021da08157cfb5bd15
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
ehci: hsic: Add resume gpio support

some peripherals connected to hsic controller cannot wakeup from XO
shutdown using in-band bus resume signalling. If present, use resume
gpio to bring peripherals out of XO shutdown before resuming the bus.

Change-Id: I7b80c95f31e854a09e673a9367ab85e4977a0fa0
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ehci-msm: Prevent USB resume during system suspend

MSM USB host controller drivers release wakelocks only after
USB bus gets suspended. This means that at the time of system
suspend, USB devices and controller are already in suspend
state. As there are no additional power savings by disabling
wakeup capability during LPM, hence, mark HCD bus's skip_resume
flag so that USB core doesn't try to resume devices during suspend
to change remote-wakeup flags. This also avoids unnecessarily
resuming USB BUS when coming out of suspend even if there is no
wakeup USB event.

Change-Id: Icf0aa8001cde6bfc5cc5b148a34e344a3015ac58
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
USB: ehci-msm-hsic: Fix unbalanced IRQ wakeup disable warning

Fix driver remove function to call disable_irq_wake only if
it was enabled.

Change-Id: I6efc28fce0555955e8f4769885d5226f202a5592
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Abort system suspend if controller is outside LPM

98089c0d commit (USB: Prevent system suspend when HSIC device
is active) ensures that USB devices are auto suspended before
system suspend begins.  Apply the same policy to HSIC controller
platform device.  This will cover the corner case where controller
and root hub are resumed after root hub system suspend routine
returns success.

CRs-Fixed: 482498
Change-Id: I604b24775e1c2f52020161c236c44c20d579d5e0
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Revert "cpufreq: interactive: fix a bug and remove some, in my opinion, useless code."

This reverts commit 2b193a2a9a54228d576debc195a1da8d4b13df3f.
cpufreq: interactive: reverted last patch to fix a 3-4fps loss, but still need this commit to fix a bug where the freq could be stuck at 1GHz depending on the input_boost_freq.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Merge remote-tracking branch 'upstream/nightlies' into nightlies
Merge branch 'nightlies' into test