USB: Debugfs: Fix compilation issues when debugfs is disabled

When we disable debugfs some of the function driver does not
handle those error properly so we see error of kind variable
undeclared, too many arguements to function. This fixes all
these obseved issue

CRs-fixed: 551713
Change-Id: I1b60c86b1c489f77edf86a5df44f8766a08dc117
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
USB: f_mass_storage: Send GADGET_DELAYED_STATUS for MSC RESET command

When Host sends MSC RESET command to the device, device is expected
to clear HALT condition on the bulk IN endpoint as part of handling it,
before sending status phase to the Host. Since handling of MSC RESET is
done by sending signal to fsg_thread, it could take time for handling it.
It could lead to sending bulk IN endpoint as halted, when host asks for
endpoint status as status phase is sent for MSC RESET command immediately
after it is recieved. Due to this, MSC compliance tests fail. Hence send
delayed status in case of MSC RESET and send status phase after it is
handled and cleared halt condition.

CRs-Fixed: 547929
Change-Id: If80d0ffb2d012724b899772b1b45dff8092bd8d5
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: gadget: qdss: Fix strncmp length usage

Using a newer GCC we get the following warnings:

drivers/usb/gadget/f_qdss.c: In function 'qdss_bind_config':
drivers/usb/gadget/f_qdss.c:598: warning: argument to 'sizeof' in
'strncmp' call is the same expression as the second source; did you mean
to provide an explicit length? [-Wsizeof-pointer-memaccess]

drivers/usb/gadget/f_qdss.c: In function 'usb_qdss_open':
drivers/usb/gadget/f_qdss.c:760: warning: argument to 'sizeof' in
'strncmp' call is the same expression as the second source; did you mean
to provide an explicit length? [-Wsizeof-pointer-memaccess]

These look to be due to using sizeof(ch->name) which is a pointer, use
a simple strcmp instead.

Change-Id: I09e09a18ffb3361fc351b177ed3a35432d9ed933
Signed-off-by: Kumar Gala <galak@codeaurora.org>
USB: msm_otg: Add support for AHB2AHB Bypass Mode in device mode

With AHB2AHB Bypass Mode, USB 2.0 Core is running using PNOC clock
and runs synchronous to PNOC which provides better throughput.
AHB2AHB Bypass mode can be enable with USB controller using
USB_AHBMODE register. It has below requirement :
- It should be enable before setting kicking USB controller
(i.e. setting R/S bit).
- PNOC should be running at MAX speed to get better throughput.
- While doing asynchronous clock reset with USB core, it is required
to disable this functionality as PNOC clock can't be disable and
re-enable as it is performed with other USB core clock.

CRs-Fixed: 550553
Change-Id: I9feac91b8885a393a13a039e9c89d63d0af2aed6
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB: gadget: Add support to enable streaming mode with required function

Supported different usb functions' has different throughput requirement.
USB controller supports streaming mode feature which enables double
buffering scheme on both IN and OUT endpoint, and reduces number of
NAKs for IN transfer. Hence noticeble throughput is increased with it.
Currently streaming mode is disable with USB controller. As supported
usb functions'like mtp, rndis are required to have higher throughput.
Add support which allows to enable streaming mode with usb controller
in device mode when particular function based composition is being enabled.

CRs-Fixed: 550553
Change-Id: Ibf6f3dc3f3b821647ba9beb15ed735a85c8ed586
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
usb: gadget: Fixing array index out of bound violation

In mass_storage_function_init(), current code has array size
allocated as 2. Maximum number of luns which can be supported
is 3 (for cdrom, external memory and internal memory). Array
name[0] is initialized to "lun" as by default it is required to
support minimum one lun for external memory.  For additional luns
support array index 1 and 2 is required to be used.

But with current code there would be array index out of bound
violation when name[2] is accessed. Hence fixing the issue by adding
correct size for the array to 3.

CRs-Fixed: 579049
Change-Id: Iad74a95205e503bf6a30dfac70b6ac1963df76a6
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
usb: gadget: Fix race condition in connect/disconnect

This commit fixes race condition in fast connect/disconnect
of USB cable. This race condition can also be reproduced in
USB composition change. Thus this commit also adds support
for USB composition change for BAMtoBAM compositions.

CRs-fixed: 463705
Change-Id: I21abaff6a64bb405ce2d698605aff8e0050ef8d6
Signed-off-by: Anna Perel <aperel@codeaurora.org>
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
usb: gadget: bam_data: Wait for BAM reset only on A2 BAM

Previous change 'usb: gadget: Fix race condition in connect/disconnect'
introduced a bug which adds unnecessary delay waiting for bam
reset completion after usb cable disconnection. BAM reset completion
is not needed for IPA bam type. Fix it by waiting for bam reset only
for A2 bam.

Change-Id: I491e5ff561b226711ec80d281a3c7dbb91a91f96
CRs-Fixed: 503808
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
usb: gadget: u_bam: Enable zero length packet for tx transfers

Avoid packet re-transmission/drop by sending zero length packet
when usb transfer is multiple of usb endpoint max packet size.

CRs-Fixed: 494184
Change-Id: I01c9f9be41d3b64760e9bc08ec82ef8b6cc1a80f
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
usb: u_bam: Fix spinlock leak followed by lockup from workqueue

Driver has missing code to release spinlock while returning from
workqueue in case of memory allocation failures.
Returning from workqueue without releasing spinlock messes up
with worker thread and kernel keeps throwing up warnings like:
"BUG: workqueue leaked lock or atomic: kworker/u" for any
sleeping function called from worker thread afterwards. Later
when driver again tries to acquire same (unreleased) spinlock
it results in spinlock lockup.

CRs-Fixed: 497158
Change-Id: I4eaa7aaa42ed95a9b78a8939e80f4c0694e574b2
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
usb: gadget: Disable transfer-complete interrupt on BAM2BAM transfers

Enabling the transfer-complete interrupt on BAM2BAM transfer
is not required and can cause watch-dog bark on high throughput.

Change-Id: I7d80c7ff0e29b5087fb337020e9cd7e52488c767
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
u_hsuart: Fix a bug in opening the SMUX port

commit 9fdf017a (tty: n_smux: add separate close notifications)
implemented SMUX_LOCAL_CLOSED notification for clients to know
when the port is ready for opening again.  Use this notification
and defer opening until the port is ready.  If the port is opened
before this notification is arrived, the open will fail and
rmnet/dun does not work.

CRs-Fixed: 509013
Change-Id: I18bf9f08029fb98d611679d3aa65d13b088da8bc
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: gadget: f_mtp: Fix using tx buffer pointer

commit "2537d56f790114dab504b93ed754492f86878b4a" added module
parameter for Tx buffer length which can be changed during runtime.
That commit didn't update tx buffer pointer whereever required due
to which driver is queueing Tx data in chunks of  16Kbytes length
even though buffer length allocated is greater than 16KB. Hence fix
tx buffer pointer usage so that data will be read from file system
in chunks of > 16KB.

Change-Id: I1f3f9313e7c875942668f570a611bdc8ce4e91f6
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
tty: n_smux: add separate close notifications

When an SMUX port state is closed, the close request is sent to the
remote system.  The port cannot be re-opened until the remote system
acknowledges the close request.  If the client attempts to re-open the
port during this time, then the -EAGAIN error code is returned and the
client must keep retrying to open the port.  An event-driven approach
would be better, but the client does not receive local state
notifications, so this is not possible.

Add local and remote closed notifications so clients can handle the
closing state transitions without using polling.

CRs-Fixed: 510114
Change-Id: I48008804d23dbfd05df0becd4bc1c695e599a835
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
ASoC: msm: cleanup

Signed-off-by: houst0nn <houstonn@gmail.com>
ASoC: msm: qdsp6v2: Use vsid as session id in voice driver

Replace internal session id with voice system id used across
various subsystems to uniquely identify voice sessions.

Change-Id: I9de06c023e994a040118a2ce4e5e8bae8c7b2707
Signed-off-by: Pradnya Chaphekar <pradnyac@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/q6voice.c
	sound/soc/msm/qdsp6v2/q6voice.h
ASoC: msm: Fix RTAC to use VSID

All voice sessions use unique VSID for active
sessions in CVD. RTAC get param for voice
sessions require this VSID to work correctly with
CVD. This change fixes the issue of using proper
VSID in RTAC.

from caf
commit	73965fa98be12097e72c8fc0cd4201329ca9b520

Change-Id: I6eb8e64ee5d7fad212b77882c897e5feb3cc96c5
CRs-fixed: 506008
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
ASoC: msm: qdsp6v2: defer probe if memory allocation fails

During bootup, on targets which use SMMU, msm_audio_ion wrapper
will allocate and return memory even if SMMU device node is not
ready. Mapping such memory with LPASS will fail as LPASS is
expecting SMMU memory. msm_audio_ion_alloc will now return
EPROBE_DEFER if SMMU device is not ready and as result voice and
voip driver's probe() will defer. Any other memory allocation
errors other than EPROBE_DEFER from msm_audio_ion will result in
voice calls with degraded voice quality since calibration cannot
be applied and voip calls will fail since voip buffers cannot be
allocated.

CRs-fixed: 503096
Change-Id: I2eda29055f088c5d2c14362c47c3484c53d1f3f4
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/q6voice.h
ASoC: msm: Add voice volume boost support

Add support for the volume boost feature. Volume
boost pushes a new voice volume table with boosted
gains. To support this feature new API's are added
to the voice driver to register & deregister the
voice volume table. New IOCTLs are also added for
audio_acdb to support registering & deregistering
tables.

Change-Id: I154fdedad78760393e2cd8cc11fa10178dfce320
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/q6voice.c
ASoC: msm: qdsp6v2: Add session specific volume and mute control

Update volume and mute control to make it session specific.
Add functionality to handle all sessions for HALs that are not session
specific.

Change-Id: Ic55d3d69c9d4955e5e1d19929a97deecf54a43f9
Signed-off-by: Pradnya Chaphekar <pradnyac@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c