ARM: dts: msm8974: Update MPM mapping to bypass uart_2_irq

Include uar_2_irq in bypass list to allow XO shutdown as this
is not wakeup-capable. uart driver has wakeup gpio on CTS pin and
optional wakeup gpio on rx pin. This should take care of wakeup
from low power state if there is any activity on the pin.

Change-Id: I10d2347eb760146b69f5b13f4cababbfcadb17bf
Signed-off-by: Girish Ghongdemath <girishsg@codeaurora.org>
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: Remove sscanf() from kgsl_pwrctrl.c

Replace sscanf() in kgsl_pwrctrl.c with a generic function to safely
convert 32 bit unsigned ints.

CRs-fixed: 563585
Change-Id: Ic0dedbad10e2264ec8fccab622d094d123b49b77
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
power: qpnp-charger: fix corner case for JEITA

When the ADC notifier is called there is a possibility
that the measured temperature is exactly equal to the
threshold rather than larger or smaller. In this case
JEITA rules are not applied.

Fix this by fixing the JEITA logic to also include
the exact threshold value and thus applying the
correct JEITA logic.

CRs-Fixed: 620291
Change-Id: Ib9462e7d28f6534c359873487420ec21b3e8aaa1
Signed-off-by: David Keitel <dkeitel@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: Free smem client after moving core to UNINIT

If userspace crashes prematurely, there will be a good chance that the
driver hasn't unmapped or freed certain buffers.  These buffers will be
freed in the state transition to UNINIT.  At that point the smem client
needs to be valid for the free/unmaps to be valid.

CRs-Fixed: 611946
Change-Id: I089dcbd1e79f1c2a8671e5719d3a5dbc9926b252
Signed-off-by: Deva Ramasubramanian <dramasub@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>
msm: vidc: Re-program the vbif settings post-power collapse

As part of power collapse we turn off the venus GDSC. When we turn it
back on, we need to re-program the VBIF registers to overwrite the
reset values.

CRs-Fixed: 585609
Change-Id: Ic2ac40274773f9592f510ccb573b9d4920a8647f
Signed-off-by: Deva Ramasubramanian <dramasub@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>