PM / sleep: unregister wakeup source when disabling device wakeup

When enabling a device' wakeup capability, a wakeup source
is created for the device automatically. But the wakeup source
is not unregistered when disabling the device' wakeup capability.

This results in zombie wakeup sources, after devices/drivers are unregistered.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: flar2 <asegaert@gmail.com>
soc: qcom: smd: Register SMD & SMSM IRQs with IRQF_NO_SUSPEND flag

During system suspend/resume path IRQs are temporarily disabled unless
the IRQF_NO_SUSPEND flag is specified. If a wakeup-enabled interrupt
comes in during this timeframe, it will be masked until the suspend
process is complete leading to delayed processing.

Register the SMD and SMSM wakeup enable IRQs with IRQF_NO_SUSPEND flags
to avoid delaying the interrupt during system suspend/resume path.

CRs-Fixed: 724932
Change-Id: Ib93c911f4a4e70638ebf23bc22ee7f5a685dca70
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
qcom: rpm-smd: Mask the interrupt before sending the sleep set.

Sending a sleep set would cause an SMD interrupt to fire. If the
interrupt was previously affine to a different CPU, it could cause a
premature wakeup of that CPU. Prevent this by masking the interrupt
before sending the sleep set.

Change-Id: I45734c6fa52b7f69c0d68c5b3cd221185a516248
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
net: wireless: bcmdhd: Enable dongle_isolation for PCIe/built-in type driver

b/17755061 Wi-Fi stuck in Off position

Signed-off-by: Ritter Yeh <ryeh@broadcom.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: I70dc1385266fe26ef3a57116e653efab03fc33cf
Signed-off-by: flar2 <asegaert@gmail.com>
net: wirelss: bcmdhd fixed pcie suspend/resume issue

Sometimes, system doesn't recover the config registers during resume
due to wakelock.  So, we need to save and restore the config registers in DHD

b/18220535 [WiFi] - Watchdog reset after PCIE link down and Event Hang

Signed-off-by: Ecco park <eccopark@broadcom.com>
Change-Id: Ib796b4833119a27bd79e3a667e40ee1e4d4878df
Signed-off-by: flar2 <asegaert@gmail.com>
net: wireless: bcmdhd: Allow preallocation for WLFC_INFO

Bug: 18303260

Change-Id: I1602fa0706270071abe36797039af74670f1c734
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

Conflicts:
	drivers/net/wireless/bcmdhd/Makefile
Signed-off-by: flar2 <asegaert@gmail.com>
net: wireless: bcmdhd enable STATIC MEMORY ALLOCATION

b/18187102 APR: kernel BUG at mm/vmalloc.c
Signed-off-by: Ecco park <eccopark@broadcom.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: I9b53792487a0078ecd3240ad92e96dd702a1724b
Signed-off-by: flar2 <asegaert@gmail.com>
net: wirelss: bcmdhd fixed disconnect issue for connecting status

Sometimes Framework issues connect and disconnect rapidly and continuously
with different APs.  In this case, the timing gap between connect and
disconnect is less than 20ms.  For this scenario, FW doesn't do anything
when DHD executes dissasoc while state of FW is associating status.  In
order to cancel current assoc procedure correctly, we need to call
scan_abort function, not DISASSOC.  FW will clean up ongoing assoc
procedure if FW is associating status.

b/18470879 Device stop responding after conducting rapid fire testing
           for making connection

Change-Id: Ib440da06eb10313c478c004d1d73ed1b4e29a201
Signed-off-by: Ecco park <eccopark@broadcom.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>

Conflicts:
	drivers/net/wireless/bcmdhd/wl_cfg80211.c
Signed-off-by: flar2 <asegaert@gmail.com>
net: wirelss: bcmdhd fix roaming bug

1) Bug : 18541286 wifi stuck on connected to an AP when N6 was miles away
we should update BSSID in wl_bss_roaming_done, not wl_notify_status for roaming case
It causes out-of-sync between FW and DHD
Signed-off-by: Ecco park <eccopark@broadcom.com>

Change-Id: I75e706d63aa962c8c2640797e2af6811990c989d
Signed-off-by: flar2 <asegaert@gmail.com>
net: wireless: bcmdhd abort ongoing-scan for disconnection

sometimes we cannot get WLC_E_DEAUTH due to ongoing-scan
We need to abort ongoing-scan for disconnection

Bug: 18634452
Signed-off-by: Ecco park <eccopark@broadcom.com>
Change-Id: I2c416738418ce4915dcfbaa57bb3d701269eecc8
Signed-off-by: flar2 <asegaert@gmail.com>
net: wireless: bcmdhd reduce kernel logging

Bug : 18226601
Signed-off-by: Ecco park <eccopark@broadcom.com>

Change-Id: Iec8172bf803b76517136d1a8903027b5ed162d31
Signed-off-by: flar2 <asegaert@gmail.com>
Revert "qcom: rpm-smd: Mask the interrupt before sending the sleep set."

This reverts commit 2ec46991c8364772259a162d865eb930f472d805.
Revert "soc: qcom: smd: Register SMD & SMSM IRQs with IRQF_NO_SUSPEND flag"

This reverts commit de4ed2c1e92c2bef6b4006b4f0f8d3403d27566d.
Revert "sched: Micro-optimize the smart wake-affine logic"

This reverts commit 001c02c2e3acecb4a6d397954495bbb798b5ded6.
Nexus 6: USB fastcharge
Wake gestures: disable during phone calls, haptic feedback for stock gesture, fix state name
ElementalX governor
msm: kgsl: enable CPU IRQ while suspending context

Make sure that CPU interrupt is enabled before calling adreno
suspend_context when moving from NAP/SLEEP to SLUMBER state.
We send commands to GPU in adreno_drawctxt_switch() which will generate
GPU interrupt. Since CPU interrupt is not enabled, adreno_idle() will
fail because pending interrupt will not be served by CPU this causes
false GPU hang.

CRs-Fixed: 547813

Change-Id: Ia4b730b8f8cda1e820f571ffb7ddb00336ca1a8c
Signed-off-by: Gaurav Gagrani <ggagrani@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
PM: devfreq: Fix simple_ondemand crashing on startup

simple_ondemands private data must be set to NULL, otherwise we would
run into a NULL pointer in kgsl_devfreq_get_dev_status().

Change-Id: I6cc6a8b11e3b58b8c3e3c26d43ee36949cf62351

Signed-off-by: flar2 <asegaert@gmail.com>
msm: kgsl: Fix nice level for higher priority GPU start thread

Before, we were actually setting the lowest possible priority.

Change-Id: I3a52de949eee0faea8061dd91ed303fa8231f0d4

Signed-off-by: flar2 <asegaert@gmail.com>