drivers/staging: Configurable android log buffer sizes
Purpose is reduce the buffer size accordingly and observe savings
in the total kernel static size, which is useful for
memory constrained devices.

Change-Id: I926ab85213c82924ec483327d5aa248372efc604
Signed-off-by: Bhargav Upperla <bhargavuln@codeaurora.org>

and reduce log buffer size to 128K for mako --mrg666
msm: iommu: re-use existing buffers for `extra' mappings
There is a bug on some hardware that requires us to overmap Iommu
mappings by 2x. Currently, we set aside a dummy buffer onto which we
map all of these dummy mappings. In general, for large mappings it's
nice to use the more efficient iommu_map_range instead of calling
iommu_map repeatedly. However, with our current approach in
msm_iommu_map_extra we can't use iommu_map_range for page_sizes larger
than the dummy buffer. To avoid wasting memory by increasing the size
of the dummy buffer, we can simply remap on top of the the buffer
being mapped in the first place. Since the second mapping should never
be used (besides by the buggy hardware) this should not be a problem.

Re-use existing buffers for all `extra' mappings. Essentially, map the
same physical address range twice. To be extra safe, make the second
mapping read-only.

Change-Id: I35462ad50de8da1f2befa3e3f0895925535cdc98
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: Fix race condition in domain lookup

During lookup of domains we take a pointer to the root node
of the rb tree before taking the mutex to protect the rb tree.
However, the rb root node might change if another process updates
the rb tree after we take the pointer to the root node. This can
cause us to not find the entry that we are looking for.
Fix this by ensuring we have taken the mutex before getting the
root node pointer.

CRs-fixed: 493503
Change-Id: I4702740e486fda0cd92df0401d8e4706598a899b
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: remove stale variable

Tracking the number of user mappings should be done in the Ion
heaps. Remove the variable that was used to track this in core Ion.

Change-Id: I715280515e3010bd002314aefe0ec8cdb37c143d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Remove get_flags ioctl

There are no callers of the get flags ioctl. Remove it
before anyone tries to use it again.

Change-Id: I857ef705fc864cce49f671124b96bd9f47b66ab2
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Minimize allocation fallback delay

When we allocate from iommu heap we first try to allocate 1M pages. If
that fails we try 64K pages, which falls back to 4K pages. However,
we don't want to incur too much overhead when allocating with fallbacks
so we don't want the higher order page allocation to retry, perform
reclaim, or run memory compaction.

Configure the GFP flags to ensure that when we allocate pages greater
than order 0 we don't try to do any retries, reclaim, access emergency
pools, or run memory compaction. This will ensure lower memory allocation
latency for applications.

CRs-Fixed: 470389
Change-Id: Ibb3483dddbedbc733a1f7968821e7bc47bedffcd
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Remove code for reusable heap

The reusable feature is no longer supported. Remove
the associated code.

Change-Id: I7cf6eb302969287d629603fa0ea05ad9714bfb70
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: acpuclock-krait: Add __init markings to 'krait vmin' functions

These functions are only called during boot and can be safely
discarded after.

Change-Id: I6bf20a42fec8b82c3f35e1c042b799ef2dad7790
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Enable HFPLL for init only if switching to it

The existing code left the HFPLL enabled in hfpll_init(), even if
the CPU was detected to be at a non-HFPLL rate. Correct this for
power savings between when hfpll_init() and the first runtime CPU
frequency switch happen. This also ensure votes for HFPLL
regulators are not left unnecessarily asserted.

Change-Id: Iaca5dc7e4769bdbd494d669726ba9b500256f793
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Only print supported number of frequencies once

The current code prints the number of CPU frequencies supported
once for each possible CPU, even though the number of supported
frequencies is the same for each CPU. Cut down on log noise by
printing this number only once.

For example, print:

  [ 0.412932] acpuclk-8974 qcom,acpuclk.23: CPU Frequencies Supported: 11

...instead of:

  [ 0.426013] acpuclk-8974 qcom,acpuclk.23: CPU0: 11 frequencies supported
  [ 0.426052] acpuclk-8974 qcom,acpuclk.23: CPU1: 11 frequencies supported
  [ 0.426089] acpuclk-8974 qcom,acpuclk.23: CPU2: 11 frequencies supported
  [ 0.426124] acpuclk-8974 qcom,acpuclk.23: CPU3: 11 frequencies supported

Change-Id: Iaf15970e6cfcfaec79c0edf8564cab9141fbc05f
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Remove inapplicable 8064 errata workaround

The secondary MUX switching errata is worked around in the secure
warm-boot path, and does not require an in-kernel workaround.

For devices with older warm-boot code (without the workaround),
the removal of the kernel workaround is also safe. The errata
symptoms can only manifest themselves after an L2 power-collapse,
which can't occur until after all Krait CPUs have been brought
online at least once. Since the secondary MUX is only touched by
acpuclock when onlining CPUs for the first time, the MUX will
never be switched after L2 power-collapse.

Change-Id: If675cfab7f325a9f7af6e06ff5ed67bd65461f20
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Add support for HFPLL lock detect bit polling

Some recent devices have a lock detect bit that can be used to
determine when the HFPLL frequency has stabilized. Add optional
support for polling this bit instead of delaying pessimistically
for 60us.

Change-Id: I38bb0c98e36f66fc5efadf9189dbe817f648a972
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: pm-8x60: Do not default to WFI when not enabled

Return MSM_PM_SLEEP_MODE_NOT_SELECTED in msm_pm_idle_prepare as the
default mode instead of WFI. Skip enter low power mode when this
mode is selected.

Change-Id: Id4a07ba1353b358726c81ed441e0327a9154de8a
Signed-off-by: Priyanka Mathur <pmathur@codeaurora.org>
msm: pm-8x60: Use ktime_get for suspend stats

During suspend, the sched clock is stopped and the suspends ops
cannot rely on sched clock to report time spent in suspend. Use ktime
interface to determine the time spent in suspend.

Change-Id: Id244cd8d470c45c1edd408e98ccaf84d30c3e253
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Merge branch 'master' of https://github.com/mrg666/android_kernel_mako
Revert "msm: iommu: re-use existing buffers for `extra' mappings"
Merge branch 'master' of https://github.com/mrg666/android_kernel_mako
autosmp: use cpufreq_get and a counter instead of time functions
autosmp: use cpu frequency instead of load average
- less overhead for the system without the additional load calculation
  by autosmp,
- autosmp needs to work with cpu governor in giving adequate computing
  power to system and CPU governor should have the leading role in this
  task since it must respond earlier,
- since frequency is a function of CPU load determined by the CPU
  governor, autosmp becomes more consistent with the CPU governor when
  CPU frequency is used instead of independently calculating the load
  average,
- works in better sync with the CPU governor by giving the priority
  to increasing the frequency before rushing into hotplugging a core or
  dragging the system
- since autosmp follows the CPU governor it automatically adapts when
  governor is changed.
Support for display gamma control
Originally written by Paul Reioux (faux123)
Modified by rmcc/MoKee for CM project
Modified from his original implementation as follows:
* Remove kgamma_ctrl sysfs entry - it did absolutely nothing
* Alter the show() functions to output the checksum in the
first entry, in order to match the expected input of
the store() functions.  This should not break existing
applications
* Move store/show code to a common function
* Add limit checks from Mike Cain (motley)
* Added a kgamma_apply sysfs entry which will apply
  the current state when anything is stored to it,
  instead of waiting until the next time the LCD
  is power cycled