staging: android: Fix two checkpatch issues in binder.c

This fixes two instances of
"static const char * array should probably be static const char * const"

I have seen other commits doing this in other files, so I am
assuming it should be done here as well.

Please tell me if this is wrong :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: android: Avoid using camelcase in binder.h

This changes the following:

1: BinderDriverReturnProtocol -> binder_driver_return_protocol
2: BinderDriverCommandProtocol -> binder_driver_return_protocol

These enums are not currently used, but still generate noise in checkpatch.

Well, did. They don't now :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: android: Add some Kconfig help entries

This commit adds Kconfig entries for the following:

	1: ANDROID_BINDER_IPC
	2: ASHMEM (additional text)
	3: ANDROID_LOGGER

It also changes "Register" to "Registers" in
ANDROID_LOW_MEMORY_KILLER

Finally, all "help" instances are changed to "---help---",
as recommended by kconfig-language.txt in order to visually
aid developers.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/workqueue.c: avoid array subscript above array boundaries

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
Re-enable -O3 optimization for kernel/workqueue.c
Version 1.2.3
Revert "USB: Prevent system suspend when HSIC device is active"

This reverts commit 1dcb4092358092e745bece4fb3b21ed8f6facb23.
Revert "USB: Allow skipping device resume during system resume"

This reverts commit 2950019d426aff63c25d527a510a1dc616f64d89.
Undo HTC's attempt to fix EHCI: HSIC: Use counter for timeout in ulpi_read()
usb: ehci-msm-hsic: abort suspend when interrupts are pending

Since the wakelock was removed, an interrupt coming during the
transition to system suspend relies on pm_stay_awake() to indicate
that the controller's wakeup source is now active. However, this
depends on pm_save_wakeup_count() to be called by the process
that initiated the suspend. The forthcoming autosleep feature will
be doing this.

But until autosleep is implemented, for robustness additionally
introduce a .suspend_noirq callback which checks for pending
interrupts and returns -EBUSY if there are any, which will force
the PM core to unwind its suspend actions.

Change-Id: If286d654b667d00a0130accb7a783258901ff760
Signed-off-by: Jack Pham <jackp@codeaurora.org>

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c
EHCI: HSIC: Use counter for timeout in ulpi_read()

ulpi_read() relies on jiffies to calculate the timeout
for read operation on phy register. Calling ulpi_read()
with interrupts disabled, freezes jiffies on local processor.
In case of phy lockup this results in infinite loop leading
to watchdog reset. Use loop counter for timeout instead of
jiffies for read operation to avoid watchdog reset.

CRs-Fixed: 388234
Change-Id: I1d46052b087c42b9f422b6f7eb691498fa104718
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
msm: hsic: Retry port RESUME if unable to send SOFs within 3ms

Due to h/w bug in hsic controller, interrupts are disabled during
resume signalling (~20ms), commit: e404049ae, which may result in
below issues
1. Delayed MDP interrupts causing display stutters
2. Since default workqueue disables preemption for 20ms, the kernel
   scheduler schedules out the worker thread for long time. It results
   in MDM crash due to delayed response
To avoid busy loop, port resume is performed without disabling the
interrupts. Due to this if resume time constraint is not met then
don't start SOF and retry RESUME after some time. This delay (w/o SOF)
lets the device to enter SUSPEND state (after issuing remote wakeup)
and followed by RESUME after sometime. Also, Move the resume code to
hsic controller driver to avoid changes to ehci upstream code.

CRs-Fixed: 383752
Change-Id: Ic4768587bbb9a00d8cf495065ec9e14c46a5c1d4
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c
USB: Allow skipping device resume during system resume

Some buses would like to keep their devices in suspend state during system
resume.  For example HSIC controller driver prevent system suspend when
HSIC device is active.  If this device is resumed, during system resume
HSIC controller acquire wake lock and prevent the subsequent suspend till
HSIC device is auto suspended.

CRs-Fixed: 403975
Change-Id: I93ccd874bf489190e4afb94b533db47bb2911db8
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: Prevent system suspend when HSIC device is active

Some buses like HSIC would like to keep device in suspend state
after system resume.  The remote wakeup or interface activity
later will auto resume the device.  This will work only if the
device is auto suspended before system suspend.  If the device
runtime state had been active during system suspend and system
suspend routine put the device in suspend, it will not be resumed
during system resume.  When remote wakeup happen for this device,
the runtime resume will not bring the device to active as runtime
core think it is already active.

The HSIC bus ensure that device is auto suspended prior to system
suspend by holding a wakelock till the bus is suspended.  HSIC bus
is not handling the case where device is auto resumed immediately
after system suspend begins.  HSIC bus simply put the device into
suspend in system suspend routine.

This patch fixes above issue by returning an error code if the device
is not auto suspended during system suspend.  Also add a safe guard
check in HSIC system resume routine to skip device resume only if it
is auto suspended prior to system suspend.

CRs-Fixed: 422876
Change-Id: I888585ed872d808aa4dbca33b529fcc32994349b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
msm: hsic: Disallow processor idle sleep while driving resume signal

HSIC controller should send SOF with in 3 msec after completing
the resume signal.  If processor is in idle sleep state, the timer
interrupt generated by HSIC controller to indicate resume completion
gets delayed.  If the interrupt handler is not run with in 3msec
after resume, the resume sequence is repeated.  Disallow processor
idle sleep to avoid multiple resume cycles.

CRs-Fixed: 397154
Change-Id: Ibc8965ad8bcd94e0b1b1d39b5b2ad8f39cf51095
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064.c
	include/linux/usb/msm_hsusb.h
EHCI: HSIC: Fail root hub bus suspend when port is not enabled.

HSIC controller can not detect HSIC device in low power mode.  Hence
controller suspend is allowed only when port is enabled.  But this
check is done in controller suspend routine.  Controller suspend is
attempted after root hub bus is suspended.  Even if we fail, controller
suspend, root hub bus remains in suspend state.  This would delay
the enumeration of HSIC device as root hub bus resume takes some time.

CRs-Fixed: 396444
Change-Id: I9cfdfb4beb458651fc81a3d22ad9ac79207514fd
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
usb: Add support to set autosuspend delay by controller driver

USB core driver sets the autosuspend delay to 1 sec for root hub and
its children by default. In case if delay needs to be changed for a
particular controller, it requires class driver to explicitly call
PM API to set the new values. Hence add a call back handler to set
autosuspend delay in controller driver. This makes class driver code
generic.

Change-Id: I62121651f0a9648a2909ca7eb4081a6c2567ed01
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
usb: Decrease autosuspend delay to 200ms upon usb disconnect

Reduce overall HSIC wakelock active time by decreasing autosuspend
delay for HSIC mdm device from 1 sec to 200ms. However when diag is
active it would send poll events for every 500ms causing frequent
supsend/resume. Avoid this by increasing autosuspend delay to 1 sec
when diag is active. Also, set autosuspend delay for root hub to 0 by
default. These changes reduce time HSIC controller is active when the
bus is idle for better power savings.

CRs-Fixed: 404378
Change-Id: I0500f6b125dff158e6e0c10f3f2023b18ce9dd30
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c
usb: ehci-msm-hsic: Remove usage of MSM_GPIO_TO_INT

MSM_GPIO_TO_INT is a platform-specific macro that should only
be used in board files, not drivers. In this case, we actually
don't need the GPIO number in the driver itself and only need
to manipulate it using the IRQ number it maps to, so perform the
mapping in the device file.

Change-Id: I99eb964f3c7c4e90a4d75d16b2b29c687c3437ca
Signed-off-by: Jack Pham <jackp@codeaurora.org>

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c

NOTE:

Adding this commit because I am trying to match the set of
commits that elkay pulled.  However, this commit is really
not complete because there are other GPIO numbers that HTC
has added that weren't corrected via this patch.
EHCI: HSIC: Add support to vote for SVS digital voltage

HSIC HW can operate at SVS digital voltage when it is active.
Currently HSIC is voting for 120Mhz SFAB and 64Mhz DFAB clock
frequencies. Clock frequencies are directly proportional to SVS
voltage. If DFAB is running at 64Mhz or SFAB is running at 120Mhz
or higher SVS is not possible even though HSIC votes for it. Hence
do not vote for SFAB clock frequency and only vote for 32Mhz for
DFAB in order to allow SVS to happen. Voting for SVS voltage reduces
current consumption by 3mA in HSDPA network.

Change-Id: I8a6844efbbe90a8ea118be8450f8210717c2641b
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064.c