Revert "USB: gadget: android: Use "rndis%d" for RNDIS device name instead of "usb%d""

This reverts commit ef55b077ca95c069898889f2c2205dc751bc379a.
base: genlock: remove BIT macro usage

The BIT macro is not defined for !_KERNEL_ resulting in compile errors.

CRs-fixed: 356263
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
(cherry picked from commit 0977510e0f72b2f1a24f41d5154c2f1b80c96d9a)

Change-Id: Iaf188a1af838c98ca30ce216d7be8ddf85db700c
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
USB: gadget: f_mtp: MTP driver cleanup:

Use a work queue instead of a separate thread for file transfer ioctls
(note: the file transfer must be done on a kernel thread rather than in
process context so vfs_read and vfs_write will use the correct address space
for the buffers)

Enforce requirement that only one ioctl call may be active at a time,
and remove mutex in mtp_send_event that is now no longer necessary.

Synchronize around use of shared variables to avoid SMP issues

Fix mismatched calls to fget and fput

Change-Id: I9e3ab092dbeb3327ce63c04a10af83c64a8baf71
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
[cvelempa@codeaurora.org: Fixed compilation(line 1151: Initialise ret = 0)]
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
USB: gadget: f_mtp: Return zero result for successful file transfer.

Returning number of bytes transfered does not work for files > 2 gig
since ioctl() result is a signed integer.

Change-Id: Id4d18fe77110d1bd390106a12f6eb1c866042a15
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
USB: gadget: f_mtp: Support for file transfer length greater than 4 gigabytes

For backward compatibility with PTP, MTP is limited to a 32-bit file size.
When transferring files greater than 4 gig, MTP uses 0xFFFFFFFF as the file size
and the receiver reads until it receives a short packet.

Expanded size of mtp_file_range.length to 64 bits and added support for
writing zero length packets.

Change-Id: I267873366cff020db536b9b20ee23f7456694f3d
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
USB: gadget: f_mtp: Zero length packet fixes

Send zero length packets at end of transfers that are a multiple of the
bulk max packet size as required by MTP.

Change-Id: I46cd853791bc8c0079a085367068009435343a0d
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
USB: gadget: f_mtp: Make sure request is dequeued if transfer is canceled

If the host cancels a file transfer while we have a read request pending,
call usb_ep_dequeue to cancel the read.
Also return -ECANCELED from mtp_ioctl if we are canceled in MTP_RECEIVE_FILE

CRs-Fixed: 304857
Change-Id: I8e7e622f1d0797bcdbd4bda71399879c90aaf723
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
USB: gadget: f_mtp: Fix problems transferring files from device to host

Exit from send_file_work immediately when a cancel request is received.

Only busy status if there is a cancel pending that has not been repoorted to userspace.
This avoids a race condition that can occur when mtp_read resets the state
to STATE_BUSY before we report status OK back to the host.

Change-Id: I73b70976b3df7e18ac886418aa3ccd013dc43085
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Chandra Devireddy <cdevired@codeaurora.org>
[cvelempa@codeaurora.org: Fix trivial merge conflict]
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
mfd: pm8058: Support hard reset feature

Add support for hard reset to turn off or restart the
system.

Change-Id: Id70971bed666a1774da71b7778c7fb3e85192345
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
mfd: pmic8058: PMIC 8058 SMPL and watchdog control APIs

Add an API to select between reset and shutdown of a PMIC 8058 when
an SMPL event occurs.  Add an API to set the SMPL timeout delay.
Also add an API to select between reset and shutdown when PS_HOLD
goes low.

CRs-Fixed: 285873
(cherry picked from commit 9aa8b1b4a2653957567d6ba4cbbfc70010952b35)

Change-Id: I61dbc8451be0861760e75725f8147868b8e4412b
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
mfd: pm8058: Locally disable regulators S0/1/3 and L21 during shutdown

When shutting down or restarting, PMIC 8058 regulator S0, S1, S3 and
L21 need to be managed manually. Since the master enable bits for these
regulators are kept set, the local enable bits should be unset and the
active pull-down must be enabled. Any regulators in advanced mode
should be disabled as well. This regulator state ensures that
these regulators drops as expected when PS_HOLD is dropped.

Change-Id: I67da143b6adb1182bed4fe1a963759a8e8493c38
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
mfd: pmic8058: remove mutex in pm8058_reset_pwr_off

Mutex is not needed anymore when pm8058_reset_pwr_off is called.

Change-Id: I5d16f507e47f8f41bd844c5f78a53e0daa4e7ff0
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
Revert "mfd: pm8058: Locally disable regulators

S0/1/3 and L21 during shutdown"

This reverts commit 15605152a2b9dead3a4569f4c46601f1d187fb80.

Conflicts:

	drivers/mfd/pmic8058.c

Change-Id: I8254b38ebc4759b0c100e8825ae221d03dda284c
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
mfd: pm8058: Locally disable regulators S0/1/3 and L21 during shutdown

When shutting down or restarting, PMIC 8058 regulator S0, S1, S3 and
L21 need to be managed manually. Since the master enable bits for these
regulators are kept set, the local enable bits should be unset and the
active pull-down must be enabled. Any regulators in advanced mode
should be disabled as well. This regulator state ensures that
these regulators drops as expected when PS_HOLD is dropped.

CRs-Fixed: 295731
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
(cherry picked from commit bada8479e2bc4c73448e88029dc54f0287a74a73)

Change-Id: I531ac7ea40ee303858dd7b351b014de5b13fb11a
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
mfd: pmic8058: fix for lost adc interrupt

An issue of missing interrupt was observed while resuming the device.
The msm_charger resume called adc conversion to get the battery
voltage.  The adc conversion function enables the interrupt and
starts the conversion.  Then pmic8058_resume gets called now which
re-enables the adc interrupt causing the pending bit to drop. With
the ADC EOC interrupt missed, the msm_charger does not receive a
completion event, causing a watchdog timeout.

The pmic8058 irq module has a hardware bug where writing to the config
bits clears the pending status of the interrupt.

Fix it using a sysdev where the pmic interrupts are switched before
any of the subdevices resume and use nonwakeup interrupts. Since
in sysdev resume we only enable non wakeup interrupts the status of
wakeup interrupts remains intact.

CRs-Fixed: 295261
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit a28a7396a4ccca6b467583fdfcb02af91e222902)

Change-Id: I525df4ab528fc7d93fe7ec7233973e691099bb56
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
mfd: pmic8058: avoid unmasking enabled irq

If an interrupt was already unmasked previously, don't unmask it
unnecessarily. This will avoid loosing the interrupt if it were
pending.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 2166ca0ef3bd8c82b0401b43d288cd207fd675cb)

Change-Id: Ibefd3c5abafc46141a0b2a54ea97f7c94573d727
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
mfd: pmic8058: ack an handled interrupt immediately

Currently the pmic interrupt thread handles all the interrupts
and later clears all those interrupts at once.

A problem was observed with this approach. The adc interrupt handler
could start another conversion and if the conversion finishes before
the pmic interrupt thread clears them, it ends up clearing the new
interrupt too.

Fix it by clearing the interrupt as soon as the handler is called.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 4b1e957785391fd06c7611cdcbc0222640e4df9f)

Change-Id: Ied6be4e39016d3242258d4d10529d28e53420cc9
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
mfd: pmic8058: Ack interrupts before handling them

There could be a case where
- ADC interrupt is handled and a next request is queued up
- The interrupt thread  gets scheduled out just before acking the interrupt
- ADC hardware completes the queued request and raises the next interrupt
- The interrupt thread now gets a chance to run and acks the adc interrupt.
  Note this acks the next interrupt.

The above sequence of events leads to lost interrupts. Ack the interrupt
before calling the handle_nested_irq. If next interrupt is raised while the
current one's handler is still running, it will cause another invocation of
the interrupt handler to run.

Change-Id: Ibaed1851cf52f910003c7c92aec00a61d51cf8ae
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
ASoC: msm7x30: add mixer control to mute/unmute record device

The current device volume 0 is not absolute mute. Add support to
mute/unmute device. Support only Capture path.

CRs-Fixed: 272747
Change-Id: Ib2a947988f762b3f87bda2e282804a743dea8fb2
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>

Conflicts:

	sound/soc/msm/msm7x30.c
ASoC: msm7x30: Fix broken snd_pcm_avail_delay

Due to the mismatch in buffer available and buffer advertized to
user space the snd_pcm_avail_delay is broken. This gives the
error "Broken alsa _delay implementation" when used with PA.

Change-Id: Ifd5e5ebefb3bfb6fd8333b9e5faa72469913e8da
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>