msm:rq_stats: Register for Cpufreq policy notification

Currently the load of the system is calculated using the max
frequency that is read during startup(It does not get updated
when the policy changes). As a result, the average load of the
system is incorrectly calculated and the system might not bring
the cpus online to manage the additional load. This
reduces the performance of the system.

To fix this issue, register rq_stats to receive cpufreq policy
notifications. Update the policy's max frequency when a
notification is received and use that value to calculate the load.

Change-Id: Icc78e28c736c170e198f723fd96c13dfb2dafe8a
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
msm: pm: Add support to query cpu status

During hotplug operation primary core is required to query
cpu registers to determine whether secondary core has
successfully shutdown.

Change-Id: I81bd47ba851698e86269652afe381b0571ca912a
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
samsung: msm8930: Add sleep status device
msm: spm: modify power collapse seq for kraitv3

High sleep current observed due to L2 cache not going into
power collapse in special cases.

While analyzing, a timing issue was found that can manifest itself when the
clamp signal is asserted during the Krait CPU1 power collapse sequence.
When it occurs, the issue causes an L2 FIFO to falsely believe that it
has data to return to CPU1 when it does not.The condition isnt detected until
later when CPU0 and the L2 attempt to collapse.

This condition keeps the L2 from going idle which keeps it from power
collapsing after both CPUs have collapsed.  This in turn prevents the
RPM from enabling a system low power state (VDD minimization).
The issue is likely process/temp/voltage dependent.

HW team recommended a workaround, the details are as below.

Add commands to the Krait CPU power collapse SPM sequences to assert
Krait CPU reset prior to asserting the CPU clamp signal and de-assert
CPU reset after the CPU clamp is asserted.
Since the CPU clocks are gated (by the first SPM command in the
sequence), and the clamp is applied, the Krait CPU will do nothing
when its reset is de-asserted.

The workaround involves changing both CPU power collapse SPM sequences
(Power Collapse with and without RPM notification).

CRs-fixed: 518750
Change-Id: I62c76f49a96a8cb6ecf67733ae9a7ff1a79a76f7
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
samsung: msm8930: modify power collapse seq for kraitv3
serrano: Merge with MG3
serrano: Add CM defconfig
ASoC: msm: qdsp6v2: Fix bug in device V2 command

Add missing braces for Device V2 command failure case.
Crs-fixed: 492994

Change-Id: Ieacbbe94897a4fb73e6ffadc7d1bdcadb2b35dd2
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
ASoC: msm: Support to configure the code for media button

There is mismatch in button 0 code value that is used
in kernel and userspace. Configure the code for button 0
to match with that of userspace.

Change-Id: Ie0518b69e50d50d81b44bea6ce48ce1db2bbae03
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
msm: camera: prevent invalid access through mmap

Disable access to invalid addresses through mmap.
Add appropriate range checks to ensure valid accesses
through framebuffer mmap. This prevents illegal
access into memory.

Change-Id: Ie053d9d8efe951b88f28b020dd9c2356e54723a7
CRs-Fixed: 475794
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
ALSA: core: Fix crash by avoiding appl_ptr crossing 32-bit boundary

Incase of A2DP usecase using proxy driver, appl_ptr has
boundary value as 0x60000000 frames in sw_params for stereo(2 channels).
When this value crosses 0x40000000, then userspace calculating
appl_ptr at bytes results in crossing 32-bit value 0x100000000,
and points to 0x0 offset which can result in crash or pop.
To avoid above scenario, set the sw_params appl_ptr boundary value
within 0x40000000. Added proper check at sw_params update
to set this value correctly within 32-bit boundary(frames).

Change-Id: I537a04156699d90549a0a468ae19539ecd552d3b
CRs-Fixed: 483203
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
msm: pil-q6v4: Change modem shutdown sequence

Existed sequence:
	axi_bus_halt(modem)
	pas_shutdown(modem)
	axi_bus_halt(modem_fw)
	pas_shutdown(modem_fw)

With the above sequence some outstanding transactions from Modem FW
when the clock reset happens, will cause a bus hang leading to a system
reset.

Do bus axi port halt for modem SW and modem FW together before making TZ
calls for either modem SW/FW reset. New sequence would be as below.

New sequence:
	axi_bus_halt(modem)
	axi_bus_halt(modem_fw)
	pas_shutdown(modem)
	pas_shutdown(modem_fw)

CR-Fixed: 504698
Change-Id: I40ad1116f96b0d77ee3b6be29f3295cc7ae171a1
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
msm: camera: Handle incorrect parameter properly

By this change, when incorrect size is passed, we
return back rather than proceeding forward.

CRs-Fixed: 477936

Change-Id: I8f3ea3c7680a468e36ed0cdb026e95cc29e3f4be
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
msm: gemini: Fix the error irq handling sequence

Update the gemini IRQ handling sequence in ISR.

Change-Id: Ia47e1600174462341027540247a79cba7ffd9c56
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
msm: gemini: Reset the core incase of overflow error

Reset the gemini core for the overflow usecases.

Change-Id: I64b4283806d67615b2963e0d6a42f04a40d6a892
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
msm:camera: Fix signedness issue in hw_exec_cmds

  In hw_exec_cmds()second argument m_cmds should be
  of type unsigned interger

Change-Id: Idad2eb1a59481f3fe9f90221ff2061e8dae57013
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
msm: gemini: Fix the size argument of hw_region_dump function.

The size argument for the msm_gemini_hw_region_dump function is
signed which is not correct, since the function operates on
it as if it is unsigned. Change this to unsigned parameter.

Change-Id: Icea70ad20b010651047b911e7b6ae57889e610e7
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
 msm:camera: Fix overflow issue in ioctl_hw_cmds function

    'len' is of type signed int 32bit,but the assigned value
    may exceed maximum unsigned int32 range.Add overflow check
    and graceful exit if 'm'exceeds UINT32_MAX value.

Change-Id: I38f0d10a0cb44d08d0054f91044fc891c246ebd1
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
msm-camera: Removing MSM_GMN_IOCTL_TEST_DUMP_REGION ioctl

Removing the MSM_GMN_IOCTL_TEST_DUMP_REGION call because this
is not used.

CRs-Fixed: 496905
Depends-on: 372524

Change-Id: I91147bbf67055351a115687a18a1172a649d5d6a
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>
msm-camera: Added the  NULL check in gemini driver.

Adding NULL check for ionhandle and y_off in gemini driver files.

CRs-Fixed: 504159

Change-Id: I6d20298183bec0c3c2c16088a936ac6f7d307da4
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>