Commit Graph

181 Commits

Author SHA1 Message Date
Lucille Sylvester 86ff3d538c msm: kgsl: Bump the GPU frequency for long blocks of processing
If there are several frames of full GPU utilization immediately
bump the frequency to turbo rather than waiting for the DCVS
algorithm to run.

Change-Id: I1215225f8903a8656e8ad92c6c82567b86665933
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2014-12-02 16:56:09 -07:00
Lucille Sylvester dd2286bf25 msm: kgsl: Add a dynamic AB bandwidth vote
The vbif_bw governor should vote for AB tracking a
bus usage counter.  Vote for the previous bus usage
in the next itteration.

Change-Id: I613187646a261aed733ea5f1c0e413deac3a437c
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2014-12-01 10:52:10 -07:00
Lucille Sylvester 4fa91be7e4 msm: kgsl: Add a path for dynamic AB bus votes
Modify the power control code and vbif_bw governor
to allow dynamic AB votes to be set with each GPU
IB vote.  As a placeholder set a static AB vote of
one fourth the IB vote.

Change-Id: I3edb430f9a4545f008ec81b75ddff3c717e91e39
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2014-12-01 10:46:39 -07:00
Junjie Wu d3c2789b2a PM / devfreq: cache_hwmon: Also print low mrps for debugging
Print out all three levels of requests for debugging.

Change-Id: I1e0d12c46386c1aed6b0bfe878449d070fd1adcc
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-11-22 14:29:27 -08:00
Junjie Wu b3f022f89f PM / devfreq: cache_hwmon: Use array for reporting monitor stats
Using an array to report monitor stats instead of hard coded variable
names would allow for cleaner implementations of some cache hwmon
device drivers.

Change-Id: I787bdc12f10a0c8ff3c4195ce229a2987acdfce7
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-11-22 14:29:27 -08:00
Junjie Wu fbe31fda38 PM / devfreq: cache_hwmon: Move IRQ handling to device drivers
The cache monitoring devices might have more than one IRQ to handle
or might have notifications from other drivers instead of using actual
IRQs. So, refactor the governor to move the IRQ handling to the cache
monitoring device specific drivers and just provide an API that can be
used to request a re-evaluation.

The device specific driver can call this API to request an immediate
re-evaluation whenever the cache request has exceeded the previously
set limit instead of waiting for the periodic update.

Change-Id: Ib2e9f53f95749d659f440739a1b074b5a0d94fd8
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-11-22 14:29:26 -08:00
Junjie Wu e770e6b214 PM / devfreq: Refactor Cache HWmon governor to be more generic
The refactor allows the governor to support multiple devfreq devices.
This is done by having different HW monitor instances register their
capability to monitor different devfreq devices and then picking the
right HW monitor based on which devfreq device is using this governor.

Change-Id: I72c0542ce97f3965e422df521e0ce86cad218d93
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-11-22 14:29:26 -08:00
Vikram Mulukutla b55a0de88e PM / devfreq: Workaround cpufreq REMOVE_POLICY versus hotplug lock race
It is not possible to ensure the synchronization of REMOVE_POLICY
notifications with CPU hotplug lock; {get,put}_online_cpus ensures
that hotplug cannot happen, but it is still possible to receive
REMOVE_POLICY notifications asynchronously while checking for online
CPUs within a {get,put}_online_cpus critical section.

Account for this by detecting that we haven't yet setup a local state
when the REMOVE_POLICY notification comes in.

Change-Id: I3cb750f3984ebe078154734444660675e8d8b5bc
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-11-06 11:17:20 -08:00
Subhash Jadavani f88dd9deab PM / devfreq: fix scaling down logic for simple clock scaling
When "simple_scaling" flag is enabled for on demand governor then clocks
should be scaled up when the load is more than up threshold and should
be scaled down when load is less than the up threshold minus down
differential threshold. But currently governor is only scaling down
when load is less than the down differential threshold which is definitely
not intentional. This change fixes the above bug.

Change-Id: If2a234155c12989dc0df397cd84eef4a759ecdfc
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2014-11-05 16:21:09 -08:00
Dan Sneddon 1fb6f163d9 devfreq: spdm: Fix bad pointer access
If the spdm governor fails to connect to the hypervisor correctly
the device it is supposed to be governing will be freed but still
stored in the local list.  This patch removes the device from the
list to prevent accessing an invalid pointer if the hypervisor returns
an error.

Change-Id: I536c198b5a25adbd3044ffd37d9951c197b1dfd9
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-10-30 08:48:41 -06:00
Linux Build Service Account 80fb509d6f Merge "devfreq: devfreq_spdm: Fix enable/disable calls" 2014-10-14 18:32:10 -07:00
Dan Sneddon 4ab21296c6 devfreq: devfreq_spdm: Fix enable/disable calls
The enable and disable calls in the spdm governor are missing
the hypervisor call.  This patch adds the hvc call.

Change-Id: Ic8f4feeb9bc0b7066b6620553725aa636c017c03
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-10-13 11:51:46 -06:00
Dan Sneddon bd2e98933c devfreq: devfreq spdm: Add debugfs support
Add debugfs support for the devfreq spdm driver.
The parameters used for determing the SPDM port
threshold value can be updated via debugfs and sent
to the hypervisor to support fine tuning SPDM
performance.

Change-Id: I6f85deacd7d463d90f512f5de18b7e2140c9f492
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-10-13 08:04:27 -06:00
Linux Build Service Account 2eb9a6a57d Merge "devfreq_devbw: Add support for voting for AB based on IB" 2014-10-12 08:39:43 -07:00
Taniya Das 4238222f12 devfreq_devbw: Add support for voting for AB based on IB
Some generic devfreq governors might not provide AB values since that's a
devbw device specific attribute. In such cases, we might want to make an
average bandwidth (AB) vote that's a percentage of the IB vote to make
sure device BW requirement are not grossly misrepresented. This patch adds
support for that.

Change-Id: I76fbb8d688742058980f0d7568f2e7140023917e
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2014-10-12 05:04:14 +05:30
Linux Build Service Account 8604f18e7e Merge "devfreq: devfreq_spdm: Introduce devfreq_spdm driver." 2014-10-11 14:53:32 -07:00
Saravana Kannan a79b27a5af PM / devfreq: Add timeout feature for cpufreq governor
Some devfreq devices might need their frequency to be set only for a short
time after the CPU frequency changes.

For such devices, add a "timeout" tunable that determines for how many
milliseconds the governor sets the device frequency based on the CPU
frequency. After "timeout" milliseconds from the CPU frequency change, the
governor will set the device frequency back to its minimum value.

Change-Id: I17fc972c0b03fab781864ce735013710c2df4647
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-10-10 13:05:41 -07:00
Saravana Kannan c661a07e09 PM / devfreq: bimc-bwmon: Add support for version 2
The version 2 of the BIMC BWMON HW doesn't reset the counter to 0 when it
hits the threshold. It also has support for an overflow status register.

Change-Id: I9f18d2153a2e5e762ec9950f26e0e7601468a80a
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-10-10 11:33:27 -07:00
Dan Sneddon 56feb971e8 devfreq: devfreq_spdm: Introduce devfreq_spdm driver.
The devfreq_spdm driver implements support for bandwidth voting
based on input from the SPDM device on MSM SoC's.  The SPDM
governor registers for the SPDM interrupt and then calls
the hypervisor to determine the correct bandwidth to vote for.
The devfreq framework poll timer is used to perdiocially
ask the hypervisor for the new bandwidth to request from
the MSM bus scaling code.

Change-Id: I851457e40d49b5929f01c510249d3e6bb4ff2f1d
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-10-09 12:25:35 -06:00
Kumar Gala 25addda607 msm: kgsl: fix build issue with devfreq_trace.h
When building the kernel in tree we get:

In file included from drivers/devfreq/devfreq_trace.h:43:0,
                 from drivers/devfreq/devfreq_trace.c:20:
include/trace/define_trace.h:79:43: fatal error: ./devfreq_trace.h:
No such file or directory
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

The recommend solution is to add the include path to CFLAGS for the file.

Change-Id: I0389abcdcec29b35fa4da997b4ee3fd71c8a6c04
Signed-off-by: Kumar Gala <galak@codeaurora.org>
2014-09-30 15:23:23 -07:00
Saravana Kannan 26656e2447 PM / devfreq: Improve debug logs
- Add more debug logs
- Change the format out the count logs to use hex instead of decimal to be
  consistent with the rest of the logs
- Fix the type of the count variable from signed to unsigned to do the
  above

Change-Id: I02a2968a3f10ce20ca00618e7aeeac9b9cd52bd3
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-09-24 13:01:19 -07:00
Saravana Kannan e83b06b08b PM / devfreq: Fix IRQ clearing in bimc-bwmon
The clearing of the BIMC BWMON IRQ needs clearing bits in two separate
registers. One is a global register and the other is a port specific
register.

The bit in the port specific register needs to be cleared first before
clearing the bit in the global register. Otherwise, the bit in the global
register gets set again before the port specific bit is cleared. Since
these register are in different address regions, we also need memory
barriers around writes to the global register.

Also, clear the counter value before clearing the interrupt status just to
be safe.

Change-Id: Iee8d2caf9bf7d639c65ed19c979036bd5e203bfd
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-09-22 16:18:41 -07:00
Saravana Kannan 67616a640e PM / devfreq: bimc-bwmon: Reduce margin for HW workaround
The HW workaround margin being too high reduces the effectiveness of the
interrupt. Try using a margin only when the measured bandwidth is too small
and risks the counter wrapping around multiple times before it's read.

Change-Id: Ic1e88ad360b2348dfb9ad314c42c1b0218010c1d
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-09-22 16:18:40 -07:00
Vladimir Razgulin b8004afbcb PM/devfreq: Add bw_vbif governor
This governor should be used by KGSL driver to vote for msm bus
bandwidth using devbw devices.

KGSL driver needs to register a callback function that returns
required IB value, and call devfreq_vbif_update_bw() function
any time it want to vote for bus bandwidth.

Change-Id: I6c7c08b7c3255b3793f1868d9cde604175093145
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2014-09-15 11:52:48 -06:00
Saravana Kannan a16d03754f PM / devfreq: devbw: Add suspend/resume APIs
Absence of traffic is guaranteed when the device sitting behind a devbw
device is suspended. In such cases, it is a waste of power to make non-zero
bandwidth votes or to scale the devbw device. So, provide APIs to
suspend/resume the devbw device as needed.

Change-Id: Id58072aec7a9710eb917f248d9b9bd08d3a1ec6a
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-09-12 10:39:01 -06:00
Saravana Kannan 4c80046aa6 PM / devfreq: governor_bw_hwmon: Add suspend/resume support
Some devfreq devices using this governor might need suspend/resume support.
When suspended, those devices won't need any bandwidth votes and there is
no point in monitoring their bandwidth either.

Therefore, upon suspend, vote for zero bandwidth and stop the HW monitor.
Upon resume, vote for the previous bandwidth and start the HW monitor.

Change-Id: I318449995d714959f0ebfe91961bc23fa8edbd04
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-09-12 10:13:58 -06:00
Vikram Mulukutla 8be9f0761f PM / devfreq: Set the is_64 flag in the adreno init function
Set the is_64 flag to true even if using the new SCM
ARMv8 interface.

Change-Id: I98f7addb8225d041dc5f6f2a9f87a6350ced8a7e
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-08-27 10:30:27 -07:00
Vikram Mulukutla 0e87ea7180 PM / devfreq: Use the new scm_call2 API in the MSM Adreno governor
The scm library has added support for a new secure world
interface that is more aligned to the ARMv8 SMC calling
convention. Use the new API while maintaining backward
compatibility.

Change-Id: Ice63cdbdaca3ed8c825cd224c86941a796a9a2d6
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-08-22 15:33:12 -07:00
Linux Build Service Account 70db522515 Merge "msm: kgsl: Split BMC code to a separate devfreq governor" 2014-07-30 21:01:44 -07:00
Vladimir Razgulin 412c7fb6b8 msm: kgsl: Split BMC code to a separate devfreq governor
The existing devfreq governor_msm_adreno_tz supports both GPU DCVS and BMC
(Bus Modification Calculation) at the same time. This change splits BMC
code into a new governor_gpubw_mon.

Change-Id: Ie7162985e994aa5bed0fb41eb2741a811cf8bd56
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2014-07-28 19:54:44 -06:00
Saravana Kannan 1b09e63bfd PM / devfreq: governor_bw_hwmon: Find the correct hwmon for a devfreq dev
The governor pointer match is only present to support legacy BW HW monitors
(Krait) to maintain the legacy governor name. The newer BW HW monitor
devices do the matching using device pointer or of_node. So, the governor
pointer should not be checked if the BW HW monitor devices provide device
or of_node pointers.

Change-Id: Ic48f53e39a9b176b7dec415489bd1657d0df02e2
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-07-23 18:42:46 -06:00
Jacob Stevens 9d10806fb6 PM / devfreq: Add ARM PMU support for bw_hwmon governor
The ARM PMU supports monitoring bus access from each CPU. It also has the
ability to raise an IRQ when the counters overflow. This allows for it to
be used with the bw_hwmon governor to scale the CPU BW requests by
monitoring on the actual bus access traffic.

Change-Id: I0594a6acb846acdc11a18744033636951f22e387
Signed-off-by: Jacob Stevens <jstevens@codeaurora.org>
2014-07-16 09:23:31 -07:00
Saravana Kannan 9a33c46297 PM / devfreq: Add MSM BIMC bwmon support for bw_hwmon governor
The BIMC bwmon device supports monitoring read/write traffic from each BIMC
master port. It also has the capability to raise an IRQ when the traffic
count exceeds a programmable threshold. This allows for it to be used with
the bw_hwmon governor to scale the BW requests from each BIMC master.

Change-Id: Ie8a1471226411e23954ed556292186a5a864ddc1
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-06-27 12:54:25 -07:00
Saravana Kannan 87a47c4a5b PM / devfreq: Make the CPUBW voting device driver to be more generic
Making the driver more generic would allow it to be reused for voting for
BW requirements of other devices like GPU, etc.

Instead of cpubw and qcom,cpubw, the driver and the device are now called
devbw and qcom,devbw respectively.

Change-Id: I49e5a5ba6d46517da19d013413abd471a730af29
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-06-24 19:26:55 -07:00
Saravana Kannan d8b46e28bb PM / devfreq: bw_hwmon: Move IRQ handling to device specific drivers
The bandwidth monitoring devices might have more than one IRQ to handle or
might have notifications from other drivers instead of using actual IRQs.
So, refactor the governor to move the IRQ handling to the bandwidth
monitoring device specific drivers and just provide an API that can be used
to request a re-evaluation.

The device specific driver can call this API to request an immediate
re-evaluation whenever the bandwidth has exceeded the previously set limit
instead of waiting for the periodic update.

Change-Id: I8bfd85d0cb59a1fd0116000aac430680e483b422
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-06-24 15:15:38 -07:00
Saravana Kannan b53827a80c PM / devfreq: Refactor CPUBW HWmon governor to be more generic
The refactored governor will be called bw_hwmon since it's no longer
limited to monitoring the CPU BW in hardware.

The refactor allows the governor to support multiple devfreq devices. This
is done by having different HW monitor instances register their capability
to monitor different devfreq devices and then picking the right HW monitor
based on which devfreq device is using this governor.

The refactor also fixes a very unlikely race condition that can happen when
starting/stopping the governor.

Change-Id: Ifeeeb256115f6ae3075f391d9b4b02666e06f737
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-06-17 20:15:39 -07:00
Saravana Kannan 37cf8e763d PM / devfreq: Add cache HW monitor governor
The cache HW monitor devfreq governor uses the hardware counters to
determine the load on the cache and the appropriate frequency needed to
support that load. This governor can be used in conjunction with the cache
devfreq device to dynamically scale the cache frequency based on the
demand/actual usage from the CPU subsystem.

The governor is written to be agnostic of the actual counters used to
determine the load. On Krait based CPUs, the governor uses the Krait L2 PM
counters which can conflict with certain profiling tools.

The Krait L2 performance monitor counters have the capability to count
different types of requests going to the L2 cache. They also have the
capability to raise interrupts when they overflow. This driver uses those
counters to determine the true usage of L2 from the Krait processor
subsystem and then recommends L2 frequency based on the measured values and
the following tunable parameters.

The driver provides various tunables that allow it to be tuned more in
favor of power or performance:

- cycles_per_high_req: The no. of cache clock cycles that are necessary to
  efficiently process a high-work request to the cache. A higher value
  means higher power and potentially higher performance. A lower value
  means lower power and potentially lower performance.

- cycles_per_med_req: The no. of cache clock cycles that are necessary to
  efficiently process a medium-work request to the cache. A higher value
  means higher power and potentially higher performance. A lower value
  means lower power and potentially lower performance.

- polling_ms: The sampling period in milliseconds. This only affects the
  sampling period when cache use is ramping down or is increasing very
  slowly (See tolerance_mrps).

- min_busy: The minimum percentage of time the cache should be busy. This
  is also applied as a lower bound to the measured busy percentage before
  it's used in calculations. This has to be lower than or equal to
  max_busy. Lower values will make the scaling more aggressive.

- max_busy: The maximum percentage of time the cache should be busy. This
  is also applied as an upper bound to the measured busy percentage before
  it's used in calculations. This has to be greater than or equal to
  min_busy. Lower values will make the scaling more aggressive.

- tolerance_mrps: The minimum increase (in millions of requests per second)
  in cache requests, compared to previous sample, that will trigger an IRQ
  to immediately re-evaluate the cache frequency.

- decay_rate: The parameter controls the rate at which the history is
  forgotten when ramping down. This is expressed as a percentage of history
  to be forgotten. So 100% means ignore history, 0% means never forget the
  historical max. The default 90% means forget 90% of history each time.

- guard_band_mhz: This is a margin that's added to the computed cache
  frequency to account for the time it takes between the load increasing
  and the governor/device finishes ramping up the cache frequency.

Change-Id: I918ae178cd3c9d14cb7714d7eb312cbbbb0d977b
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-06-17 20:15:38 -07:00
Suman Tatiraju dc65a54d91 PM / devfreq: Allocate memory using the right data type
Long and int have different sizes on a 64-bit machine. Allocate
memory for the time_in_state table using the right data type.

Change-Id: Iecc1acc12ddabdb436c212f205aaed8dbb49a2b4
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2014-06-13 10:34:43 -07:00
Linux Build Service Account f8386cd387 Merge "msm: kgsl: set the correct max_state" 2014-06-09 13:55:54 -07:00
Suman Tatiraju c0d04ba25e msm: kgsl: set the correct max_state
Max_state from the driver should be set to the number of power
levels. The devfreq governor then checks the frequencies from
0 to max_state -1.

Change-Id: I79a6da698ff8bcb2840774ccc5d792b7ddbf126b
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2014-06-07 18:02:18 -07:00
Linux Build Service Account d05dac826b Merge "PM / devfreq: Don't hold spin lock when calling scm_call" 2014-06-06 06:07:18 -07:00
Saravana Kannan c645cd4d8b PM / devfreq: Revert addition of devfreq_governor_data and related changes
This reverts commit 0e5b3352b5 and fixes
other code that resulted from it. The devfreq_governor_data field is not
needed since the governors can use other means (like container_of) to find
out device specific private data

Change-Id: Ib7e5db29b40d9676bbb5cf6057e0072665ace821
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-05-29 18:49:59 -07:00
Suman Tatiraju 213dadae88 PM / devfreq: Don't hold spin lock when calling scm_call
Non atomic scm_call is being called for the new tz cmd ids.
This call for 64 bit support is single threaded, hence
don't hold a spinlock before calling it.

Change-Id: Ib19b2f6b5d62111395f4cae2197c3243d4a408ce
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2014-05-29 15:56:57 -07:00
Linux Build Service Account 080ac87949 Merge "PM / devfreq: governor_cpufreq: Output device name in debug print" 2014-05-25 05:44:11 -07:00
Vladimir Razgulin 057891792c 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.

Change-Id: Ib9dffd063fe3aa5cfd55727d41f7633e88b3f998
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2014-05-21 16:29:38 -06:00
Junjie Wu 113938e5cc PM / devfreq: governor_cpufreq: Output device name in debug print
Governor_cpufreq can scale multiple devfreq devices together. Output
devfreq device name in debug print to distinguish requests made
for each device.

Change-Id: I2f6856b66aae87dcb28830e318d20779233308de
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-05-15 15:39:47 -07:00
Suman Tatiraju ad2f7a05c1 PM / devfreq: Add support for new tz CMD IDs
Some platforms require new CMD IDs to support tz functionality.
Check the ID supported and call the appropriate scm call.

Change-Id: I07568a9102e0eebf07caf4aac0e476eafcf5fb23
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2014-05-06 17:08:29 -07:00
Suman Tatiraju 440907c588 PM / devfreq: Return error when tz init fails
When devfreq governor fails to init, the device should boot up and
run at the default freqeuncy.

Change-Id: I4ca5287a602a7c68e8d84d0aa32db522ea16d5a7
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2014-05-05 16:24:17 -07:00
Saravana Kannan 527ca23a10 cpufreq: Delete unused CPUBW and cache scaling code from cpufreq driver
The devfreq cpufreq governor and the devfreq devices for CPUBW and cache
now handle CPUBW and cache frequency scaling based on CPU frequency. So,
delete all the unused code in the cpufreq driver that relates to scaling
CPUBW and cache.

Also update the msm-cpufreq DT format/data accordingly.

Change-Id: I30bf7d8478c964ffa300dd78039cd8c280ec63fc
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-05-01 19:52:26 -07:00
Saravana Kannan 108009e030 PM / devfreq: Move cpubw device from msm_cpufreq to cpufreq governor
Enable the cpufreq governor for the cpubw device on all targets by:
- Adding the devfreq-cpufreq node for mapping CPU freq to cpubw
- Enabling the cpufreq governor configs when CPUBW config is selected
- Switching the default governor for cpubw device to "cpufreq"

Change-Id: Ic10b645123192ed13c66340f288d6a8553d6f251
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-05-01 19:52:26 -07:00
Saravana Kannan 6af7cc0fe6 PM / devfreq: Add devfreq driver for simple device
This driver registers a devfreq device that allows devfreq governors to
scale the frequency of a device clock. This single driver can be used to
support multiple devices as long as those devices don't have a need or
mechanism to monitor their load and use clock APIs to control their
device/core clock.

If devices need to support device specific status monitoring, they could
extend this driver to allow registering device specific status monitoring
funtions or write their own specific devfreq device driver.

Change-Id: Ie1797acf7b35cac6dc49428e270c23082634eb1e
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-05-01 19:52:25 -07:00
Saravana Kannan 57d8052797 PM / devfreq: Fix warning in governor_cpufreq
The cpu_khz variable would be uninitialized when debug messages are printed
for OFFLINE CPUs. Fix that by initializing it to 0.

Change-Id: Ic707c13b1048625c0ecc0b0057af2f84f17462f6
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-05-01 19:52:25 -07:00
Saravana Kannan 0c08ac7504 PM / devfreq: Generic cpufreq governor
This devfreq governor is a generic implementation that can scale any
devfreq device based on the current CPU frequency of all ONLINE CPUs. It
allows for specifying CPU freq to devfreq mapping for specific devices.
When such a mapping is not present, it defaults to scaling the device
frequency in proportion to the CPU frequency.

Change-Id: I8d3b1fea26572defbad2ce8b6cf87930caa25ca6
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-04-24 22:51:40 -07:00
Junjie Wu d30ca8baf7 msm: devfreq_cpubw: Move devfreq_cpubw to drivers/devfreq
In order to share devfreq_cpubw among all targets, it needs to be
moved outside arch/arm/mach-msm directory. Move the file and
Kconfig to drivers/devfreq.

Change-Id: I4dd476b315b04f84b07855bec3ed5b6061549ea9
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-04-16 17:58:56 -07:00
Linux Build Service Account edb5e6f797 Merge "PM / devfreq: Use freq_table for available_frequencies" 2014-04-11 23:29:08 -07:00
Linux Build Service Account 05cf0f39c1 Merge "devfreq: Make cpubw_hwmon governor reusable and hardware agnostic" 2014-04-11 00:32:55 -07:00
Saravana Kannan 6253be0f76 PM / devfreq: Use freq_table for available_frequencies
Some devices use freq_table instead of OPP. For those devices, the
available_frequencies file shows up empty. Fix that by using freq_table to
generate the available_frequencies data when OPP is not present.

Change-Id: Ibea8b388ee81c55d2eeddd8a1e2c18c91faed8c7
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-04-10 17:35:31 -07:00
Linux Build Service Account a6aeff2ca5 Merge "PM / devfreq: Check for GPU busy time before sending the sample" 2014-04-04 20:30:36 -07:00
Suman Tatiraju daf3903c97 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>
2014-04-02 13:12:53 -07:00
Saravana Kannan a0ea0dfcfc devfreq: Make cpubw_hwmon governor reusable and hardware agnostic
Since various hardware platforms might have different ways of monitoring
the CPU bandwidth, make the cpubw_hwmon governor hardware agnostic so that
it can be reused across these hardware platforms.

Change-Id: If7af01537dbf1df66551bea2bc73232d9e9264f7
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-03-28 18:31:31 -07:00
Saravana Kannan 47878a5cd2 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>
2014-03-17 16:26:24 -07:00
Junjie Wu d0e097389e msm: cpufreq: Move cpufreq to drivers/cpufreq/
Architecutural changes in the ARM Linux kernel tree mandate the
eventual removal of the mach-* directories. Move mach/cpufreq to
driver/cpufreq/. Also move related header to include/linux.

Change-Id: I6dcf69e275b7ca7ba913e945353a42f0d6321731
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2014-02-21 11:17:03 -08:00
Saravana Kannan 55ea6aef21 PM / devfreq: Fix out of bounds access of transition table array
The previous_freq value for a device could be an invalid frequency that
results in a error value being returned from devfreq_get_freq_level().
Check for an error value before using that to index into the transition
table.

Not doing this check will result in memory corruption when previous_freq is
not a valid frequency.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Change-Id: Ia9f9f3dabf14b26c4dff54fb2bac3e77f33458c0
2014-02-10 11:52:26 -08:00
Vikram Mulukutla 1e635c644a msm: scm: Move the scm driver to drivers/soc/qcom
Architectural changes in the ARM Linux kernel tree mandate
the eventual removal of the mach-* directories. Move the
scm driver to drivers/soc/qcom and the scm header to
include/soc/qcom to support that removal.

Change-Id: Ie660d0566de35045c1ba73fcddeda99efacf057e
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-01-24 11:49:11 -08:00
Saravana Kannan b98be7eb71 devfreq: governor_cpubw_hwmon: Fix use of decay_rate
The decay rate tunable is used to compute the current averaged bandwidth
use, but the calculated value is never used. Fix this by using the
calculated averaged bandwidth instead of the instantaneous measured
bandwidth when computing the AB and IB votes.

Change-Id: Ic0ba3ce0d98f0ec185349fe6d86c4af26f222ff2
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-01-20 16:17:39 -08:00
Saravana Kannan d838cb3b0d devfreq: governor_cpubw_hwmon: Remove sample_ms and fix round up of freq
devfreq already provides a sysfs interface for changing polling/sampling
period. So, there is no need for the governor to separately expose
sampling_ms. Also, sampling_ms had to be explicitly updated whenever
polling_ms was updated for the governor to function correctly. Make the
interface simpler by combining sample_ms with polling_interval control
provided by devfreq.

The rounding of freq to multiples of bw_step is unnecessary since the
devfreq device already does the rounding to the next valid level. Rounding
of AB to multiples of bw_step is still necessary since it's a vote that's
summed up and doesn't have a direct 1-to-1 mapping to frequencies.

Also update default bw_step to 190 MB/s instead of 200 MB/s to account for
the fact that MB/s to MHz conversion needs to take into account the
difference in the meaning of M (2^20 vs 10^6) between MB and MHz. Similarly
also update io_percent to 16.

Change-Id: I5fea989c647955103de3813be8eb9ec612f131bc
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2014-01-20 16:17:39 -08:00
Sahitya Tummala ed62d90178 PM / devfreq: Add new flag to do simple clock scaling
Add new flag "simple_scaling" to on demand governor so that
the clocks can be scaled up only when the load is more than
up threshold and can be scaled down only when the load is less
than down differential data as provided within
struct devfreq_simple_ondemand_data.

Change-Id: Ibc6ab6297c1b64b6e6eaaa76d735d0b9ae0f6477
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2014-01-13 15:26:01 +05:30
Linux Build Service Account 7722531012 Merge "devfreq: Add CPUBW HW monitor governor" 2014-01-06 13:22:46 -08:00
Nishanth Menon a2dc9b1bc9 PM / OPP: rename header to linux/pm_opp.h
Since Operating Performance Points (OPP) functions are specific
to device specific power management, be specific and rename opp.h
to pm_opp.h

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Git-commit: e4db1c7439b31993a4886b273bb9235a8eea82bf
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[junjiew@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2013-12-20 19:07:11 -08:00
Nishanth Menon 4dfc0d4764 PM / OPP: rename functions to dev_pm_opp*
Since Operating Performance Points (OPP) functions are specific to
device specific power management, be specific and rename opp_*
accessors in OPP library with dev_pm_opp_* equivalent.

Affected functions are:
 opp_get_voltage
 opp_get_freq
 opp_get_opp_count
 opp_find_freq_exact
 opp_find_freq_floor
 opp_find_freq_ceil
 opp_add
 opp_enable
 opp_disable
 opp_get_notifier
 opp_init_cpufreq_table
 opp_free_cpufreq_table

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Git-commit: 5d4879cda67b09f086807821cf594ee079d6dfbe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[junjiew@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2013-12-20 19:07:11 -08:00
Saravana Kannan 5559f6f66b devfreq: Add CPUBW HW monitor governor
The CPUBW HW monitor devfreq governor uses the Krait L2 PM counters to
determine the bandwidth needed by the Krait CPU subsystem. This governor
can be used in conjunction with the CPUBW devfreq device to dynamically
scale the DDR frequency based on the demand/actual usage from the Krait CPU
subsystem. Since this governor uses the Krait L2 PM counters it can
conflict with certain profiling tools.

The Krait L2 performance monitor counters have the capability to count the
no. of read/write transactions going out the master ports. They also have
the capability to raise interrupts when they overflow. This driver uses
those counters to determine the true usage of DDR from the Krait processor
subsystem and then recommends CPU DDR BW votes based on the measured values
and the following tunable parameters.

The driver provides various tunables that allow it to be tuned more in
favor of power or performance:

- io_percent: The percentage of the CPU time that can be spent waiting on
  memory I/O. Lower value is better performance and worse power.

- sample_ms: The sampling period in milliseconds. This only affects the
  sampling period when DDR use is ramping down or is increasing very slowly
  (See tolerance_percent).

- tolerance_percent: The minimum increase in DDR use, compared to previous
  sample, that will trigger an IRQ to immediately bump up the bandwidth
  vote. It's expressed as a percentage of the previous sampled DDR use.

- decay_rate: The parameter controls the rate at which the history is
  forgotten when ramping down. This is expressed as a percentage of history
  to be forgotten.  So 100% means ignore history, 0% mean never forget the
  historical max. The default 90% means forget 90% of history each time.

- guard_band_mbps: This is a margin that's added to the measured BW (and
  hence also the Bus BW votes) that's present to account for the time it
  takes to ramp up the DDR BW while the CPU continues to use the DDR.

- bw_step: All BW votes are rounded up to multiples of bw_step. The default
  value is 200 MB/s that turns out to ~25 or 12.5 MHz based on the SoC. A
  smaller value would mean more frequent bus BW changes. A higher value
  would mean less frequent BW vote updates, but also means at times an
  unnecessarily higher BW vote (due to the rounding up).

Change-Id: I88629a3e545cdca7160af8f8ca616ecc949d9947
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2013-12-20 15:53:53 -08:00
Saravana Kannan 6caeece9d4 devfreq: Add MSM CPUfreq governor
The MSM CPUfreq devfreq governor determines the CPU to DDR bandwidth vote
based on the current CPU frequency of all the active CPUs.

This functionality used to be a part of the MSM CPUfreq driver that
directly voted for the CPU to DDR bandwidth using MSM bus scaling APIs.
This refactor decouples CPU to DDR BW scaling from CPU frequency and allows
switch between various CPU BW governors.

The bandwidth values in the msm-cpufreq table have to be updated since the
new CPU BW driver does the MBps to Bps conversion correctly. The MSM
CPUfreq driver used to do * 1000 * 1000 to convert from MBps to Bps instead
of doing * 1024 * 1024.

Change-Id: I184f09d628a1b27d52506d2f760d65831f1a1110
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2013-12-19 16:38:47 -08:00
Vladimir Razgulin 463643b6fa PM / devfreq: Add a new target flag for the performance governor
The new flag for the devfreq profile->target() function is used
by the performance governor to notify the driver that the device
should wakeup on the max frequency.

Change-Id: I91c2d649177bdd1841a087a2125d1cdbc979f5c1
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-12-03 09:56:39 -07:00
Lucille Sylvester 0740af5156 PM: devfreq: Fix the fast ramp case in the adreno governor
Expected behavior of GPU DCVS is to immediately bump the frequency
to turbo upon encountering a long block of busy processing.  The
current code just raises the frequency by one level.

Change-Id: Ida953bb7be8a976da5400328a1c91083499e0fa0
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2013-11-24 21:27:45 -08:00
Lucille Sylvester c3a73b6c69 msm: kgsl: bus modifier computation
Use the vbif performance counter which counts bus busy cycles
to determine the requested bus bandwidth vote at a given
GPU frequency.

Change-Id: I18915ef8a2be75a7ef5795a6030a1f2ddd09a967
CRs-fixed: 574420
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2013-11-24 22:20:59 -07:00
Lucille Sylvester b15128dea0 msm: kgsl: convert pwrscale to use bus_mod
Use a bus specific speed flag rather than overloading
the least upper bound flag.

Change-Id: I343726e6e0d9885f39c343ed56c1667ab2008aee
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2013-11-15 16:29:26 -07:00
Lucille Sylvester 944cc1fe9f PM / devfreq: Allow the governors to set the target flag
The devfreq framework calls a frequency targeting function with
a flag parameter.  Allow the governors to influence that parameter.

Change-Id: I4058bd9dcd027dd246ccdb90d25c68f1dc055901
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2013-11-15 16:29:25 -07:00
Jeremy Gebben 3f8ad7a119 PM / devfreq: add msm-adreno-tz governor
This governor can be used to control adreno GPUs.
It is unlikely to be useful for other devices.

Change-Id: Icf481322454b814d2f41019f2f01286062409952
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-09-04 17:29:29 -07:00
Vladimir Razgulin f3616536ae PM / devfreq: fix find_governor_data() function
find_governor_data() was added to the devfreq infrastructure earlier.
It uses an incorrect condition in an if-statement when it searches
a governor by its name. Fixing the condition.

Change-Id: Ib297caad3e23984651217a43d2fdde1f6fcbdf7a
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-08-22 18:09:14 -07:00
Vladimir Razgulin 2626967e34 PM / devfreq: predef governors update freq when device is resumed
The predefined performance and powersave governors set the device
frequency on their startup only. That's not enough because the
frequency might have changed after device suspend-resume. With this
fix the governors re-set the required device frequency every time
a device get resumed.

Change-Id: I47ac877fc9e2cfbfc4a46cc676d6f2f838cd41d6
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-08-22 18:08:26 -07:00
Rajagopal Venkat 0fcba2fafa PM / devfreq: set min/max freq limit from freq table
Set devfreq device min and max frequency limits when device
is added to devfreq, provided frequency table is supplied.
This helps governors to suggest target frequency with in
limits.

Change-Id: Iab24aef59bfeffcfb3c3118c12ba58e25cd9d479
Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Patch-mainline: linux-pm @ 01/08/13, 05:50
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-08-22 18:08:25 -07:00
Jeremy Gebben 7a56dcfa6e PM / devfreq: allow governors to use devfreq_get_freq_level
Level based governors may need to perform this lookup to
interpret the current frequency of the device.

Change-Id: Idf7246b05775a52f088c52b898d98fbab4fd942c
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-08-22 18:08:19 -07:00
Jeremy Gebben 0e5b3352b5 PM / devfreq: improve devfreq->data support
This field is treated as governer specific data for
a devfreq instance. But there's currently no way to
set the correct data when switching governors through
sysfs. Add support for optionally passing a set of
name / data pairs in struct devfreq_dev_profile,
representing the data for each governor.

Change-Id: I5523ce94f8b0045974f0635fb734cb1282512f91
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2013-08-22 18:08:19 -07:00
Jiri Kosina 617677295b Merge branch 'master' into for-next
Conflicts:
	drivers/devfreq/exynos4_bus.c

Sync with Linus' tree to be able to apply patches that are
against newer code (mvneta).
2013-01-29 10:48:30 +01:00
Nishanth Menon 8fa938acb3 PM / devfreq: exynos4_bus: honor RCU lock usage
OPP pointers cannot be expected to be valid beyond the boundary
of rcu_read_lock and rcu_read_unlock. Unfortunately, the current
exynos4 busfreq driver does not honor the usage constraint and stores
the OPP pointer in struct busfreq_data. This could potentially
become invalid later such as: across devfreq opp change decisions,
resulting in unpredictable behavior.

To fix this, we introduce a busfreq specific busfreq_opp_info
structure which is used to handle OPP information. OPP information
is de-referenced to voltage and frequency pairs as needed into
busfreq_opp_info structure and used as needed.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-01-22 13:28:40 +01:00
Nishanth Menon bcb27549f4 PM / devfreq: add locking documentation for recommended_opp
OPP pointers are protected by RCU locks, the pointer validity is
permissible only under the section of rcu_read_lock to rcu_read_unlock

Add documentation to the effect.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-01-22 13:28:39 +01:00
Masanari Iida 8a168ca707 treewide: Fix typo in various drivers
Correct spelling typo in printk within various drivers.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-01-09 11:43:32 +01:00
Greg Kroah-Hartman 0fe763c570 Drivers: misc: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:16 -08:00
Rafael J. Wysocki bf58cdffac Merge branch 'pm-devfreq'
* pm-devfreq: (23 commits)
  PM / devfreq: remove compiler error with module governors (2)
  PM / devfreq: Fix return value in devfreq_remove_governor()
  PM / devfreq: Fix incorrect argument in error message
  PM / devfreq: missing rcu_read_lock() added for find_device_opp()
  PM / devfreq: remove compiler error when a governor is module
  PM / devfreq: exynos4_bus.c: Fixed an alignment of the func call args.
  PM / devfreq: Add sysfs node to expose available governors
  PM / devfreq: allow sysfs governor node to switch governor
  PM / devfreq: governors: add GPL module license and allow module build
  PM / devfreq: map devfreq drivers to governor using name
  PM / devfreq: register governors with devfreq framework
  PM / devfreq: provide hooks for governors to be registered
  PM / devfreq: export update_devfreq
  PM / devfreq: Add sysfs node for representing frequency transition information.
  PM / devfreq: Add sysfs node to expose available frequencies
  PM / devfreq: documentation cleanups for devfreq header
  PM / devfreq: Use devm_* functions in exynos4_bus.c
  PM / devfreq: make devfreq_class static
  PM / devfreq: fix sscanf handling for writable sysfs entries
  PM / devfreq: kernel-doc typo corrections
  ...
2012-12-07 23:13:36 +01:00
MyungJoo Ham 6dcdd8e3ca PM / devfreq: remove compiler error with module governors (2)
Governors compiled as modules may use these functions.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-28 20:29:17 +01:00
Sachin Kamat f9c08e2acb PM / devfreq: Fix return value in devfreq_remove_governor()
Use the value obtained from the function instead of -EINVAL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-26 19:17:50 +09:00
Sachin Kamat b9e1c8e821 PM / devfreq: Fix incorrect argument in error message
'g' is cast to the error return code. Hence gives the following error
which is fixed by this patch.

drivers/devfreq/devfreq.c:645 devfreq_remove_governor() error:
'g' dereferencing possible ERR_PTR()

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-26 19:17:48 +09:00
MyungJoo Ham 389baed01e PM / devfreq: missing rcu_read_lock() added for find_device_opp()
opp_get_notifier() uses find_device_opp(), which requires to
held rcu_read_lock. In order to keep the notifier-header
valid, we have added rcu_read_lock().

Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-26 19:17:46 +09:00
Sangho Yi dce9dc3a24 PM / devfreq: exynos4_bus.c: Fixed an alignment of the func call args.
I fixed the following check item (via checkpatch.pl --strict option):
CHECK: Alignment should match open parenthesis

Signed-off-by: Sangho Yi <antiroot@gmail.com>
[Merge conflict resolved]
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:24 +09:00
Nishanth Menon 50a5b33e01 PM / devfreq: Add sysfs node to expose available governors
Now that governor list can be variable, knowing the available governors
is useful to be able to select a governor using relevant sysfs node.

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:24 +09:00
Nishanth Menon 0359d1afe4 PM / devfreq: allow sysfs governor node to switch governor
This allows us to select governor runtime from the
default configuration without having to rebuild kernel
or the devfreq driver using the sysfs node:
/sys/class/devfreq/.../governor
cat of the governor will return valid governor
and an echo 'governor_name'>governor will switch
governor

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:23 +09:00
Nishanth Menon eff607fdb1 PM / devfreq: governors: add GPL module license and allow module build
Add GPL module license and remove the static build
restrictions for building governors. This allows governors now
to be loaded on a need basis and reloaded independently of kernel
build

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:23 +09:00
Nishanth Menon 1b5c1be2c8 PM / devfreq: map devfreq drivers to governor using name
Allow devfreq drivers to register a preferred governor name
and when the devfreq governor loads itself at a later point
required drivers are managed appropriately, at the time of
unload of a devfreq governor, stop managing those drivers
as well.

Since the governor structures do not need to be exposed
anymore, remove the definitions and make them static

NOTE: devfreq_list_lock is now used to protect governor
start and stop - as this allows us to protect governors and
devfreq with the proper dependencies as needed.

As part of this change, change the registration of exynos
bus driver to request for ondemand using the governor name.

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
[Merge conflict resolved by MyungJoo Ham]
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:22 +09:00
Nishanth Menon 83116e66a2 PM / devfreq: register governors with devfreq framework
With the new registration functions, governors can be now
registered with devfreq framework.

NOTE: generates 'discards qualifiers from pointer target type'
build warnings, which the next patche in this series fixes

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:22 +09:00
Nishanth Menon 3aa173b8db PM / devfreq: provide hooks for governors to be registered
Add devfreq_add_governor and devfreq_remove_governor which
can be invoked by governors to register with devfreq.

This sets up the stage to dynamically switch governors and
allow governors to be dynamically loaded as well.

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20 18:46:12 +09:00