updates and fixes from caf commits stage 2

ALSA: include: Add new ioctl for metadata mode
Add a new ioctl to support metadata mode in lpa driver. This ioctl
allows lpa driver to work in default alsa compliant mode and also
metadata mode.
110f7b5e5f06624cde157a84c56908513b894ff0

ASoC: msm: Add metadata mode changes to LPA driver
Playback hangs for three seconds on seeking to EOS. This is
because the lpa driver works on period size. Partial buffers
are not handled. Add metadata mode changes to LPA Driver to
support partial frames.
2eeba0ca46d3e63a0552481cf052c769cc28e117

msm: cpufreq: increase priority of thread that increases frequencies
When the cpufreq governors request for increase in frequency from
kworker
threads, there is chance that the kworker thread is cpu starved due to
other high priority threads, leading to undesirable increase in
frequency
ramp-up latency. Add the calling thread to SCHED_FIFO policy when
requesting for increase in frequency and restore back to original policy
after ramp-up is completed.
85e433b5f120956955c1a607b888d2b7fab87145

Merge "tspp: Add synchronization between API call and tasklet"
8f31f8b5e5b750b8d2efdd3a26fb36162e3d562b

Merge "msm: Add support for ION Flushing without virtual address"
2f759537e2b6a96f9bce5f77f247214e50606778

msm_fb: display: Do a pre-fill to writeback buffers.
When switching mdp operating mode to blt, writeback buffers need
pre-fill. Move the pre-fill code from isr routine to do_blt, where
actual switch to blt mode happens.
4ea4a8d5e944298694bc467c85675ecc45b6e1ba

msm: display: Limit dynamic fps feature only to MIPI video panels.
As dynamic fps feature is supported only for MIPI video panels,
return -EINVAL if sysfs node is written for panels other than
MIPI video. This change also removes world writable permissions
for sysfs node.
9b98565e6332b9162a54afb3ce5438194fbade50

msm: kgsl: Don't do intensive memory recovery when allocating big pages
We don't want to incur too much overhead when allocating big pages
so don't attempt to retry, perform reclaim, or run memory compaction
on high-order allocations.
7ec25d8d3f4787a325f96a1db1a8e018d2e67df0

net: rmnet_usb: Fix probe error path
The probe() error path frees the net device before unregistering
it.  This is resulting in a BUG.  Call usbnet_disconnect() in
error path.
321b1f7bd594c631aaba84cf03e0269b674f2caa

ASoC: audio: Fix BE not disconnected even codec teardown
Scenario:
When FE1(LowLatency) comes in which opens BE1 and puts it in state
SND_SOC_DPCM_STATE_START. Similarly FE2(LPA) comes in with
connecting to same BE. Now FE2 is in SND_SOC_DPCM_STATE_PREPARE
state and waits for TRIGGER_START. Meanwhile FE1 is closed which
doesn't affect BE1 and FE2 which are connected.
Also, for FE2 pcm_close is called before TRIGGER_START itself.
In such a case, BE1 is not getting disconnected (afe_close is
not called) while Codec is teared down resulting in Slimbus
overflow.

Fix:
Whenever BE1 is found to be in SND_SOC_DPCM_STATE_START state
and FE1 being connected is not started yet, and close sequence
happens for this FE, then allow hw_free to happen for BE1 if
this is the only FE connected to this BE1. This allows BE to be
disconnected which calls afe_close then followed by Codec teardown
not resulting in any Slimbus overflows.
f55a660a8a8e00a19401295d925f014d3b6e0007

msm: camera: Handle incorrect parameter properly
By this change, when incorrect size is passed, we
return back rather than proceeding forward.
4d741d09fa0a0518df9c5f7f0f00f22274dfda61

msm: camera: Fix event queue drain issue
when camera daemon is killed, then command processing
timeout happens and there is a possibility of pending
event payload data. It creates a problem for further
command processing due to mismatch of event ids.
Drain the event payload queue when there is a timeout
for any event.
eda9dd015f877b45a9aa1ced39bcfa8183fd93fa

ASoC: msm: flush if prior and current backends rate not matching
It is found that during device switch from one backend
with one sample rate to another backend with another sample rate,
the command to QDSP6 ADM which maps audio stream session to a
particular backend would not get carried out until pending
data of audio stream session from previous backend is either
read out or flushed. This scenario occurs when application
stops providing more buffers to retrieve captured data.
Remedy is to flush upon detection of rate mismatching
55f54c53ba0536b9a3e4df7b95a55e73519dcc79

msm_fb: Remove the extra freelist in display_commit
There is an extra freelist call to unmap IOMMU source buffers
in display_commit for LCDC interface. This is causing IOMMU
page faults during boot up on targets with LCDC interfaces.
Remove this extra freelist call.
3e8044fcbfd108ba990c7c9e041f158ce1320e11

msm_fb: display: keep a minimum mdp ib bandwidth request
The calculated ab and ib bandwidth requests are very small which cause
underruns if mdp composites only very small layers. For these use
cases keeping a minimum ib request based on the baselayer size can
prevent underruns and no power impact is observed.
642596cc493a113b26981da16b60f669fb9ddba8

spi_qsd: Auto-select nearest lower available clock rate
Specifying max clock frequency for SPI, via platform data, requires
a frequency that is available to SPI. The frequencies that are
available to SPI and the devices max-frequency are specified in
different places and in different files. As a result theses values
can easily go out of sync.
SPI devices typically can operate at some maximum frequency, with
some tolerance for the actual-frequency being lower. SPI users
typically know their target-device's max-speed, but they have
to dig in platform data files to find the best matching frequency
that is available.
This patch lets users specify the device's max-frequency, while the
actual frequency is automatically selected by the driver. The selected
frequency is the same as the requested one, or the nearest lower one.
70af215a8ea6f7a1ecdf7fcf3d39b7b0ad7d7e75

Merge "msm_fb: Remove the extra MDP clock enable in writeback_commit"
41eb15d4f7c0ece7e61d88aa191f11b59b3c2aba

msm: vidc: Fix metadata buffer size issue
- Metadata buffer size is being set to zero when
  client calls set buffer requirements to video driver.
  This change fix it by properly assigning the
  metadata buffer size to video driver.
- When continuous mode enabled, do not get min_dpb
  from resource tracker for non-H264 codecs,
  for H264 codec get min_dpb from resource tracker.
e7840d213b520879891a0feef9b166ea37d2cbc9

mmc: core: Allow changing bus frequency for SD/eMMC cards in runtime
Currently, bus frequency is set during the card initialization and
never changed until a new card is inserted. In some low power use
cases, scaling the clock frequencies while the card is in transfer
state would allow power savings. This change allows bus frequency
to be changed after the card initialization.
cbec91b6fde7a12e1d0b09f64737919ac615c3d2

mmc: core: Add load based clock scaling support
The SD3.0/eMMC4.5/SDIO3.0 cards can support clock rates upto
200MHz (SDR104 or HS200 bus speed modes). For some workloads
like video playback it isn't necessary for these cards to run
at such high speed. Running at lower frequency, say 50MHz, in
such cases can still meet the deadlines for data transfers.
Scaling down the clock frequency dynamically has huge power
savings not only because the bus is running at lower frequency
but also has an advantage of scaling down the system core
voltage, if supported.

Provide an ondemand clock scaling support similar to cpufreq
ondemand governor having two thresholds, up_threshold and
down_threshold to decide whether to increase the frequency or
scale it down respectively. The sampling interval is in the
order of milliseconds and should be chosen by host drivers that
enable MMC_CAP2_CLK_SCALE capability to take advantage of clock
scaling. The sampling interval mainly depends on the the clock
switching delays and hence a host driver decision. If sampling
interval is too low frequent switching of frequencies can lead
to high power consumption and if sampling interval is too high,
the clock scaling logic would take long time to realize that the
underlying hardware (controller and card) is busy and scale up
the clocks.
884fa523ece82b5b3ada80a4209c381c019e9051

mmc: core: Add sysfs entries for dynamic control of clock scaling
Add sysfs attributes to allow dynamic control of clock scaling
parameters. These attributes are used to enable/disable clock
scaling at runtime and change the up_threshold, down_threshold,
and polling_interval values. Complete documentation for these
sysfs entries are provided at "Documentation/mmc/mmc-dev-attrs.txt".
70a5c036a8d57c93282500f1951526fea7558400

mmc: core: claim mmc host while enabling clock scaling from userspace
A race condition can occur while enabling clock scaling and removal
of the card. If the card is removed just after the host->card check
is successful then there could be NULL pointer dereference later.
Claim mmc host before card availability check to avoid this race
condition.
5f0ed3a8e4ba31146afe33e60b681fa8e3caab11

mmc: core: run clock scaling only in valid card state
Clock scaling requires the tuning and if the tuning command
is sent to the card in invalid state, tuning procedure will
fail.

With urgent request mechanism implemented, there is a chance
that clock scaling invoked when card is not in a proper state
to receive the tuning command.

This change checks the card state (by sending the status command)
before invoking the clock scaling request.
a62469141760f07555f32087ba009f87bc63dc7b

mmc: core: Log MMC clock frequency transitions
Use kernel's ftrace support to capture MMC clock frequency
transitions which can be useful for debugging issues related
to power consumption.

Usage:
mount -t debugfs none /sys/kernel/debug
echo 1 > /sys/kernel/debug/tracing/events/mmc/mmc_clk/enable
cat /sys/kernel/debug/tracing/trace_pipe
71702f9133a19decfb78791b51066027775ce245

mmc: core: Add support for notifying host driver while scaling clocks
Host drivers can participate in clock scaling by registering
->notify_load host operation, which allows host driver to carry out
platform specific operations for further power savings or increasing
throughput based on whether load is LOW or HIGH respectively. This
can be applicable to non-ultra high speed cards as well so remove
the check for ultra high speed cards to initialize clock scaling.
c8b9ca017e7051d9682cdaa79430c9d430f864c0

msm: vidc: Memset and flush codec context buffers
This change will memset and flush the codec context
buffers for non-secure case to resolve video driver
timer expire issues.
91f3b6006e79ec63f4e6749bb6e6d6ba3871d8fd

mmc: core: Fix NULL pointer dereference
mmc_signal_sdio_irq() should only be called when the function
driver registers for IRQ notification. In case, if any host
driver recieves a spurious interrupt and call mmc_signal_sdio_irq(),
ignore waking up uninitialized sdio irq thread.
700942760364f6dfc7c43d866f759ce610732663

input: synaptics: Correct bugs in fw update
- Fixed reset command could fail after firmware update
- Config reset pin if reset gpio is defined in platform data
- Force do a reset in function probe
- Skip fw/config update process if image firmware id is smaller
  than device firmware id
a37dbea00b78b7bad836686271c53d5efd204ffd

drivers: staging: rename synaptics_i2c_rmi4 to avoid confusion
Synaptics driver in staging directory has the same file
name as the in-use synaptics driver in touchscreen directory.
Rename so that in search it is obvious they are two different
files and both are not enabled.
ddc9ae18995416c9cacdf85d6dcefd4f5726a52d

Merge "mmc: block: reduce the block timeout to 30 secs"
3710932512975545f684378372ed7c12f5d03573

input: synaptics_i2c_rmi4: add flipx and flipy to sysfs
- modify enable irq function
- fix F$34 issue of interrupt dispatch
- add pressure report
- add sysfs entry flipx/flipy
50bff4915f518dff89f49abd0a58437907d95910

cpufreq_conservative: Improve support for micro idle accounting
The minimum samplerate calculations of the current conservative
implementation assume that there is not micro idle accounting present,
however, we do have that capability in our idle estimates.  As a result,
we can support lower polling intervals just like ondemand does.