mako_hotplug: if the cores go online one by one we still want the performance tunables if we hit the second level threshold with all the cores online for at least 5 seconds.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
cpufreq: interactive: improve governor routines, clean up old crap and remove tracing. Also add 3 tunables.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako_hotplug: adapt according to the new interactive code.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
cpufreq: interactive: fix a bug and remove some, in my opinion, useless code.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako_hotplug: increase first_level to 90.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
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>
msm_otg: hack to allow externally powered usb host mode

Force ID_A (host mode + charging) on detection of proprietary charger (Apple-compatible charger with voltage on D+/D-).
Unforce ID_A on PMIC: BSV clear (detection of loss of charger).
Simulate ACA since using ID_A for host mode (prevents host from getting stuck in suspended state).
Two test cases for detection of actual proprietary charger (extra debug output for now).
Remove charge current limit in host mode (ID_A).
Enable debugfs /sys/kernel/debug/msm_otg/mode for manual otg mode manipulation.
Always force requested mode (debugfs).

Note: ID pin detection not working (perhaps due to Slimport), hence the "alternate" triggers used to switch to/from host mode.
msm_otg: move ID_A forcing to ACA detection (workaround for proprietary chargers)
Move ID_A forcing to ACA detect so that automatic host mode can be disabled by disabling ACA (# echo disable > /sys/kernel/debug/msm_otg/aca).
No longer need to simulate ACA since (debug) ACA will now be forced.
Remove test cases for actual proprietary chargers since they were causing false positives (manually disable ACA to use proprietary chargers).
msm_otg: start charging immediately when entering host mode (compatibility with proprietary chargers)