USB gadget: do not include android_composite.h

Change-Id: Iac0e8e150a9455b8cad7fe15250712b42a992284
Signed-off-by: Iliyan Malchev <malchev@google.com>
Add ACCESSORY_SET_AUDIO_MODE control request and ioctl

The control request will be used by the host to enable/disable USB audio
and the ioctl will be used by userspace to read the audio mode

Change-Id: I48082ce473eb6577b0bf613be9ec27f2f5c19384
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 319e822875f67ed9e4bcca3213ef80b018922ae0
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
USB: gadget: f_accessory: Add support for HID input devices

Change-Id: I4f5722bfa26a0d73419c54709b2f1672491bf56a
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 71c42632754e7a022d587b1c6175b63f34e93e90
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
usb: gadget: audio: Add to audio function record functionality

This module enhances the USB audio function driver with
record functionality and adapts descriptors structures
to support compatibility with Win7.

CRs-Fixed: 363272
Change-Id: Ic30944ea117ee96e07eb5769ed5d58bfa53b4769
Signed-off-by: Anna Perel <aperel@codeaurora.org>
USB: gadget: f_audio_source: New gadget driver for audio output

This driver presents a standard USB audio class interface to the host
and an ALSA PCM device to userspace

Change-Id: Ie20264ac86d21a1b1366491273034b755366d3c3
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 1f0627dea23276af0180ba57d0c84576c6357897
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
USB: gadget: f_audio_source: Adjust packet timing to reduce glitches

Increase max packet size and clean up timing logic so we can better
recover from not getting an interrupt in time for a SOF.

Change-Id: Ie0e11853997e7f0c8320e79de3b3de0321c779ca
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 0daae7684be1f646a162b4150e7e7547550250aa
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
USB: gadget: f_audio_source: Fix error handling and increase packet size

Fixes watchdog reset on USB disconnect
Larger packet size fixes performance in fullspeed mode

Change-Id: I495c3c02f965d64538eb8adcd62a12a18a723cef
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 2fa1f1c9b55a1494462d4e0d8c591ac0aecc9f78
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
USB: gadget: f_audio_source: Fix use after free in audio_unbind

When USB was disconnected, we were freeing our audio_dev struct in audio_unbind
before the audio system had cleaned up, resulting in a hang in audio_pcm_close.
We now statically allocate the audio_dev struct to avoid this problem.

Change-Id: I58ad21eaa20dcf4aa74ee614ef3b6ed2c91d52a1
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Git-commit: 54c7c33ce2cf80a561fcc5f83099c9150de6fe44
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
USB: gadget: f_audio_source: Set packet size to 256

Currently endpoint max packet size is set to 384 bytes. This could
cause crackling noise with USB-DOCK device if USB-DOCK device supports
max iso buffer size of 256 bytes.

Change-Id: I77dcf4ef07af2a7302785f417c4cad51151d501b
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
usb: gadget: Initialize non zero ep max packet size to 0xFFFF

usb device controller driver initializes all endpoint's max packet
size to 64 bytes. At the time of function driver bind gadget
framework chooses endpoint to use by comparing it with endpoint
descriptor of the function driver in ep_matches(). Driver bind
fails for the function driver having isochronous endpoints, as
ep max packet size is less than endpoint descriptor's max packet
size. Hence set ep max packet size to 0xFFFF for non-zero
endpoints in gadget driver registartion and endpoint disable.

Change-Id: I9fc0a19bd4502812b8659222d60274ad8b9fef34
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
USB: ci13xxx_udc: Set QMULT for ISO endpoints

Currently not setting QMULT for ISO endpoints. Set this
value appropriately  to indicate to the USB controller the
number of transactions to be done in microframe.

Change-Id: If80c003464024f8dfebcda13fefb33744618d043
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
msm_fb: display: fix iommu leak during base layer swap

Retain RGB1 iommu information during  base layer swap
so that iommu used by RGB1 can be freed back to pool later.

(cherry picked from commit 64892009d43ca724c5ee1be5f7db6ad1f00cda6c)

Change-Id: I653412c701da66e6786eb948eabf7f826661b60b
CRs-fixed: 403277
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: sysmon: Handle races between probe/removal and API calls.

It is possible that clients of the sysmon may call its APIs
before the associated device has probed, after it has been
removed, or while it is in the process of being added or
removed. Handle these scenarios and return -ENODEV when
external APIs are called at illegal times.

(cherry picked from commit 9319017b803cca3fd479e589db3d8d3560e19511)

Change-Id: I7475d98b6593d1c83f486c492ab0ed3c05d91c48
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
input: pm8xxx-pwrkey: Update key press status during probe

Power key could be in pressed state during boot. Set the flag
to track the press status properly by reading press irq status.

(cherry picked from commit bd38250554df6e70657e6ff42ad63415dbd53f1a)

Change-Id: Ib552617fd2889effc911fd1cc65043bf32874747
CRs-fixed: 404018
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
mmc: msm_sdcc: Reset SPS BAM on error recovery

In the current soft reset sequence performed as part of
CMD/DATA error recovery we do the following:
1) Write 1 to DML_SW_RESET
2) Reset CPSM/DPSM by clearing MCI_CMD and MCI_DATA_CTL
or by writing to MCI_SW_RST_CONFIG.
3) Re-init DML
4) Reconfigure both consumer and producer BAM pipes.

The BAM pipe reset does not reset the sideband signals, since
only SDCC side is reset SDCC - BAM communication will go out
of sync and cause DML to be stuck without transferring data.
Hence reset BAM core every time SDCC is reset (which is on
error recovery).

Fix error handling for sps pipe or device reset.

(cherry picked from commit 3ca90f02963ddbbdb300eb55c49aca18091c3f49)

Change-Id: I3289e5dc00583604d13481a6e6c710642d41a6ba
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
msm: event_timer: Support to add event timers.

Add support to allow drivers to specify future events
that need to be treated as hard deadlines. Upon event timer
expiry the driver will be notified by callback function
that the driver provides.
The pm code can query the earliest event and modify
the event timer accounting for the back off based on the
latency of the low power mode being entered.

(cherry picked from commit 388c308cebef8e9cdbd80608a032abc810d46e62)

Change-Id: I77e942cbc19d8be2dc53e4fd47e5ad92753e3b12
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
msm: defconfig: Enable event timer

Enable Event timer feature. This feature enables PM
code to monitor events that require the core to be ready
to handle the event.

(cherry picked from commit 19d00d50f5b09a25712133ed0b329cc9c5c3d1d8)

Change-Id: I81d0753377d9e9366e60833280f214421da1e1eb
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
msm: pm: Adjust for events with hard wakeups

Get the next event and setup a new timer to expire
earlier than the next event after accounting for the
latency of the low power state being entered. This
will ensure that the core is active to handle the event
when it arrives.

(cherry picked from commit dc318fd0c3d04f7af9720af50c0eb0c6ed2653e9)

Change-Id: I9b508fa427704180184f6ff5919bd67b35ad4e2a
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
power: pm8921-charger: resume charging based on SOC

At EOC, the battery is disconnected from the charger and starts
discharging. This can result in SOC dropping to around 93% before
charging starts again.

Manually set the CHG_VBAT_DET threshold high to restart charging once SOC
drops below keep_charge_percent.

(cherry picked from commit 14e8fa1e42c02ea643d16d3f833b5d8e1b5753e6)

Change-Id: I87d7ea2034e03f1ef7def529a3af720fb48aab96
CRs-Fixed: 404909
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
msm_fb: display: return fail if pipe still staged

Pipe is not un-staged from mixer when it is unset.
It expects a pan_display() to un-stage it out of mixer.
Return fail at overlay_set() if pipe was still stage
at mixer.

(cherry picked from commit 4fc9350b124ded06f90c43410c2c0b512681c0db)

Change-Id: I763e2a6bbdc9e7f6677912ad1578e53c24565506
CRs-fixed: 399193, 393979
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>