msm: usbaudio: Add support for USB headset detection

 - During bootup, create a file system storing the
   information about usb device state and name, and
   broadcast the message to userspace whenever the
   device is plugged or unplugged.

 - Register the device at USB sound card initialization
   for creating file system and toggle the state in that
   filesystem when USB is plugged/unplugged. This will
   also send a message to user space informing it about
   state change.

Change-Id: Icd78273bb765a26bbc70725afebe8955de8f7315
Signed-off-by: Harmandeep Singh <hsingh@codeaurora.org>
msm: usbaudio: Fix memory allocation for USB audio module init

Fix memory allocation issue in snd_usb_audio_init()
use sizeof(struct) insead of sizeof(pointer)

Change-Id: I270bbd7111e97dd4e0e92378f61d5025e16f5fca
Signed-off-by: Alex Fradkin <afradkin@codeaurora.org>
ASoC: usb: move the switch setting to more appropriate location

There is a delay between creation of sound card and creating of
corresponding steam. Currently we set the switch at the time of
creation of card. And later streams get created, so its more
optimal if we set the switch only after creating the stream.

Change-Id: Ic9f29d7a8dbcd32cde0097289ce6e1404a837372
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
USB: core: Fix misc OTG related bugs

This patch fixes the following OTG related bugs:

1. The current code does not wait for the ongoing HNP polling work to
finish upon the device disconnection which results in a crash when
accessing the udev structure in hnp polling routine.

2. bcdOTG field is added to OTG descriptor in 2.0 revision. Check OTG
descriptor size before validating bcdOTG field.  A legacy device sends
2 bytes lesser than the size of OTG descriptor specified in 2.0 spec.

3. The host is required to execute a GetStatus() with a frequency of
THOST_REQ_POLL in order to determine the state of the Host request flag.
The limits of THOST_REQ_POLL are 1 - 2 sec. Use the average value 1.5 sec
for HNP polling to pass compliance tests.

Change-Id: Ie6a6a8e915d10c1347946f979c919d04d64823b4
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: dynamically allocate usb_device children pointers instead of using a fix array

Non-hub device has no child, and even a real USB hub has ports far
less than USB_MAXCHILDREN, so there is no need using a fix array for
child devices, just allocate it dynamically according real port
number.

Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>