ASoc: msm: Increase default buffersize to 4k for audio playback

- Increase default buffersize to 4k from 2k for audio playback
  when HAL is configured with deep buffer output.

bug-id: 7129131
Signed-off-by: SathishKumar Mani <smani@codeaurora.org>
msm-pcm-q6: Add support for flexible recording period size
- Current implementation supports only fixed buffer size
  of 320 bytes only for audio recording. This results in
  performance overhead for recording at higher sample rate.
- Added support for flexible period size so that user can
  use larger buffers for recording at higher sample rates.

Change-Id: Iddf544d2aa14d7608476a26dbcc0b37e2e7bc266
Signed-off-by: SathishKumar Mani<smani@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
ASoC: msm: Modify default buffer params of compressed driver

There can be a use case where HAL may request for
Smaller period size and corresponding buffer size for
A session, update compressed driver default period size
And buffer size based on the userspace configuration

Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
(cherry picked from commit d4e62aeb8839cf9accf2356568a14adb8d24152f)
(cherry picked from commit 462a09e10e32afb49ca50bdbfb8c4a4e13cc068a)

Change-Id: Id1aef6c71c5c71b269b6607816f7c3e5c4fd4314
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-compr-q6.c
ASoC: msm: reduce period_bytes_min for voice call

- Allow smaller buffer size for voice call to
  comply with MR1 audio HAL

Change-Id: Iaffca753ad07889b08ae4b6154e8d596950a979e
Signed-off-by: Mingming Yin <mingming@codeaurora.org>
ASoC: msm: Modify min and max period bytes and num periods

Modify min and max period bytes and number of periods in
compressed driver so as to be consistent with lpa and to
meet ION memory requirements. This avoids using huge
buffer sizes for tunnel decode.

Change-Id: Ib71da4cebfc097e7aeaf0ca0e65ee847ba7cceb7
Signed-off-by: Phani Kumar Uppalapati <phanik@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-compr-q6.c
ASoC: msm: Decrease the playback period size of PCM driver
To support the deep buffer output, the playback buffer size is
increased to 4k from 2k. Reverting the change as the support for
deep buffer output is no longer valid.

Change-Id: I5034245bde4b55a5816506fbdfeac970a8e7804b
CRs-Fixed: 438177
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
msm: dlx: set GPIOs used by msm_serial_hs
HID: uhid: introduce user-space I/O driver support for HID

This adds a dummy driver that will support user-space I/O drivers for the
HID subsystem. This allows to write transport-level drivers like USB-HID
and Bluetooth-HID in user-space.

Low-Energy Bluetooth needs this to feed HID data that is parsed in
user-space back into the kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
HID: uhid: add internal message buffer

When receiving messages from the HID subsystem, we need to process them
and store them in an internal buffer so user-space can read() on the char
device to retrieve the messages.

This adds a static buffer for 32 messages to each uhid device. Each
message is dynamically allocated so the uhid_device structure does not get
too big.

uhid_queue() adds a message to the buffer. If the buffer is full, the
message is discarded. uhid_queue_event() is an helper for messages without
payload.

This also adds a public header: uhid.h. It contains the declarations for
the user-space API. It is built around "struct uhid_event" which contains
a type field which specifies the event type and each event can then add a
variable-length payload. For now, there is only a dummy event but later
patches will add new event types and payloads.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>
HID: uhid: allow poll()'ing on uhid devices

As long as the internal buffer is not empty, we return POLLIN to
user-space.

uhid->head and uhid->tail are no atomics so the comparison may return
inexact results. However, this doesn't matter here as user-space would
need to poll() in two threads simultaneously to trigger this. And in this
case it doesn't matter if a cached result is returned or the exact new
result as user-space does not know which thread returns first from poll()
and the following read(). So it is safe to compare the values without
locking.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>
HID: uhid: implement read() on uhid devices

User-space can use read() to get a single event from uhid devices. read()
does never return multiple events. This allows us to extend the event
structure and still keep backwards compatibility.

If user-space wants to get multiple events in one syscall, they should use
the readv()/writev() syscalls which are supported by uhid.

This introduces a new lock which helps us synchronizing simultaneous reads
from user-space. We also correctly return -EINVAL/-EFAULT only on errors
and retry the read() when some other thread captured the event faster than
we did.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>
HID: uhid: implement write() on uhid devices

Similar to read() you can only write() a single event with one call to an
uhid device. To write multiple events use writev() which is supported by
uhid.

We currently always return -EOPNOTSUPP but other events will be added in
later patches.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>
HID: uhid: add UHID_CREATE and UHID_DESTROY events

UHID_CREATE and UHID_DESTROY are used to create and destroy a device on an
open uhid char-device. Internally, we allocate and register an HID device
with the HID core and immediately start the device. From now on events may
be received or sent to the device.

The UHID_CREATE event has a payload similar to the data used by
Bluetooth-HIDP when creating a new connection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>
HID: uhid: allow feeding input data into uhid devices

This adds a new event type UHID_INPUT which allows user-space to feed raw
HID reports into the HID subsystem. We copy the data into kernel memory
and directly feed it into the HID core.

There is no error handling of the events couldn't be parsed so user-space
should consider all events successfull unless read() returns an error.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: caplio <github@snugplace.net>