ARM: msm: hammerhead: Fix VA locale revision

Bug: 11172689

Change-Id: I892ad17b0d336842aa77259b2aaab3b288bcdb3c
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
net: wireless: bcmdhd: fixed power consumption issue of P2P.

	solution : add wake_lock not to go to suspend during removing P2P GO
	interface in wl_cfg80211.c.
	Description of this issue :
	if device goes to suspend during removing the interface,
	we will fail to remove P2P GO virtual
	interface(p2p-p2p0-0).
	This will causes P2P GO still alive in firmware
	Bugnizer case id : 10874302
	This issue is reported by LG team.
Signed-off-by: Ecco Park <eccopark@broadcom.com>

Signed-off-by: Dan Trifan <jimsth@gmail.com>
net: wireless: bcmdhd: Fix country checking

Bug: 11319610

Change-Id: I5c52ed594614d8039f167de3c98bd9f802b521df
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "msm: kgsl: schedule the event queue after the dispatcher work queue"

This reverts commit 4f36f4e8474b15812f4d660206519b214daf5d06.

Change-Id: I2d9a7b89aebc7fb548531dbecb791f2b2f5b4526
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: kgsl: Re-run the events handler when inflight goes to zero

The event code is sensitive to race conditions with the GPU. We just
can't spend all day the event loops waiting for timestamp to expire.
The dispatcher loop on the other hand is far less sensitive to the
race with the GPU so we have a very good idea when the GPU is idle.

When inflight goes to zero re-run re-queue the event handler to catch
any stragglers.

Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:

	drivers/gpu/msm/adreno_dispatch.c

CRs-fixed: 551825
Change-Id: Ic0dedbad9d02fca89724bf791d9c7212712a8014
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: thermal: set the core_control_enabled after offline cores update

The variable for offline core is not yet updated in the initial state, but
msm_thermal try to control core at that time and may access the
offlined core(s). It would cause the watchdog bite due to this.

Change-Id: I6abd55b22f3e09ab44e8df0d6fbb8e82cd9e482c
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
USB: android: Handle error conditions if usb_add_config fails

This is missing changes of commit 0f12d93e06af8 (USB: android: Handle error
conditions if usb_add_config fails" when cherry-picking this.

Change-Id: I9ce4f28c6af73420f6b8dda0f8538d2da114087d
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
bluetooth: unlock spin on bluesleep_stop before controling the hsuart power

Kernel migh be in sleep to wait for rpm communication when it controls the
hsuart power. So should unlock the spin before controling the hsuart
power.

Change-Id: Ic051ee95df8be3e7dcea1bc71cba85bdbab34bef
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm_serial_hs: Fix the unbalanced clk_count

If clock vote is failed, clk_count is added. It may cause the unbalanced
clk_count. Also it's possible to be nagative clk_count on unvote. So do
not decrease the clk_count if it's already zero.

Change-Id: Ic63efd9447a18caaa8fabada4d4cae90558c8785
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm_serial_hs: check the returned value of clock vote

If voting clock is failed, we should not access the registers.
It may cause a crash to access the unclocked register.

Change-Id: Ifb75dd68696719905b373c4a276c4dc2d917f2fe
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm_serial_hs: vote for clocks in tty functions

to avoid accessing the unclocked registers.

Change-Id: I17af31b54e2c6288a5284b51670506c44a344fe8
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm_serial_hs: Fix race condition with BAM rx pipe

Crash observed due to the race condition with bam
rx pipe during sps_disconnect and sps_transfer_one
operations executed at the same time on two CPUs.

Because of this race condition rx bam descriptor
pointer becomes NULL and accessing of this pointer
leads to crash.

This patch waits for sps_transfer_one function to
complete, if it is in progress, before calling
sps_disconnect function from the set_termios.

https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.10/commit/drivers/tty/serial/msm_serial_hs.c?h=msm-3.10&id=478fe086cb075301da4488e3e9e02683b2409084

CRs-Fixed: 534029
Change-Id: I7581062a17a3dc7ede8eb58e4d25e3b517812ab2
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Patrick Tjin <pattjin@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: unmap user writeback buffers after session is terminated

Currently if buffers are provided to writeback driver through user space
ioctl, these are never unmapped and may cause leaks in memory. Also, we
can reuse the nodes which are already mapped until session is
terminated.

Change-Id: Ic786dfa735af529998bfc9467ac872b2badc0e31
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: allow re-queue of writeback buffers

When a buffer has been properly processed, user space may choose to use
sync fence to acknowledge when buffer is complete. In such cases dequeue
is not not necessary, allow this use case by allowing client to re-queue
of writeback buffers as long as the buffer has been properly processed
already.

Change-Id: Ibac1eb9710477734e1ee2daf8136085d4439b0d4
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: ctl null pointer checks after display commit waiting

After display commit, display thread is waiting for the commit done,
if shutdown happens during this waiting period, the ctl patch could be
nulled. Adding ctl pointer null checks could avoid crashes.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Bug: 11429494
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm8974_pwm_vibrator: Use the dedicated workqueue

Use the dedicated workqueue for quick response. There may be some delay
for the other workitem schedule when we use the system workqueue.

Change-Id: I0ba7269f6dfd12b177a2fe1b1329cbef169f6859
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm8974_pwm_vibrator: Clean up codes

Change-Id: I5ef3bb3bf21f438712de7fe7e63e368707bc890c
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm8974_pwm_vibrator: rework for vibration start/stop

To be flexible, we use the delayed workqueue instead of usleep.
And the driver already support for vibrator stop. So We don't need to stop
it repeatedly. We need a force stop only when upperlayer send a stop signal
during vibing.

Change-Id: I6940119924f6b6919453fde60dc56cb7eb46aa39
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
arm/dt: hammerhead: Enhance the feedback feeling

Add the braking/driving force feature to enhance the feedback feeling.
The braking avoid the residual vibration. The driving force enhance
the feedback feeling

Change-Id: Ibf739296d2ec0e0a88736a6bdb0859637f7e34a2
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm8974_pwm_vibrator: Enhance the feedback feeling

Add the braking/driving force feature to enhance the feedback feeling.
The braking avoid the residual vibration. The driving force enhance
the feedback feeling.

Change-Id: I0f7c40f5579f9ce014057a481d128d4f7d830a9a
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>