PM: devfreq: Fix simple_ondemand crashing on startup

simple_ondemands private data must be set to NULL, otherwise we would
run into a NULL pointer in kgsl_devfreq_get_dev_status().

Change-Id: I6cc6a8b11e3b58b8c3e3c26d43ee36949cf62351
powersuspend: new PM kernel driver for Android w/o early_suspend

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Signed-off-by: Paul Reioux <reioux@gmail.com>

powersuspend: fix logci derps :p

Change-Id: I7bb9d32b7e7ce92ee1030e3a3c0e8888a88ec066
Signed-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: remove userspace dependency from powersuspend

make powersuspend not depend on a userspace initiator anymore, but use a hook
in autosleep instead.

Change-Id: I8d50261b4b32b72883361e9bdab8e351df358705
Signed-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: add back userpace control w/ default kernel control

make kernel / userspace mode switchable

Change-Id: Ia68dc59f8144798178f6e6fae8fb9fbdb818825b
Signed-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: default to userspace for now

Change-Id: Iedd4190d103c5a419744a84d7b13dc2ba420f011
Signed-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: LCD screen on/off hooks (Yank555.lu)

- add an alternative hook for screen on / off detection in the display
  pannel driver
- sleeps  ~0.1s sooner, wakes up ~1s later then autosleep
- clean up source formatting a bit (Paul Reioux)

Change-Id: I47b0b5a8982b57f97ef50e92f1c50d6df67b3f96
Signed-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: cumulative update to version 1.5

- fix hybrid-kernel mode cannot be set through sysfs

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.4 (Yank555.lu)

- add hybrid-kernel mode (autosleep and panel, first wins)
- default to hybrid-kernel mode
- harmonize debug message with my other stuff
- include all 3 modes as default, so it's only commenting out to change

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.3 (Yank555.lu)

- fix stupid typo
- add an alternative hook for screen on / off detection in the display panel driver
(sleeps ~0.1s sooner, wakes up ~1s later then autosleep)

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Change-Id: I72466cce1f3cdf2f854e580dbcb79106fcfc1434
Signed-off-by: Paul Reioux <reioux@gmail.com>
Defconfig: Enable powersuspend
PM: devfreq: Report correct GPU frequency in sysfs

Change-Id: I5f6f3ec8a4c77befa15df678842c242a68474446
block: fiops ioscheduler core

FIOPS (Fair IOPS) ioscheduler is IOPS based ioscheduler, so only targets
for drive without I/O seek. It's quite similar like CFQ, but the dispatch
decision is made according to IOPS instead of slice.

The algorithm is simple. Drive has a service tree, and each task lives in
the tree. The key into the tree is called vios (virtual I/O). Every request
has vios, which is calculated according to its ioprio, request size and so
on. Task's vios is the sum of vios of all requests it dispatches. FIOPS
always selects task with minimum vios in the service tree and let the task
dispatch request. The dispatched request's vios is then added to the task's
vios and the task is repositioned in the sevice tree.

Unlike CFQ, FIOPS doesn't have separate sync/async queues, because with I/O
less writeback, usually a task can only dispatch either sync or async requests.
Bias read or write request can still be done with read/write scale.

One issue is if workload iodepth is lower than drive queue_depth, IOPS
share of a task might not be strictly according to its priority, request
size and so on. In this case, the drive is in idle actually. Solving the
problem need make drive idle, so impact performance. I believe CFQ isn't
completely fair between tasks in such case too.

Change-Id: I7779e4edc64bf1a534a1c7eb82ed510bfcd2dd29
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops read/write request scale

read/write speed of Flash based storage usually is different. For example,
in my SSD maxium thoughput of read is about 3 times faster than that of
write. Add a scale to differenate read and write. Also add a tunable, so
user can assign different scale for read and write.

By default, the scale is 1:1, which means the scale is a noop.

Change-Id: I028363d76b56adb00d74dbbda76cb4eb5ed42e3b
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops sync/async scale

CFQ gives 2.5 times more share to sync workload. This matches CFQ.

Note this is different with the read/write scale. We have 3 types of
requests:
1. read
2. sync write
3. write
CFQ doesn't differentitate type 1 and 2, but request cost of 1 and 2
are usually different for flash based storage. So we have both sync/async
and read/write scale here.

Change-Id: I10e0405dce90415777d1196fa90f146fc937dbe0
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops add ioprio support

Add CFQ-like ioprio support. Priority A will get 20% more share than priority
A+1, which matches CFQ.

Change-Id: Iad9e5c1191d55347ccb3d9b6d9baabfd5c522542
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops preserve vios key for deep queue depth workload

If the task has running request, even it's added into service tree newly,
we preserve its vios key, so it will not lost its share. This should work
for task driving big queue depth. For single depth task, there is no approach
to preserve its vios key.

Change-Id: I79061274c56f761e3cae93c6b13e72958ddd8e86
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops bias sync workload

If there are async requests running, delay async workload. Otherwise
async workload (usually very deep iodepth) will use all queue iodepth
and later sync requests will get long delayed. The idea is from CFQ.

Change-Id: I4df70736165bcfc6d6996f5e36db8f3a0b83668c
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
block: fiops add some trace information

Add some trace information, which is helpful when I do debugging.

Change-Id: I51481570ca191f7bd4bac702268981ea9f22d0bb
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: RobbieL811 <RobbieLancaster811@gmail.com>
Defconfig: Enable FIOPS IO scheduler