fusion3: Adjust bandwidth parameters

Change-Id: I378d6bf8b0f7e3efaba20d038352c33342f3b2c8
staging: prima: merge of 3.2.6.113 (b21c039)

8baec2c wlan: Default to 11N mode if Fw doesn't support 11AC.
36efbf8 wlan : Fast transition (11r)
b35a481 Fix the error in Tx/Rx highest supported data rate value in VHT cap
c221e19 wlan : Revision 3.2.6.113
99461d7 wlan: Invoke AP stopped interface after SSR
78ac8c7 Wlan : Driver Version 3.2.6.111
5c40bbe wlan: do not issue SSR if low resource recovery stalls
40f1813 wlan: panic on receiving a BIG data packet
9805ece wlan: Updating country code on best AP in scan list.
3588793 Wlan : Driver Version 3.2.6.110
fe7afe5 Fix the memory leaks observed in static source code analysis
8bff22f wlan: Fix for watchdog timer bark issue.
df24aae wlan: To get correct link speed while multiple clients are there.
53d4ad9 wlan: Protect cfg APIs during uninitialized access
e00f36b wlan:Updated SAP-ACS algo to consider 4 interference channels
cf71056 Wlan : Driver Version 3.2.6.109
b94d65b Wlan : Driver Version 3.2.6.108
ddee228 Add DS param IE in probe request frame for 2.4 GHz channel.
bb952d9 wlan: Fix for spectrum management bit in AddBss for SM disabled AP
2dd9e42 wlan: Passing correct list to cfg before changing country code.
2ed73d6 Fix for STA sends data packets only at 1Mbps
92e8f41 Revert "Fix the issue with probe req data rate on 5G channels."
0d9b29c Wlan : Driver Version 3.2.6.107
eafce64 Fix the issue with probe req data rate on 5G channels.
9a66cc7 wlan: Reverting Add a new parameter of modulated DTIM
8c45e41 wlan: Reverting Add a new parameter in Riva API for Prima
e2f67ae wlan: driver version 3.2.6.106
0189a88 wlan: gFixedRate range extended for HT40
6beb791 wlan: update sched_scan_results after cfg80211 resumed
32cd86a wlan: Return success while stoping sched scan.
5dbe730 wlan: DTIM3 changed to DTIM1 after roaming
65eaf0d wlan:Increase CSR_RSN_MAX_AUTH_SUITES to 16

Change-Id: I769c1644ed39bc851ea5aabbc0f759ed8f90fc2a
add cm_fusion3_dogo_defconfig

Change-Id: Ic826aa54bf894548d7e2e6aa443f928bb8496794
dogo: ifdef fix

Change-Id: I2c30aa7f5f4ef6ea8445d045a4c463aeb6890b66
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.

Change-Id: I183d494a74a99d4c662554895f9eb6d9f4092162
Signed-off-by: Andrew Dodd <atd7@cornell.edu>
kgsl: Implement conservative scaling policy

This behaves similarly to the conservative cpufreq governor,
which is similar to how most Mali GPU scaling algorithms behave.

The "trustzone" policy that is default relies on an undocumented
black box to make scaling decisions.

How to enable:
echo conservative > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy

Conservative attr group:
/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative

Polling interval (10-1000):
/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative/polling_interval

Enable stats printing (causes microlags on low polling intervals):
echo 1 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative/print_stats

NOTE:
- perms are set to 666 for testing purposes

Change-Id: I9d854a73981515fc9850104302804928b04c4687
Signed-off-by: Andrew Dodd <atd7@cornell.edu>
mm/page_alloc.c: fix watermark check in __zone_watermark_ok()

The watermark check consists of two sub-checks.  The first one is:

	if (free_pages <= min + lowmem_reserve)
		return false;

The check assures that there is minimal amount of RAM in the zone.  If
CMA is used then the free_pages is reduced by the number of free pages
in CMA prior to the over-mentioned check.

	if (!(alloc_flags & ALLOC_CMA))
		free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);

This prevents the zone from being drained from pages available for
non-movable allocations.

The second check prevents the zone from getting too fragmented.

	for (o = 0; o < order; o++) {
		free_pages -= z->free_area[o].nr_free << o;
		min >>= 1;
		if (free_pages <= min)
			return false;
	}

The field z->free_area[o].nr_free is equal to the number of free pages
including free CMA pages.  Therefore the CMA pages are subtracted twice.
This may cause a false positive fail of __zone_watermark_ok() if the CMA
area gets strongly fragmented.  In such a case there are many 0-order
free pages located in CMA.  Those pages are subtracted twice therefore
they will quickly drain free_pages during the check against
fragmentation.  The test fails even though there are many free non-cma
pages in the zone.

This patch fixes this issue by subtracting CMA pages only for a purpose of
(free_pages <= min + lowmem_reserve) check.

Laura said:

  We were observing allocation failures of higher order pages (order 5 =
  128K typically) under tight memory conditions resulting in driver
  failure.  The output from the page allocation failure showed plenty of
  free pages of the appropriate order/type/zone and mostly CMA pages in
  the lower orders.

  For full disclosure, we still observed some page allocation failures
  even after applying the patch but the number was drastically reduced and
  those failures were attributed to fragmentation/other system issues.

Change-Id: Ic2c0c233993c41c630e24d71df5e12aa614588e5
CRs-Fixed:549847
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Laura Abbott <lauraa@codeaurora.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: <stable@vger.kernel.org>	[3.7+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 026b08147923142e925a7d0aaa39038055ae0156
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
ASoC: msm: qdsp6: Fix pop noise seen with touch tone during playback

Issue: When a session is opened for playback of the touch tone and
	routed through the COPP, the PBE and IIR params are being
	reconfigured in the COPP every time a session is open.

Rootcause:Configuring the PBE/IIR in the COPP every time a session
           is open.
Fix: Configuring the PBE and IIR param in the COPP one time a session
      is open

CRs-Fixed: 541722
Change-Id: If0d1a8c6893a94186e1c6c2a75432d2f4a89f842
Signed-off-by: Satish Kamuju <skamuj@codeaurora.org>
msm: kgsl: Get an active count before snapshotting GPU

Acquire an active count before attempting to capture a snapshot.
Doing so prevents instances of not being able to snapshot because of
switched off clocks.

CRs-fixed: 511878
Change-Id: Ib80b57c127566e274d4018001561f4da7ea38265
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
arm: Move the secondary_startup to __CPUINIT section.

Because of addition 1MB alignment after head.txt section,
the secondary_startup needs to move to 1MB aligned section.

CRs-Fixed: 513919
Change-Id: I332d1e4ec95c877406c6ad3318e5f9a3c85cc10f
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
msm_fb:hdmi:Fix for sysfs Entry Information Leaks

These sysfs entries leak logical and physical addresses
within the kernel and may be read by any user.
The read permissions for the sysfs entries changed
to S_IRUSR from S_IRUGO.

Change-Id: Idfc58c3b639ea4dfa105ff146467a1c4f01edb6e
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
msm: fb: Null check mfd data

Add appropriate null check for mfd data
structure before accessing it's members.
This prevents null pointer accesses in
the driver.

Change-Id: I5aae937f839e4f6ed8d5c5a4b54ab45f0ff07332
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: kgsl: Hold driver process mutex till sysfs entries deleted

sysfs entries deletion logic is not under the driver
process mutex lock, there was a Camera test case
where a single process was trying to call
kgsl_open/kgsl_release very rapidly from multiple
thread, sometimes sysfs entries remained valid
and kgsl_open was trying to create new sysfs
entries for same process id. This caused
WARNING in kernel logs "sysfs: cannot create
duplicate filename '/devices/virtual/kgsl/kgsl/proc/277'"
This change holds the driver process mutex
lock till sysfs entries are deleted.

Change-Id: I0f66314e704c2b53657961303f76e2bd4f34e5b5
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: Remove drawctxt_active from setstate default

drawctxt_active is cleared after the old context is removed
during context switch.  Unfortunately, the context restore calls
adreno_use_default_setstate() which always returns true if
drawctxt_active is NULL, effectively always forcing us down the
software path.

Remove the check - adreno_use_default_setstate() already checks to see
if the GPU is idle and that is a more reliable verification that the
software path is worth going down.

Change-Id: Ic0dedbad57d7783bc23dd925a277a63cd2d78a7e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: fb: Copy unsigned int for notify update

Change to correct signature of msmfb_notify_update
from the ioctl declaration.

Change-Id: Ia7bdfd3dbe8494a641ffd46d484794b4bec7d27c
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Execute shader on wakeup from power collapse

After wakeup from power-collapse, a shader execution is needed
to reset the GPU to a known and stable state on certain targets.
This change implements the required shader execution only
on initialization and on recovery from power-collapse on A3xx
GPU targets.

CRs-fixed: 526544

Change-Id: Ibd33578ecbb94df5ff276d1e460d94235a82dc43
Signed-off-by: Richard Ruigrok <rruigrok@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
Revert "msm: kgsl: Submit a draw command on resume"

This reverts commit a24ed9e2aac9c9d85d84c6f49eb451d8fee7b0b5.

Change-Id: I08d8082b9a849227032d6f5f46f12863865d85a2
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
msm_fb: display: Add support to YCBYCR MDP format

Add support of MDP_YCBYCR_H2V1 interleaved YUV format to MDP
for a-family targets.

Change-Id: I5afb84a95693d1ced114152364782a10c4d56bc2
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: rotator: Add support to YCBYCR rotator format

Add support for MDP_YCBYCR_H2V1 interleaved YUV format in rotator
block.

Change-Id: I4bb192aaab1e72f6e5687ae222a5f9ea2c254bd4
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
kgsl: conservative: change perms to 664

Change-Id: Ie023a6b0f3bf51c4c59030a79ae4ebbbce08201c