Revert "drivers: otg: add USB fast_charge."

This reverts commit e920a46a3bbe856b69ec3ea3d2f1e3973c2162ca.
USB force fast charging

-Use base from Chad Froebel <chadfroebel@gmail.com> so we continue to
use the same generic sysfs mechanism

-Referenced franco's git for drivers/usb/otg/msm_otg.c changes
https://github.com/franciscofranco/mako/commit/5a8a4c8e23c7e1df39c740b9ce1d5dda20b0ede3

Off by default

Turn on:
echo 1 > /sys/kernel/fast_charge/force_fast_charge

Turn off:
echo 0 > /sys/kernel/fast_charge/force_fast_charge
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: power: pm8921-charger: lets remove all these checks to make sure the vdraw will be boosted if fast charge is enabled. As we can't remove the battery the this_chip checks are useless as well.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
auto_hotplug: add back a small buffer to make an average of the load based on the last 9 loads in the last 9 samples. Will had a ringbuffer in the original code so this is not new at all, just made a little rework comparing to the original buffer implementation.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
pm8921: remove another check.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Fix GPT timer count values used for resume sequence

The counter value to be loaded into GPT timer represents the time
in micro seconds minus 1 for the timer duration.  The current code
incorrectly programs the timer.  Fix it.

Change-Id: Ief8039b4e75910001d31a7c05b3b274e6e66c2da
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Handle asynchronous interrupt properly

Runtime PM resume and asynchronous interrupt can run in parallel. When
this happens, there is a possibility of PM usage counter mismatch.
Fix this by checking the return value of pm_runtime_get() and by
disabling the USB interrupt while resuming the HSIC.

Consider asynchronous interrupt case when resuming HSIC during system
resume.

CRs-Fixed: 444883
Change-Id: I315fb6cecffcea83c03037be899e3ff840791c21
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Disable asynchronous interrupt when wakeup gpio is present

Controller can generate interrupt asynchronously in low power mode (LPM).
Enable this interrupt in USBCMD register only when wakeup gpio IRQ is
not available.

CRs-Fixed: 444883
Change-Id: I8f68fa63c1c086990ff429cd1224e14a1d34654b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
usb: host: read bus scaling parameters for HSIC host

Use a bus scaling device tree parameters for the HSIC host node.

Change-Id: I93f57400c6a2a4da2634b50fd67f2d6015eab9c2
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: franciscofranco <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: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: Fix a race between root hub resume and controller removal

The pm_qos request is removed before unregistering the HCD in remove
function. If root hub resume runs in parallel, there is a possibility
of adding the pm_qos request back to the active list. The pm_qos request
memory is freed after unregistering the HCD and this would lead to
pm_qos list corruption. A crash is observed when another driver is
submitting a pm_qos request after HSIC controller is removed during
shutdown.  Remove HCD prior to releasing controller resources.

CRs-Fixed: 444928
Change-Id: Iaed6964e7d4245b8ae6c295ed6c76f5a9d32e20f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
usb: ehci-msm-hsic: Restore CMD_RUN bit in ehci->command after resume

EHCI driver maintains a copy of USB_CMD contents in ehci->command
variable.  CMD_RUN bit is cleared from this variable to delay SOF
till port is resumed. Restore this bit back in ehci->command after
resume is completed otherwise ehci driver may later use stale
ehci->command value to update USB_CMD register clearing CMD_RUN bit.

Change-Id: I672aa14140f44a8de8757d84fe2305693da18130
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: franciscofranco <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: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: fix driver removal function for msm_hsic_host

Upon driver removal function we need to disable the device pm runtime
in order to, first, undo all the logic done in probe and second, to keep
balanced disable depth counter in case of platform driver unbind.

However the removal function can be called also in consequences of
platform_device_del(), in this case the platform device was already
disabled and removed so if we call pm_runtime_disable() again we
decrease the disable_depth for the second time causing for unbalanced
counter.

Therefore we use an if statement to check if the device was already
removed or not.

CRs-Fixed: 445674
Change-Id: I5ff6b20d0f8e811a5c673903ca340f7bcc2e2d78
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
EHCI: HSIC: disable pm runtime device before remove hcd

Merge order of commits 21a480e and e50d914 introduced runtime pm
disable depth counter imbalance fixed by e50d914 again. Fix the
bug by disabling runtime pm before removing HCD.

Change-Id: I249a4f63db3a975652e6ce15545584e41bae284b
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: franciscofranco <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: franciscofranco <franciscofranco.1990@gmail.com>
msm: msm_bus: Add device tree support for bus scaling clients

This patch enables clients to specify vectors in device tree
format. Clients will no longer need to specify vectors in
the boards file. Instead, they can add the bus-scaling
related data to their own device-nodes.
The clients can then call an API exposed by the bus driver
which will build the pdata out of those strings.
The registration process using pdata remains unchanged.

Change-Id: I1bba645d031e2cd822f16d8edcdf926a0418618c
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
PLACEHOLDER: lock device as a quad core on intensive GPU work.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: kgsl: unprepare clocks when we move from NAP to SLEEP

The existing code leaves clks prepared when we transition from
NAP to SLEEP. We fail to reach Vdd_min as voltage scaling has
moved to prepare/unprepare.

Change-Id: I509f4c6bd217ead985890147819236dd2c5d03ce
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
block: row: Re-design urgent request notification mechanism

This patch updates the ROW URGENT notification policy to apply with the
bellow:
- Don't notify URGENT if there is an un-completed URGENT request in driver
- After notifying that URGENT request is present, the next request
  dispatched is the URGENT one.
- At every given moment only 1 request can be marked as URGENT.
  Independent of it's location (driver or scheduler)

Other changes to URGENT policy:
- Only queues that are allowed to notify of an URGENT request pending
are READ queues

Change-Id: I17ff73125bc7a760cea1116b466115a2df635a14
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>