power: decrease the amount of time the device waits after entering low power mode to freeze processes. Testing phase at the moment.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: thermal: export CPU temp to the userspace every polling rate. Also add another step for throttling if the CPU gets really hot.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
input: evdev: Move wake_lock_destroy call

Calling wake_lock_destroy from inside a spinlock
protected region (or, in general, from atomic context)
leads to a 'scheduling while atomic bug' because the
internal wakeup source deletion logic calls
synchronize_rcu, which can sleep. Moreover,
since the interal lists are already protected with
RCUs and spinlocks, putting the wake_lock_destroy
call in a spinlock is redundant.

Change-Id: I10a2239b664a5f43e54495f24fe588fb09282305
Signed-off-by: Anurag Singh <anursing@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: pm-8x60: Add early return to msm_pm_enable_retention()

If retention is already disabled, it is not necessary to send IPIs to
the running CPUs to wake them up. Insert an early return for this
scenario to reduce overhead during Krait rail voltage scaling, which
calls this API on every voltage change.

Change-Id: I5db0bafae187ff8a68488e86d4787df9c45787e4
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
board: mako: reduce reserver RAM for logs.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
init: main: commented out ftrace_init() because I don't use ftrace for released kernels, only for my own debugging. Should save few ms during boot.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: thermal: temp already exported here: /sys/devices/virtual/thermal/thermal_zone7/temp

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Sound Control: enable negative values.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
prima: disable some more crap flags.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Revert "debug: remove frame_pointer."

This reverts commit fb6fa0b16941a82922fd0b872373e4e053d715e2.
Add custom Mako Hotplug driver for onlining and offlining cores based on system load.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako_hotplug: fix some bugs, increase load levels by 10% each, queue the works in a dedicated workqueue, reduce the number of divisions every work call, fix a possible memory leak.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Check for received data upon unlinking the urb

There is a possibility of runtime suspend in the middle of
data transfer on the rx data path of driver. This results in
the completion of data transfer on bulk IN endpoint with short
packet or integral multiple of 512 bytes. Hence for -ENOENT
transfer status check for non-zero data length and pass it to
the consumer in the userspace. Also, replace printk with
DBG-level message in driver suspend function and in rx
callback function for -EPROTO urb status.

CRs-Fixed: 394954
Change-Id: I26f4081869377000d163649b3a860386ff9c3806
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Add support for autosuspend

ks bridge driver needs to add support for autosuspend
for 9008 PID. This change allows for the device to be
suspended when there is no active traffic, and USB
remote wakeup is used to signal a resume to the host.

CRs-Fixed: 397969
Change-Id: Id4f1083c7f136e027778c1d6b08f3b3a6048f7e7
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Fix memory leak in tx data path

ks bridge is allocating urb to transmit data to mdm.
This urb is not getting freed after transmit completes.
Hence call usb_free_urb() after urb gets submitted
successfully. Urb will eventually be freed after tx
completion.

CRs-Fixed: 401536
Change-Id: I7e0bc7d1de74613f6b3b019d1513e22ad9765709
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Fix bug in partial read on data buffer

If driver copies only partial data buffer to user space
it does not update the buffer pointer. In this case
buffer pointer is still pointing to the already read
buffer and will be copied again in next read request
from user space. This corrupts the contents of the
efs file or ram dump files. Hence update data buffer
pointer with length of memory read completed by user
space.

CRs-Fixed: 403250
Change-Id: I48217aeeb2ee5ad05089922c6a7793195b95ce0c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Synchronize disconnect with ongoing IO

Following scenarios possible for interface disconnect racing
with ongoing IO:-

1) Interface disconnect setting interface pointer to NULL and
rx work is executing on other core dereferencing interface
pointer, causing kernel panic. Cancel a work and wait for it
to finish during disconnect.

2) Interface disconnect setting interface pointer to NULL and
tx completion running on other core dereferencing interface
pointer while calling usb_autopm_put_interface_async() API.
Check for USB_DEV_CONNECTED flag(cleared at the time of
disconnect) before dereferencing the interface pointer.

3) Interface unbound and driver is accessing already freed
interface pointer in tx completion or usb device pointer to
re-submit rx urb in rx completion. Add rx and tx urb pending
counters and wait for them to become zero (or timeout) during
disconnect.

Change-Id: I75c0284136dda8b0e1b76c326e80e0c3efb41d5c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Free up stale buffers in probe

Driver can add data buffer to the link list of rx/tx
buffers after emptying the list during disconnect.
These stale buffers can confuse efs sync server when
mdm device connects back. Hence free up the rx/tx
buffers again during probe. Avoid further addition of
tx buffers after disconnect by checking device
connection status in write API. Also, move
misc_deregister() after cancelling the work in order
to remove device node early during disconnect to avoid
any write call further.

Change-Id: I0641669afcf1e1aec36d7c619dc8922495f446d0
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
HSIC: Add support for product id 9075

Product Id 0x9075 includes DIAG, SER3(System monitor), SER4(EFS sync),
DUN, CSVT, NET1(Tethered RmNet) + NET2(Muxed Embedded RmNet) device
interfaces.

Change-Id: I75f61445af0ff9eab3d8f22bc2239011a9495e0e
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
usb: ks_bridge: Avoid allocating large buffers in atomic context

The current code allocates a new Rx buffer in Rx completion handler.
Rx buffers are freed after user space consumes them.  This results in
allocating larger buffers in atomic context which may fail some times.
Don't queue the Rx buffer immediately. Defer it till user space consumes
it and reuse the same buffer.  The test results indicate no throughput
degradation.  The Rx buffers will be freed when interface is suspended
or disconnected.

CRs-Fixed: 430595
Change-Id: I8e69e27df2e11b38497e0384a8edd87ecedcb24b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>