msm: mdss: add bandwidth check function

Add function which calculates the bandwidth that would be required by
MDP to display the frame. If the bandwidth is over the defined limits,
an error is returned which means the configuration is not acceptable and
may lead to display underruns.

Change-Id: I991ac458d347487c5c634d271814222aa661fd58
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>
msm: mdss: Add SMP per pipe parameter into hw capabilites

Additional SMP parameter 'smp_mb_per_pipe' is required by
userspace as part of hardware capability made available
through sysfs node.

Pipes availablity for a use case can be computed taking these
values, based on which, composition decisions can be made.

Change-Id: I2d790506ca895357762e1eca098ea1734077a097
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
ARM: dts: msm: Tune SMP block restriction for 8x26

To maximize availability of pipes for both 1080p and 1200p based
8x26 targets, reduce SMP block restriction from 4 to 3.

Change-Id: Ibb5a9d0016ea0d44b152d9c74d9f3a5cbd2acbd3
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Add SMP parameters into hw capabilites

To handle use cases better, expose smp_mb_cnt and
smp_mb_per_pipe to userspace as part of hardware capability.
Pipes availablity for a use case can be computed taking these
values, based on which, composition decisions can be made.

Change-Id: Ia7cc4db153cdb164a29ae2369d3e991b95aaba65
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Reserve single SMP block for writeback mixer pipes

Writeback does not have stringent requirement for latency
buffers. So, SMP blocks reservation for the pipes attached
to writeback block can be restricted to single SMP block for
each plane. This makes more SMP block available for other
clients.

Change-Id: I3d788bcf7fcbc5667b4a3a0c52256f55cc0aa1e7
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: kgsl: don't use sscanf()

Friends do not let friends use sscanf().

CRs-Fixed: 563605
Change-Id: Ic0dedbad56af5bbee4fc833701d8bc93b118efa9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
WLAN subsystem: Sysctl support for key TCP/IP parameters

It has been observed that default values for some of key tcp/ip
parameters are affecting the tput/performance of the system. Hence
extending configuration capabilities to TCP/Ip stack through
sysctl interface

Change-Id: Ia92fc229c0a4a8c3f7e4e02cf7e3c8849719ddff
CRs-Fixed: 507581

Signed-off-by: Kiran Kumar Lokere <klokere@codeaurora.org>
msm: vidc: initialize venus hfi locks during hfi creation

Venus hfi locks were initialized during core init,
which is invoked when the first video instance is
created. If a debugfs command is executed before
starting the first video instance, then video driver
crashes trying to lock an uninitialized mutex.

Change-Id: I472e9de91dada94a2728dd02c747e7fde63e3e4f
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
power: qpnp-bms: fix unbalanced IRQ enables

After a previous patch, the BMS driver's sw_cc_thr and ocv_thr IRQs were
being enabled twice, causing a warning in the kernel log. This happened
because the bms_irq_disable function was being called after the BMS
driver found the IRQ number but before it was requested.

Disabling the IRQs from the bms driver before they were requested
resulted in a situation where the BMS thinks that the IRQs are disabled
but the request function had reset the IRQs so that they were enabled
once again.

Fix this by adding a ready bit to the bms_irq struct and setting it
after the devm_request_irq call. If an IRQ is not ready, then do not
enable or disable it.

Change-Id: I52dfbe6c21b8c5cadf60874beab0fe1a4ec7a63f
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
mmc: sdhci: add asynchronous interrupt support for sdio card

Some controllers can gate the clock to save power
even for SDIO cards. In such cases, an asynchronous
interrupt mechanism is used to receive interrupts
even when clocks are off.

This patch wakes up the sdio thread if interrupts
were received when clocks were off.

CRs-Fixed: 585481
Change-Id: Ifcfafad251dedc992637596b6bb9349cfbca5d8b
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: core: add wakeup functionality to sdio cards

This patch initializes wakeup source if the detected card
is a sdio card and enables the wakeup capability.

Platform drivers would have to invoke:
 * pm_wakeup_event on this card device to signal a wakeup
 * corresponding pm_relax have to be invoked

CRs-Fixed: 585481
Change-Id: Ic8d5c98073e8ed3f676eb42fc0ce1f13a11cb40f
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: sdhci: add sdio wakeup event

This patch adds wakeup event capability for sdio cards.
When a wakeup event is received during suspend, a reference
to the card devices' wakeup source is taken for 300 ms.

It is expected that the function driver would act on the
wakeup event within this time-period.

CRs-Fixed: 585481
Change-Id: I80fe0c450e8d9b3df51aa181d667d94517c961dc
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: sdhci-msm: ignore data-end-bit error in 1 bit mode

Some SDHC controllers are unable to handle data end-bit
errors in one bit mode.
This patch adds a quirk to ignore data-end-bit error in
1-bit mode in Qualcomm SDHC controllers.

CRs-Fixed: 585481
Change-Id: Ica0f10573d654021449c32197b126e12bb1a3c10
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: sdhci-msm: add sdio wakeup support

This patch adds the sdio wakeup funtionality in either of the
two methods:

1. If a dedicated mpm interrupt is present in the particular
   slot, it is configured to be used as wakeup.

2. If dedicated mpm interrupt is absent for a slot, then
   DAT1 line gpio is configured as wakeup.

CRs-Fixed: 585481
Change-Id: Ide54f807c12262429011e245de7dcecadcc60f3b
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
ARM: dts: msm: add SDHC DAT1 line wakeup support for 8974

This patch adds mpm and gpio based wakeup interrupt support.
SDIO card interrupt can wake up the system by pulling the
DAT1 line low. When the system is suspended mpm monitors
this line and wakes up the system.

CRs-Fixed: 585481
Change-Id: I4ea5e29200e7138bca18ed429175a39414ea3318
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: quirks: enable clock gating for AR6004 card

This patch whitelists the AR6004 card for clock-gating.
The controller supports asynchronous interrupt functionality
which enables to receive interrupts from the card when clocks
are off. Hence, clocks can be turned off when idle.

This patch whitelists the card, to let the clock-gating
framework gate the clock during idle time.

CRs-Fixed: 585481
Change-Id: I651f86e42595cc82f99093c06ee220a1d0ec95a9
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: sdhci: Use right API to read/write host control2 register

The SDHCI host control2 register offset is 0x3E which is not
word aligned and is only 16 bits wide. But we use readl/writel
to read/write to it. Use readw/writew to avoid any alignment
issues.

CRs-Fixed: 585481
Change-Id: Ibaa87ce46f2a2dd97f9e1c7979adb38e426acd5b
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
msm: lpm_levels: Fix incorrect computation of next wakeup time

The next event timer wakeup was incorrectly computed when the hard timer
event doesn't exist. Fix by ensuring the next wakeup is computed only
when a timer event is valid

Change-Id: I40c1f372f84d8f43b2101e37dcfb592193d4b2e0
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
ASoC: msm: Add PCM support in compress driver

PCM playback support is added to compress driver so that application
can use the single audio hardware device to play both compressed
and PCM audio.

Change-Id: Ie7719be8d7435088a7e4cfb5b817d4557e25e4c5
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
msm: lpm_levels: fix incorrect mode select with next event time

Based on the next event timer value the best power mode will get
selected but there is a mismatch in calculation of selecting
the best mode. This change will fix that and selects the correct
mode based on the next wakeup time.

CRs-fixed: 611794
Change-Id: I31270e62b04e7a97afa1c9b0c45069ad82d1a9b0
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>