usb: gadget: qc_ecm: Release EPs if disable happens before set_alt(1)

DATA EPs (bulk IN/OUT) are used only after set_alt(1). If disconnect
(disable) happens before this then EPs are configured again based
on the stopped. Things work fine if there is no change in speed on
next connection. Otherwise for a scenario like below device ends up
using wrong maxPacketSize with endpoint.
 -ECM gadget connects in FullSpeed
 -SET_CONFIG happens: This results in set_alt(0)
 -Disconnection and reconnect in HighSpeed
 -SET_CONFIG
 -set_alt(1) for ECM.
This results in ECM using 64bytes maxpacket size in high speed and
may result in data stall.

Fix this by explicitly clearing ep->driver_data on disconnect.

CRs-Fixed: 722950
Change-Id: Ieb6b333195387e42df35f76b40ac1e171d46b1da
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
usb_bam: Fix BUG in HSIC remove making pm usage_count negative

Runtime PM usage count of HSIC device is also used by usb_bam
to allow/forbid HSIC entering LPM. HSIC is allowed to enter
LPM only when both PROD and CONS are released by usb_bam.
During initialization, usb_bam increments pm usage_count when
HSIC registers with it and vice versa it decrements the count
when HSIC is de-registered. But, if HSIC was already in LPM when
getting de-registered then usb_bam ends up making pm usage_count
-1 later on HSIC remove. Next time when HSIC is registered again
then pm usage count toggles between 0 and -1. Negative pm
usage_count results in failure to wake up HSIC using pm_runtim_get
on async_irq (remote wakeup) or any usb_bam triggers.

Change-Id: I460e628dc704e45285e47b70dc8aaf5963555031
CRs-Fixed: 709563
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
usb_bam: Fix handling of ipa_resume during fast suspend/resume

During fast HSIC CONS release and request scenario, there is a
race condition possible - if Pipe resumed while we dropped lock
due to HSIC CONS request then ipa_resume may not have been called.
During this scenario, restore in_lpm to allow ipa_resume when HSIC
resumes next time from msm_bam_wait_for_hsic_prod_granted().

Change-Id: I48a413a553dd456eb29b4d22ab577489c656f55d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
f_rmnet: Disconnect IPA on USB suspend if remote wakeup is disabled

If USB host doesn't enable remote wakeup feature on RMNET device
then it is not allowed to wakeup the usb bus after bus suspend.
If IPA is willing to wakeup the USB bus as part of CONS request,
USB cannot wakeup the host and therefore cannot grant the consumer.
This causes IPA resource manager to timeout and stall.
Therefore in case of remote wakeup disabled, avoid the IPA side
request for HSUSB CONS by tearing down data path with IPA.
This also requires handling condition in u_bam.c where device
disconnection may happen after suspend (w/o remote wakeup).
In this scenario gbam_disconnect will be called back to back
out gbam_connect. For this add check for connection state in
u_bam before disconnecting.

CRs-fixed: 721518
Change-Id: I57218abe7d18d59fc7092883ceeef426fb05aa5f
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB: msm_otg: Process HOST disconnect only after system RESUME

If Host Cable (ID_GND) is disconnected in system suspend then
it results in race between device removal and device pm_resume.
PM core does't handle this correctly and sometimes frees up
parent device before children are resumed. To avoid this race
make sure that system has resumed completely before handling
ID_FLOAT (or host cable disconnect) event.

CRs-fixed: 652870, 651561
Change-Id: Id0956a9677d819d3fa3f17f54965cae38f2ee31d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
msm: smd: flush pending work on release

If an SMD device is closed while the device is active and then
immediately re-opened, then a delayed work item may get processed while
data structures are in the process of being re-initialized.

Move initialization of data structures to device creation which happens
once during module initialization.

CRs-Fixed: 698603
Change-Id: Ida85d8452f32b62fd848c706ba046f1a9a08bc85
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Merge "msm: smd: flush pending work on release"
Merge "f_rmnet: Disconnect IPA on USB suspend if remote wakeup is disabled"
Merge "usb: gadget: qc_ecm: Release EPs if disable happens before set_alt(1)"
Merge "usb_bam: Fix BUG in HSIC remove making pm usage_count negative"
Merge "usb_bam: Fix handling of ipa_resume during fast suspend/resume"
Merge "USB: msm_otg: Process HOST disconnect only after system RESUME"
cfg80211: ignore supported rates for nonexistant bands on scan

Fixes wpa_supplicant p2p_find on 5GHz-only devices

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-commit: 1b09cd82d8c479700ef6185665839d1020b02519
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Change-Id: Icadd03bfff17c5fd8da3e15e7b69b42a730e0ef0
Signed-off-by: Ahmad Kholaif <akholaif@codeaurora.org>
Merge "cfg80211: ignore supported rates for nonexistant bands on scan"
netfilter: nf_conntrack_sip: Dynamically enable/disable SIP ALG.

When SIP ALG is disabled, SIP packet should not be parsed by
SIP ALG module. Make change to Check nf_ct_disable_sip_alg flag
before parsing the SIP packet to bypass SIP ALG processing
when SIP ALG is disabled.

Change-Id: I863c93f418b694bc0e9101c31d2da12e761091a6
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
ASoC: msm: Fix ADM GET PARAM callback

Add size check on inband get param call and do
not process inband if RTAC is active.

Change-Id: I2c099f5ea254a214f224dda556773a7fe6754fe5
CRs-fixed: 548397
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Merge "ASoC: msm: Fix ADM GET PARAM callback"
Merge "netfilter: nf_conntrack_sip: Dynamically enable/disable SIP ALG."