ASoC: wcd9304: Wait enough time during mbhc calibration

If mbhc micbias has a capacitor which is large enough to delay micbias
voltage ramp up/down, initial calibration also needs to delay enough time
after changing mux to be able to calibrate ground and micbias voltage
accurately.  Increase delay to 50ms during calibration and improve
calibration accuracy.

CRs-Fixed: 495526
Change-Id: I8bf1297045565740175292a522168131754e7940
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
ASoC: wcd9304: recalibrate microphone ground voltage

Different clock sources can affect mbhc voltage inconsistent measurement
accumulation which consecutively results in inaccurate button detection.
Recalibrate ground voltage on dce handler to enhance mbhc button detection
accuracy.

CRs-Fixed: 495526
Change-Id: I30c548677a85febe644da1dfb4ce1c6622c8a658
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
ASoC: wcd9304: Fix dce and sta wait time

Apply correct dce and sta wait time based on calculation
rather than using default values.

CRs-Fixed: 521904
Change-Id: I15578c8ca5ba606af3d7ded85014c178ffc1effe
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Revert "ASoC: wcd9310: Fix DMIC current leakage after disable"

0.3 mA higher sleep current .This happens due to manually
forcing digital mic clock pin to GPIO mode from functional
mode through the TLMM mux.

CRs-Fixed: 529174

This reverts commit 061a10151c1420459f57a8676749216a40c4c8be.

Change-Id: Ic94c8b867d445b2e341751f4e04982dd6bbefda6
Signed-off-by: johny <mjshai@codeaurora.org>
Revert "ASoC: wcd9310: Fix DMIC current leakage after disable"

0.3 mA higher sleep current .This happens due to manually
forcing digital mic clock pin to GPIO mode from functional
mode through the TLMM mux.

CRs-Fixed: 529174

This reverts commit 474bb04e27aa93c9dcdad780fe63100013c9d4eb.

Change-Id: I0b81bdc157115a4c6791f556f56f092607c5f597
Signed-off-by: johny <mjshai@codeaurora.org>
msm: kgsl: Verify the user doesn't accidentally submit a zero length IB

Indirect buffers to be executed will not be (and cannot be) zero length.
Check and reject.

Change-Id: Ic0dedbadea429c4f7bd386c5e64603b51ea8af61
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: scm: Add scm_call_noalloc and helper macros

Currently, scm_call internally calls kmalloc() to allocate a command
buffer structure. This prevents scm_call from working before kmalloc
structures are initialized or during atomic contexts. Allow clients
to pass in a pre-allocated buffer for scm_call to be used for internal
structures.

Change-Id: Id09500c8c696298228aefdcc2a61953e654677c9
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: Add ARCH_RANDOM Kconfig

Some boards may support architecture generated random numbers. Add
the appropriate Kconfig.

Change-Id: I0077a982c9bb6d3a35435cc27fe40b7e0596ca84
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:
	arch/arm/Kconfig
msm: implement ARCH_RANDOM

Currently, the software random number generator is not intialized
until relatively late in the boot process. Software that relies on
random numbers early will not be reliable. Entropy sources are
available early but not early enough for some use cases which means
that moving the software random number generation earlier is not an
option. As an alternate solution, implement the functions associated
with CONFIG_ARCH_RANDOM. These functions currently make a call into
trustzone to get reliable random numbers. The functions are disabled
once the regular random number generator is sufficiently reliable.

Change-Id: If40cfcb96b091fa26a28047c10a902287b26f6c1
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/Makefile
init: Move stack canary initialization after setup_arch

Stack canary intialization involves getting a random number.
Getting this random number may involve accessing caches or other
architectural specific features which are not available until
after the architecture is setup. Move the stack canary initialization
later to accomodate this.

Change-Id: I00b564a2c3172229a44339c061fa380c17fe7d8e
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: kgsl: Init log levels in device init

Device log levels should be initialized during device initialization,
removing this from debugfs init because customer could disable
debugfs.

Conflicts:

	drivers/gpu/msm/adreno.c
	drivers/gpu/msm/kgsl_debugfs.c

Change-Id: Ie1222be1d421405e0d7481c799045cb9876c2a91
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Init FT log level in device init

Currenlty FT log level is init in debugfs init, debugfs
could be removed from commercial software and we might
miss FT logs, initializing FT log level in device init
prevents this.

Change-Id: If6ea02735dd250ecb7579cc0b485145dddb1b6d6
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Use the kmalloc/vmalloc trick for the sharedmem page array

It was previously assumed that most GPU memory allocations would be
small enough to allow us to fit the array of page pointers into one
or two pages allocated via kmalloc.  Recent reports have proven
those assumptions to be wrong - allocations on the order of 32MB will
end up trying to get 8 pages from kmalloc and 8 contiguous pages
on a busy system are a rare beast indeed.

So use the usual kmalloc/vmalloc trick instead - use kmalloc for the
page array when we can and vmalloc if we can't.

CRs-fixed: 513469
Change-Id: Ic0dedbad0a5b14abe6a8bd73342b3e68faa8c8b7
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Do not try to resume the device from INIT state

If the device is still in INIT state there are no open instances
of it running.  Resume calls should be no-ops.  Do not attempt
to start the device at this point.

Change-Id: I1cb6d60581b0b5b0a2ab1b13418adc4ae3983c5e
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: Configure FT behaviour from sysfs instead of debugfs

FT behaviour is changed to be configured from sysfs
instead of debugfs. Sysfs control gives us the advantage
of configuring FT at bootup and also across bootups.
Persistant configuration across bootups helps
testing by configuring FT once and testing the FT
config across bootups.

Conflicts:

	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_debugfs.c

Change-Id: Ia3378f214371a6a4b9f205f9f884976f58585971
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
ALSA: usb-audio: Fix the mixer control range limiting issue

- mixer_ctl_set() function is limiting the volume level
  to particular range. This results in incorrect initial
  volume setting for that device.
- In USB mixer while calculating the dBmin/dBmax values
  resolution factor is hardcoded to 256 which results in
  populating the wrong values for dBmin/dBmax.
- Fix is to use appropriate resolution factor while
  calculating the dBmin/dBmax values.

CRs-Fixed: 515012
Change-Id: I502355af66f850bb65380c27333c3341fa43a947
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
diag: NRT read wakelocks held for very long time

During on-device logging with '-b' option,
NRT read wakelocks i.e. diag_nrt_modem_read
and diag_nrt_wcnss_read were held for more than
a day's time. This patch releases the wakelocks
even if SMD channel will be closed.

Change-Id: I7d211aaeaeb8d59369a191c5eef54c02a1b4a61d
CRs-Fixed: 513309
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
cpufreq: interactive: fix show_target_loads and show_above_hispeed_delay

Remove a trailing whitespace from target_loads and above_hispeed_delay. Problem
happens when user-space program tried to restore parameters that saved before
changing parameters. In this case was returned error(EINVAL).

Change-Id: I5a74e3824602cd6f2b74651adda5ec1b627e61e9
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
Revert "msm: camera: restore Sony 10.1.1.A.1.253 camera driver"

This reverts commit 5a867d8dd8fa830a017c42d3c4053959b6db62bc.

Change-Id: If79c7c2caf7b61b7d770879b3bc8f33424cd6b85
Revert "ion: ioctl compat with old api"

This reverts commit 857b0f1ce46efbaf214cc7615f0a81f0a544cbe0.

Change-Id: Ia9acc97bc2c7cb6183f9704c1d382f204e5cd040