Revert "cpufreq: Fix broken uevents for cpufreq governor and cpu devices"

This reverts commit 925d42ad81c3b4dd6ea8c7c86c1f9c5eb8a66254.
backlight: lm3630: Max current should not be negative
msm: lpm_levels: update suspend stats counters and time

suspend stats in the debug pm stats are not getting updated as
suspend stats in the suspend wake path is missing. This change
will add and update the suspend stats in the suspend wake path.

CRs-fixed: 536881
Change-Id: I3b47511afb75926e51e82fc83929f405404fbf07
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>
ASoC: dapm: Unlock mutex in error cases

Dapm functions are not unlocking the mutex when an error
is encountered.This change fixes the mutex unlock issue.

Change-Id: Ia7ffaea9a30ae09a501f8f861c62c64d6c110d44
CRs-fixed: 613644
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
ion: Add missing unlock on error path

A mutex_unlock was missing for the alloc_lock on an error
path. Add it.

Change-Id: If88b72fbc2fd18504347b784d5daa2bc9170c55f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
mm/compaction: Break out of loop on !PageBuddy in isolate_freepages_block

We received several reports of bad page state when freeing CMA pages
previously allocated with alloc_contig_range:

 BUG: Bad page state in process Binder_A  pfn:63202
 page:d21130b0 count:0 mapcount:1 mapping:  (null) index:0x7dfbf
 page flags: 0x40080068(uptodate|lru|active|swapbacked)

Based on the page state, it looks like the page was still in use. The page
flags do not make sense for the use case though. Further debugging showed
that despite alloc_contig_range returning success, at least one page in the
range still remained in the buddy allocator.

There is an issue with isolate_freepages_block. In strict mode (which CMA
uses), if any pages in the range cannot be isolated,
isolate_freepages_block should return failure 0. The current check keeps
track of the total number of isolated pages and compares against the size
of the range:

        if (strict && nr_strict_required > total_isolated)
                total_isolated = 0;

After taking the zone lock, if one of the pages in the range is not
in the buddy allocator, we continue through the loop and do not
increment total_isolated. If in the last iteration of the loop we isolate
more than one page (e.g. last page needed is a higher order page), the
check for total_isolated may pass and we fail to detect that a page was
skipped. The fix is to bail out if the loop immediately if we are in
strict mode. There's no benfit to continuing anyway since we need all
pages to be isolated. Additionally, drop the error checking based on
nr_strict_required and just check the pfn ranges. This matches with
what isolate_freepages_range does.

Change-Id: I2a8bc4d381ae35aa15a4d2a2424f0c2de801d9ba
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: kgsl: Fix memleak in IOMMU clock disable

IOMMU clock disable on timestamp allocates memory and passes
the pointer to event created, this memory should be freed
when the event fires.

Change-Id: Ia714550ce8a05958fb6668293cd0400a0f69d4af
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: mpm-of: set wakeup interrupt as NO_SUSPEND

The MPM wakeup interrupt is used to wakeup the Apps processor from
a system wide low power mode when the GIC isn't operational.

The MPM interrupt is configured as a wakeup interrupt by calling into
irq_set_irq_wake().It also needs to be configured with the
IRQF_NO_SUSPEND to prevent the irq from getting disabled during
suspend_device_irqs() in the suspend path. The interrupt is not
re-enabled until after gic_suspend() is executed as a part of the
syscore_suspend() callback.

If the CPU's idle thread enters RPM assisted power collapse between
suspend_device_irqs() and syscore_suspend, the masking of the RPM wakeup
interrupt could prevent wakeup by RPM.

Change-Id: I0d5f0d7277774ddef6817eac10156f92174ec15f
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
qcom: mpm-of: fix bug in finding the pending interrupts

When APPS proc wakeup from RPM assisted PC states it reads
the vMPM status register to know the reason for wakeup and
retrigger the interrupts to handle it. Current code is not
caring about actual enabled interrupts in vMPM. Sometimes
this is causing APPS proc unnecessarily triggering the
interrupts which are not raised in the system. Fix this by
considering the enabled interrupts in vMPM before triggering
the interrupts.

CRs-fixed: 623293
Change-Id: Ia793e6d501cac3d85b51ed6e359703239a4b9945
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
mmc: sdhci: finish the request if sdhc is in bad state

In the current code, if sdhci_check_state returns true a tasklet is
scheduled which doesn't complete the request if host->mrq is NULL,
which is the case, if sdhci is in bad state. This would make the
mmcqd thread wait for completion infinitely.
Hence, complete the request if sdhci_check_state returns true instead
of scheduling the tasklet.

CRs-Fixed: 615537
Change-Id: I8e2950c3999ac3806f9d631c52d86f0dc13b992f
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
msm: msm_bus: Introduce multi level BKE limiting.

Introduce multi level BKE throttling for BIMC masters. By specifying an
array of thresholds and limiting bandwidth values, multiple levels of
master throttling can be achieved.

Change-Id: Ic3b483d3e987266e8f37e66dff8bedd49ddd1d4d
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
ARM: dts: Reintroduce dual config for CPU on msm8974

Reintroduce the dual configuration mode for CPU masters on msm8974.
This will enable throttling of CPU in certain low bandwidth usecases
to alleviate timeline issues for other real time masters in the SOC.

Change-Id: Ic32f217ce40ee6ead4edd191811f9ce9f4e7e7ce
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
ARM: dts: Modify BKE limiting for Krait master

Modify the BKE limiting properties for Krait master by setting up 2
levels of threshold checks and limiting bandwidth values to be applied.
These levels of throttling are needed in certain concurrency usecases to
protect real time masters from surges in bus usage from some APSS masters.

Change-Id: I04d086e10df27d0f7cc1a234fe9eb36a9ea73e65
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
cpufreq: Fix broken uevents for cpufreq governor and cpu devices

cyanogens uevent commit when the governor changes was rendered
non-working since kitkat (or so) as the uevent filter function
caused events to be dropped. Now hook into cpufreq_core_init()
and cpufreq_add_dev_interface() to create our basic ksets for
cpufreq and cpu devices. Also, we don't need to set environmental
data, so clean it up a bit.

This commit requires a change in ueventd.rc that add rules for
several files of interest.

Change-Id: I3aafa0d4e18363e1d68535f513099ecd27024007