PM: devfreq: Add sysfs nodes for devfreq governors

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Fix show available freqs

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Move governor node to gpufreq

Final path is: /sys/class/devfreq/fdb00000.qcom,kgsl-3d0/gpufreq

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Add conservative governor

A GPU governor is not rocket science. This one gets the job done pretty
smoothly while complying with devfreq framework rules.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Add some conservativeness

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Always reflect a change of polling interval

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: conservative: Return 0 if GPU just started

Bailing out early is perfectly fine, so do not trigger an error in
update_devfreq.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Fixup device transition and usage statistics

Ignore bogus data during slumber in transition and usage stats that
rendered the output basically useless. Also fix the reported GPU
frequency.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Use high priority workqueue

It does not make sense to run kgsl on high and devfreq on regular
priority.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Adapt devfreq_get_freq_level to cpubw requirements

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM / devfreq: Rewrite devfreq_update_status() to fix multiple bugs

The current devfreq_update_status() has the following bugs:
- When the new frequency doesn't have a valid level, the time spent in the
  new frequency is counted towards the next valid frequency switch instead
  of being ignored.
- The time spent on the previous frequency is added to the new frequency's
  stats instead of the previous frequency's stats.

This patch fixes all of this.

Change-Id: I7bbdafca78d1565cdbf815356556fe6d6cca9e3f
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM / devfreq: Check for GPU busy time before sending the sample

Sometimes GPU busy time is very low during sampling. Accumulate
the statistics and send them with the next sample.

Change-Id: I77e568b48afc3a4922c7c341d9478705b7ae3a30
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM / devfreq: Get priv data for msm-adreno-tz governor from dev_profile

The devfreq infrastructure has several bugs and general design flaws
with private governor data support. As a workaround the msm-adreno-tz
governor gets it's private data from the device driver by doing a
container_of on the dev_profile registered by the device driver.

[myfluxi: Adapt to 8974, add yet unused stuff for conservative governor]

Change-Id: Ib9dffd063fe3aa5cfd55727d41f7633e88b3f998
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
arm/dt: msm8974: Lower GPU voltage constraints

Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: kgsl: Report correct GPU frequency in sysfs

Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: kgsl: Export device state to devfreq

Signed-off-by: Dan Trifan <jimsth@gmail.com>