Kernel Upload

Added SIO and V/R scheduler. Added SmartassV2, Badass and Wheatley governors.

Finished badass governor modifications. Added intellidemand governor. Added a missing struct for wheatley.

Add XZ compressor and set LZMA as default

Added option to OC, freq 1836 khz

Fixed uV references in celox board.

oc: adjust L_VALs for OC calibration

Added usb fast charge

added frandom support. Source from https://github.com/Ryuinferno

Added mpdecision from showp1984 repo

msm_mpdecision: tweaks for hercules, added get_rq_info()

msm_mpdecision: prevent init from changing min/max

frandom: compile as a module

gov: add missing line for cpuinitcount increment

msm_mpdecision: remove unneeded code for dual core CPU.

msm_mpdecision: build msm_rq_stats if CONFIG_MSM_MPDEC is set

msm_mpdecision: fix hotplugs values

gpu: add GPU OC up to 2d 160-266, 3d 266-320 mhz

Changed ideal settings in smartass governor, added fixes for some bugs

gov: fixed smartass2 group attribute

smartass: fix bug in smartassV2 governor where sysfs is incorrectly removed and cpufreq stock to max freq

gov: fix smartass freq going to max

gov: add 2nd phase to ondemand governor

gov: remove hardcoded values for 2nd-phase, can now be modified in defconfig

gov: added touchpoke to ondemand governor
ported from bricked-mako
credit to @showp1984
https://github.com/showp1984/bricked-mako/commit/f6656fbcf65e47d27a04f0c1fc900e32698bfcb9

Add Link CPU governors

Make Link both CPU optional

cpu_gov_sync: sync min/max frequency in both cores when changes in one core are applied

cpu_gov_sync: enabled cpu sync by default

msm_thermal: add thermal driver support
Ported from Dennis (@showp1984) git https://github.com/showp1984
from pyramid and mako repo.

Some changes were done for the Galaxy S2, rest of commits squashed here for
easy pick. Refer below to the list of changes.

msm: thermal: Add MSM thermal sensing and limiting

Add a thermal driver to poll and detect any thermal condition at boot
and limit max cpu frequency on a thermal condition. This driver is
intended to limit cpu thermal output until the userspace thermald
kicks in. The thermald will disable this driver and take over the
cpu thermal sensing and mitigation.

Change-Id: I2710bfdeb5bf01c864437e13da835621d1b9202c
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>

thermal: Fix hotplug race condition leading to memory corruption.

msm_thermal module made a copy of the CPUFreq policy structure
pointer but continues to try and use it after the core has been
hotplugged (and the original structure is freed). The fix is to
use cpufreq_cpu_get/put instead of copying cpufreq pointers.

CRs-fixed: 342351
Change-Id: I312d8bccc09a5df5805f99fecdc9409d9d4ed2be
Signed-off-by: Eugene Seah <eseah@codeaurora.org>

msm_thermal: Remove error messages from log when core is offline

If msm_thermal is not cancelled and TSENS reports a high temperature,
it might try to limit the frequency, but since the core is offline,
the frequency limit may not happen. We need not report this error.

Change-Id: I579e2329c6fb038d53f2d207a6a832185e633785
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>

driver/thermal: create kernel MSM thermal management for MSM8x60 SOC

thermal: Don't limit CPU frequency after msm_thermal is disabled

There may be an outstanding task to check for threshold crossing
when msm_thermal is disabled and CPU is restored to maximum
frequency. This task can get scheduled after the maximum frequency
is restored, and result in another mitigation that pins CPU
frequencies to 918mHz. This happens in the case that the final
temperature was still above the max temperature threshold.
This patch ensures any outstanding tasks are cancelled and flushed
before finally restoring the CPU frequencies.

CRs-fixed: 351614
Change-Id: Ifce00b379989b78856803ac09c7403207f5c998b
Signed-off-by: Eugene Seah <eseah@codeaurora.org>

msm_thermal: 3-phase thermal throttling

This introduces 3-phase thermal throttling to the existing
msm_thermal driver (it now works more like thermald).
This also changes the sampling rate to check every second
for increased temperatures.
Additionally this adds clear thresholds for the 2 new tripping
points.

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: add sysfs interface

This adds a sysfs interface to msm_thermal.
I've also restructured the tuneables into a struct
for better overview.

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: move sysfs to /sys/kernel/msm_thermal/conf/

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: fix saving pre-throttled freq

Signed-off-by: showp1984 <showp1984@gmail.com>

add thermal support for celox

drivers/thermal: create own unbound (highpri) wq for msm_thermal

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/thermal: add emergency shutdown

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: emergency shutdown rework

additionally to initiating the shutdown the lowest possible
frequency should be set. (=max throttle atm)
update the cpufreq and do not cancel the workqueue
+ some small code improvements

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: use temperature1 sensor too
The sensor1 seems to be cpu related too, and it usually
shows higher temps (~2°C). Use the higher value of both
to decide if thermal throttling is neccessary.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: do not wait, unthrottle now

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: remove not needed condition

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fix clear thresholds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: only update freq if new is not > than saved_max

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: rework throttling states

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: set cpus online to set frequency back to unthrottled

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: change temperatures slightly

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fixing debug messages

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fix mid scaling

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: don't calculate max everytime, once is enough

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

cpufreq: add cpufreq_notify_utilization

gov: cpufreq_ondemand - adjust up_threshold and down_differencial
for better performance

msm_mpdecision: add stats & expose to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

msm_mpdecision: fix sleep, don't use pause

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

msm_mpdecision: stats: if cpu is online, add current ontime to stats

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

cpufreq: cpufreq_notify_utilization - add missing line

gov: add 2nd phase to ondemand governor

gov: remove hardcoded values for 2nd-phase, can now be modified in defconfig

gov: added touchpoke to ondemand governor
ported from bricked-mako
credit to @showp1984
https://github.com/showp1984/bricked-mako/commit/f6656fbcf65e47d27a04f0c1fc900e32698bfcb9

Add Link CPU governors

Make Link both CPU optional

cpu_gov_sync: sync min/max frequency in both cores when changes in one core are applied

cpu_gov_sync: enabled cpu sync by default

msm_thermal: add thermal driver support
Ported from Dennis (@showp1984) git https://github.com/showp1984
from pyramid and mako repo.

Some changes were done for the Galaxy S2, rest of commits squashed here for
easy pick. Refer below to the list of changes.

msm: thermal: Add MSM thermal sensing and limiting

Add a thermal driver to poll and detect any thermal condition at boot
and limit max cpu frequency on a thermal condition. This driver is
intended to limit cpu thermal output until the userspace thermald
kicks in. The thermald will disable this driver and take over the
cpu thermal sensing and mitigation.

Change-Id: I2710bfdeb5bf01c864437e13da835621d1b9202c
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>

thermal: Fix hotplug race condition leading to memory corruption.

msm_thermal module made a copy of the CPUFreq policy structure
pointer but continues to try and use it after the core has been
hotplugged (and the original structure is freed). The fix is to
use cpufreq_cpu_get/put instead of copying cpufreq pointers.

CRs-fixed: 342351
Change-Id: I312d8bccc09a5df5805f99fecdc9409d9d4ed2be
Signed-off-by: Eugene Seah <eseah@codeaurora.org>

msm_thermal: Remove error messages from log when core is offline

If msm_thermal is not cancelled and TSENS reports a high temperature,
it might try to limit the frequency, but since the core is offline,
the frequency limit may not happen. We need not report this error.

Change-Id: I579e2329c6fb038d53f2d207a6a832185e633785
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>

driver/thermal: create kernel MSM thermal management for MSM8x60 SOC

thermal: Don't limit CPU frequency after msm_thermal is disabled

There may be an outstanding task to check for threshold crossing
when msm_thermal is disabled and CPU is restored to maximum
frequency. This task can get scheduled after the maximum frequency
is restored, and result in another mitigation that pins CPU
frequencies to 918mHz. This happens in the case that the final
temperature was still above the max temperature threshold.
This patch ensures any outstanding tasks are cancelled and flushed
before finally restoring the CPU frequencies.

CRs-fixed: 351614
Change-Id: Ifce00b379989b78856803ac09c7403207f5c998b
Signed-off-by: Eugene Seah <eseah@codeaurora.org>

msm_thermal: 3-phase thermal throttling

This introduces 3-phase thermal throttling to the existing
msm_thermal driver (it now works more like thermald).
This also changes the sampling rate to check every second
for increased temperatures.
Additionally this adds clear thresholds for the 2 new tripping
points.

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: add sysfs interface

This adds a sysfs interface to msm_thermal.
I've also restructured the tuneables into a struct
for better overview.

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: move sysfs to /sys/kernel/msm_thermal/conf/

Signed-off-by: showp1984 <showp1984@gmail.com>

msm_thermal: fix saving pre-throttled freq

Signed-off-by: showp1984 <showp1984@gmail.com>

add thermal support for celox

drivers/thermal: create own unbound (highpri) wq for msm_thermal

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/thermal: add emergency shutdown

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: emergency shutdown rework

additionally to initiating the shutdown the lowest possible
frequency should be set. (=max throttle atm)
update the cpufreq and do not cancel the workqueue
+ some small code improvements

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: use temperature1 sensor too
The sensor1 seems to be cpu related too, and it usually
shows higher temps (~2°C). Use the higher value of both
to decide if thermal throttling is neccessary.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: do not wait, unthrottle now

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: remove not needed condition

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fix clear thresholds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: only update freq if new is not > than saved_max

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: rework throttling states

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: set cpus online to set frequency back to unthrottled

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: change temperatures slightly

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fixing debug messages

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: fix mid scaling

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

thermal: don't calculate max everytime, once is enough

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

cpufreq: add cpufreq_notify_utilization

gov: cpufreq_ondemand - adjust up_threshold and down_differencial
for better performance

msm_mpdecision: add stats & expose to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

msm_mpdecision: fix sleep, don't use pause

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

msm_mpdecision: stats: if cpu is online, add current ontime to stats

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

cpufreq: cpufreq_notify_utilization - add missing line

block: Adding ROW scheduling algorithm

This patch adds the implementation of a new scheduling algorithm - ROW.
The policy of this algorithm is to prioritize READ requests over WRITE
as much as possible without starving the WRITE requests.
The requests are kept in queues according to their priority. The dispatch
is done in a Round Robin manner with a different slice for each queue.
READ request queues get bigger dispatch quantum than the write requests.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: Add support for reinsert a dispatched req

Add support for reinserting a dispatched request back to the
scheduler's internal data structures.
This capability is used by the device driver when it chooses to
interrupt the current request transmission and execute another (more
urgent) pending request. For example: interrupting long write in order
to handle pending read. The device driver re-inserts the
remaining write request back to the scheduler, to be rescheduled
for transmission later on.

Add API for verifying whether the current scheduler
supports reinserting requests mechanism. If reinsert mechanism isn't
supported by the scheduler, this code path will never be activated.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: Add API for urgent request handling

This patch add support in block & elevator layers for handling
urgent requests. The decision if a request is urgent or not is taken
by the scheduler. Urgent request notification is passed to the underlying
block device driver (eMMC for example). Block device driver may decide to
interrupt the currently running low priority request to serve the new
urgent request. By doing so READ latency is greatly reduced in read&write
collision scenarios.

Note that if the current scheduler doesn't implement the urgent request
mechanism, this code path is never activated.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: compile ROW statically into the kernel

ROW is a new scheduling algorithm. Similar to the existing scheduling
algorithms it should be compiled to the kernel statically giving the user
the ability to switch to it without kernel recompilation.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

row: Adding support for reinsert already dispatched req

Add support for reinserting already dispatched request back to the
schedulers internal data structures.
The request will be reinserted back to the queue (head) it was
dispatched from as if it was never dispatched.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

row: Add support for urgent request handling

This patch add support for handling urgent requests.
ROW queue can be marked as "urgent". If an urgent queue was
un-served in a previous dispatch cycle and a request was added
to it - it will trigger issuing urgent request to the device driver.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: row: Add some debug information on ROW queues

1. Add a counter for number of requests on queue.
2. Add function to print queues status (number requests
   currently on queue and number of already dispatched requests
   in current dispatch cycle).

Change-Id: I1e98b9ca33853e6e6a8ddc53240f6cd6981e6024
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: row: Insert dispatch_quantum into struct row_queue

There is really no point in keeping the dispatch quantum
of a queue outside of it. By inserting it to the row_queue
structure we spare extra level in accessing it.

Change-Id: Ic77571818b643e71f9aafbb2ca93d0a92158b199
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: row: fix sysfs functions - idle_time conversion

idle_time was updated to be stored in msec instead of jiffies.
So there is no need to convert the value when reading from user or
displaying the value to him.

Change-Id: I58e074b204e90a90536d32199ac668112966e9cf
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

block: row: Aggregate row_queue parameters to one structure

Each ROW queues has several parameters which default values are defined
in separate arrays. This patch aggregates all default values into one
array.
The values in question are:
 - is idling enabled for the queue
 - queue quantum
 - can the queue notify on urgent request

Change-Id: I3821b0a042542295069b340406a16b1000873ec6
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>