cpufreq: Introduce CPU-boost framework

The CPU-boost framework allows you to place hooks in various drivers to boost the CPU for either a specified duration or indefinitely (until it is manually unboosted). If a new boost request is sent while the CPU is boosted then the new boost request will take precedence and immediately override the current boost.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
Add initial CPU-boost hooks

CPU is currently boosted for these activities:
*Taking a picture (1188MHz for 3s)
*Starting video playback (1242MHz for 5s)
*Recording video (594MHz indefinite)
*Turning on the display (972MHz for 7s)

Signed-off-by: Sultanxda <sultanxda@gmail.com>
cpu_boost: Respect max frequency

If the requested boost frequency is greater than the maxfreq then reduce the boost to 2 steps below the current maxfreq (108MHz below the current maxfreq). If the maxfreq is 486MHz or lower then the boost will be canceled.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
msm8x60_celox: Add CPU-boost hook in ts power-on sequence

The touchscreen is powered on roughly 100ms before the panel is powered on. This gives us an extra 100ms of earlier boosting when waking the device from sleep.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
cpu_boost: Add functions to enable/disable boosting

Signed-off-by: Sultanxda <sultanxda@gmail.com>
i2c: gp2a_proximity: Disable CPU-boost when proximity sensor is open

When proximity sensor is open, we are expecting the screen to be turning on and off rapidly. Disable CPU-boost when this happens so the CPU isn't boosted every time the screen turns on.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
msm: cpufreq: Sync maxfreq of all CPUs with CPU0

When a CPU core is plugged back in, the maxfreq of the plugged core resets to the maxfreq it had set at init time, thus losing any custom maxfreq set for that core. Sync the maxfreq of all cores with core0 to fix this issue.

Thanks to @EmmanuelU for reporting this issue.

Signed-off-by: Sultanxda <sultanxda@gmail.com>

Conflicts:
	arch/arm/mach-msm/cpufreq.c
msm: cpufreq: Sync minfreq of all CPUs with CPU0

Signed-off-by: Sultanxda <sultanxda@gmail.com>
cpu_boost: Only restore minfreq to CPU0

Previously, when a non-primary CPU core was boosted, if it was offline after a boost expired, then the minfreq on that CPU would still be set to the boost frequency. Minfreq is now synced across all cores in msm/cpufreq, so we only need to restore the minfreq to CPU0.

Signed-off-by: Sultanxda <sultanxda@gmail.com>

Conflicts:
	drivers/cpufreq/cpu_boost.c
cpu_boost: Clean up minfreq restoration

Signed-off-by: Sultanxda <sultanxda@gmail.com>

Conflicts:
	drivers/cpufreq/cpu_boost.c
camera: sec_m5mo: Introduce low-power flash mode

This new low-power flash mode is an emulated flash mode that only exists in the kernel (it is not in the HAL). When battery is at 35% or lower, low-power flash is automatically enabled and sets the flash LEDs to low power (rather than the regular high-power mode).

Low-power flash fixes the hard shutdowns that occur while taking pictures with flash on low battery.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
bt: Fix sizeof-pointer-memaccess warning

This patch fixes wrong memcpy size when copying ltk value to
HCI_OP_LE_LTK_REPLY command.

Change-Id: I44e5e3da15369d4b424581720ccd3bac820ef2e0